mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Cleanup wchar_raii constructors
This commit is contained in:
parent
22cea8d90a
commit
2b87fa400a
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
@ -56,8 +57,9 @@ class wchar_raii : public generic_raii<wchar_t*, wchar_raii_free, static_cast<wc
|
|||||||
private:
|
private:
|
||||||
Py_ssize_t sz;
|
Py_ssize_t sz;
|
||||||
public:
|
public:
|
||||||
wchar_raii(PyObject *obj) {
|
wchar_raii(wchar_t *x=NULL) : generic_raii(x), sz(0) {}
|
||||||
from_unicode(obj);
|
wchar_raii(PyObject *obj) : generic_raii(), sz(0) {
|
||||||
|
if (!from_unicode(obj)) PyErr_Clear();
|
||||||
}
|
}
|
||||||
wchar_raii(wchar_t *obj, size_t sz) : generic_raii(obj), sz(sz) { }
|
wchar_raii(wchar_t *obj, size_t sz) : generic_raii(obj), sz(sz) { }
|
||||||
int from_unicode(PyObject *obj) {
|
int from_unicode(PyObject *obj) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user