mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Various compilation fixed for windows extensions on python3
This commit is contained in:
parent
89f0d92d2e
commit
b5f0ab48ac
@ -38,7 +38,7 @@ wchar_t *wpd::unicode_to_wchar(PyObject *o) {
|
||||
len = PyUnicode_GET_SIZE(o);
|
||||
buf = (wchar_t *)calloc(len+2, sizeof(wchar_t));
|
||||
if (buf == NULL) { PyErr_NoMemory(); return NULL; }
|
||||
len = PyUnicode_AsWideChar((PyUnicodeObject*)o, buf, len);
|
||||
len = PyUnicode_AsWideChar(o, buf, len);
|
||||
if (len == -1) { free(buf); PyErr_Format(PyExc_TypeError, "Invalid python unicode object."); return NULL; }
|
||||
return buf;
|
||||
}
|
||||
@ -69,4 +69,3 @@ int wpd::pump_waiting_messages() {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ CALIBRE_MODINIT_FUNC initwpd(void) {
|
||||
|
||||
wpd::DeviceType.tp_new = PyType_GenericNew;
|
||||
if (PyType_Ready(&wpd::DeviceType) < 0)
|
||||
return;
|
||||
INITERROR;
|
||||
|
||||
m = INITMODULE;
|
||||
if (m == NULL) {
|
||||
|
@ -27,7 +27,7 @@ static wchar_t* unicode_to_wchar(PyObject *o) {
|
||||
len = PyUnicode_GET_SIZE(o);
|
||||
buf = (wchar_t *)calloc(len+2, sizeof(wchar_t));
|
||||
if (buf == NULL) { PyErr_NoMemory(); return NULL; }
|
||||
len = PyUnicode_AsWideChar((PyUnicodeObject*)o, buf, len);
|
||||
len = PyUnicode_AsWideChar(o, buf, len);
|
||||
if (len == -1) { free(buf); PyErr_Format(PyExc_TypeError, "Invalid python unicode object."); return NULL; }
|
||||
return buf;
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ wherever possible in this module.
|
||||
#include <locale.h>
|
||||
#include <Python.h>
|
||||
#include <structseq.h>
|
||||
#include <timefuncs.h>
|
||||
#include <shlobj.h>
|
||||
#include <stdio.h>
|
||||
#include <setupapi.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user