mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix some compiler warnings
This commit is contained in:
parent
a69f0b221f
commit
76b3da6edf
@ -105,7 +105,7 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
io_iterator_t iter;
|
io_iterator_t iter;
|
||||||
kr = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter);
|
kr = IOServiceGetMatchingServices(kIOMainPortDefault, matchingDict, &iter);
|
||||||
if (KERN_SUCCESS != kr) {
|
if (KERN_SUCCESS != kr) {
|
||||||
printf("IOServiceGetMatchingServices returned 0x%08x\n", kr);
|
printf("IOServiceGetMatchingServices returned 0x%08x\n", kr);
|
||||||
PyErr_SetString(PyExc_RuntimeError, "Could not run IO Matching");
|
PyErr_SetString(PyExc_RuntimeError, "Could not run IO Matching");
|
||||||
@ -217,7 +217,7 @@ usbobserver_get_usb_drives(PyObject *self, PyObject *args) {
|
|||||||
ans = PyList_New(0);
|
ans = PyList_New(0);
|
||||||
if (ans == NULL) return PyErr_NoMemory();
|
if (ans == NULL) return PyErr_NoMemory();
|
||||||
|
|
||||||
kr = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter);
|
kr = IOServiceGetMatchingServices(kIOMainPortDefault, matchingDict, &iter);
|
||||||
if (KERN_SUCCESS != kr) {
|
if (KERN_SUCCESS != kr) {
|
||||||
printf("IOServiceGetMatchingServices returned 0x%08x\n", kr);
|
printf("IOServiceGetMatchingServices returned 0x%08x\n", kr);
|
||||||
PyErr_SetString(PyExc_RuntimeError, "Could not run IO Matching");
|
PyErr_SetString(PyExc_RuntimeError, "Could not run IO Matching");
|
||||||
@ -411,7 +411,7 @@ usbobserver_is_mtp(PyObject *self, PyObject * args) {
|
|||||||
CFDictionarySetValue(matching_dict, CFSTR(kUSBDeviceReleaseNumber), num);
|
CFDictionarySetValue(matching_dict, CFSTR(kUSBDeviceReleaseNumber), num);
|
||||||
CFRelease(num); num = NULL;
|
CFRelease(num); num = NULL;
|
||||||
|
|
||||||
kr = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dict, &iter);
|
kr = IOServiceGetMatchingServices(kIOMainPortDefault, matching_dict, &iter);
|
||||||
matching_dict = NULL;
|
matching_dict = NULL;
|
||||||
if (KERN_SUCCESS != kr) {
|
if (KERN_SUCCESS != kr) {
|
||||||
PyErr_Format(PyExc_RuntimeError, "IOServiceGetMatchingServices returned 0x%x", kr);
|
PyErr_Format(PyExc_RuntimeError, "IOServiceGetMatchingServices returned 0x%x", kr);
|
||||||
|
@ -24,7 +24,7 @@ static wchar_t* unicode_to_wchar(PyObject *o) {
|
|||||||
Py_ssize_t len;
|
Py_ssize_t len;
|
||||||
if (o == NULL) return NULL;
|
if (o == NULL) return NULL;
|
||||||
if (!PyUnicode_Check(o)) {PyErr_Format(PyExc_TypeError, "The python object must be a unicode object"); return NULL;}
|
if (!PyUnicode_Check(o)) {PyErr_Format(PyExc_TypeError, "The python object must be a unicode object"); return NULL;}
|
||||||
len = PyUnicode_GET_SIZE(o);
|
len = PyUnicode_GET_LENGTH(o);
|
||||||
buf = (wchar_t *)calloc(len+2, sizeof(wchar_t));
|
buf = (wchar_t *)calloc(len+2, sizeof(wchar_t));
|
||||||
if (buf == NULL) { PyErr_NoMemory(); return NULL; }
|
if (buf == NULL) { PyErr_NoMemory(); return NULL; }
|
||||||
len = PyUnicode_AsWideChar(o, buf, len);
|
len = PyUnicode_AsWideChar(o, buf, len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user