diff options
Diffstat (limited to 'python/string.cc')
| -rw-r--r-- | python/string.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/python/string.cc b/python/string.cc index 1fa5a901..8168ea5b 100644 --- a/python/string.cc +++ b/python/string.cc @@ -3,22 +3,22 @@ // $Id: string.cc,v 1.3 2002/01/08 06:53:04 jgg Exp $ /* ###################################################################### - string - Mappings for the string functions that are worthwile for + string - Mappings for the string functions that are worthwile for Python users - + ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ #include "apt_pkgmodule.h" #include "generic.h" - + #include <apt-pkg/strutl.h> #include <Python.h> /*}}}*/ - + // Templated function /*{{{*/ -/* Macro for the generic string in string out function */ +/* Macro for the generic string in string out function */ #define MkStr(Python,CFunc) \ PyObject *Python(PyObject *Self,PyObject *Args) \ { \ @@ -36,7 +36,7 @@ PyObject *Python(PyObject *Self,PyObject *Args) \ return 0; \ return CppPyString(CFunc(Val)); \ } - + MkStr(StrDeQuote,DeQuoteString); MkStr(StrBase64Encode,Base64Encode); MkStr(StrURItoFileName,URItoFileName); @@ -58,7 +58,7 @@ PyObject *StrSizeToStr(PyObject *Self,PyObject *Args) return CppPyString(SizeToStr(PyLong_AsDouble(Obj))); if (PyFloat_Check(Obj)) return CppPyString(SizeToStr(PyFloat_AsDouble(Obj))); - + PyErr_SetString(PyExc_TypeError,"Only understand integers and floats"); return 0; } @@ -69,14 +69,14 @@ PyObject *StrQuoteString(PyObject *Self,PyObject *Args) char *Bad = 0; if (PyArg_ParseTuple(Args,"ss",&Str,&Bad) == 0) return 0; - return CppPyString(QuoteString(Str,Bad)); + return CppPyString(QuoteString(Str,Bad)); } PyObject *StrStringToBool(PyObject *Self,PyObject *Args) { char *Str = 0; if (PyArg_ParseTuple(Args,"s",&Str) == 0) - return 0; + return 0; return Py_BuildValue("i",StringToBool(Str)); } @@ -85,14 +85,14 @@ PyObject *StrStrToTime(PyObject *Self,PyObject *Args) char *Str = 0; if (PyArg_ParseTuple(Args,"s",&Str) == 0) return 0; - + time_t Result; if (StrToTime(Str,Result) == false) { Py_INCREF(Py_None); return Py_None; } - + return Py_BuildValue("i",Result); } |
