diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
| commit | 8b46b0c4bdfbaa07972311b1cf19616d5c5aff04 (patch) | |
| tree | 59167b2b8c1d331bfebf072d5ba84dd154f0b373 /python/string.cc | |
| parent | 6c1711a80a8a7d011f4d5f49618ff396ad2f5722 (diff) | |
| parent | 85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff) | |
| download | python-apt-8b46b0c4bdfbaa07972311b1cf19616d5c5aff04.tar.gz | |
merge from the debian experimental branch
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); } |
