diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-17 16:17:36 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-17 16:17:36 +0100 |
| commit | d1b2c0fbd34cee0ffced8270149b87def7675b2a (patch) | |
| tree | f4b8a14fc619b2e6ea297385e289b2549f6f21a4 /python/string.cc | |
| parent | c62bdd0b1b633b134ba551847da0c1e8d12115c2 (diff) | |
| parent | 930f6a2899b0b410777397fb206a8eba8c99100c (diff) | |
| download | python-apt-d1b2c0fbd34cee0ffced8270149b87def7675b2a.tar.gz | |
merged from the debian-sid branch
Diffstat (limited to 'python/string.cc')
| -rw-r--r-- | python/string.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/python/string.cc b/python/string.cc index 8168ea5b..b95ee3eb 100644 --- a/python/string.cc +++ b/python/string.cc @@ -38,7 +38,21 @@ PyObject *Python(PyObject *Self,PyObject *Args) \ } MkStr(StrDeQuote,DeQuoteString); -MkStr(StrBase64Encode,Base64Encode); + +/* + * Input bytes(Py3k)/str(Py2), output str. + */ +PyObject *StrBase64Encode(PyObject *Self,PyObject *Args) { + char *Str = 0; + #if PY_MAJOR_VERSION >= 3 + if (PyArg_ParseTuple(Args,"y",&Str) == 0) + #else + if (PyArg_ParseTuple(Args,"s",&Str) == 0) + #endif + return 0; + return CppPyString(Base64Encode(Str)); +} + MkStr(StrURItoFileName,URItoFileName); //MkFloat(StrSizeToStr,SizeToStr); |
