Fix some method declarations for Python API compat

This commit is contained in:
Kovid Goyal
2024-12-24 22:22:12 +05:30
parent bc612a5437
commit 155990ce0b
3 changed files with 8 additions and 8 deletions

View File

@@ -939,7 +939,7 @@ cocoa_get_workspace_ids(void *w, size_t *workspace_ids, size_t array_sz) {
} }
static PyObject* static PyObject*
cocoa_get_lang(PyObject UNUSED *self) { cocoa_get_lang(PyObject UNUSED *self, PyObject *args UNUSED) {
@autoreleasepool { @autoreleasepool {
NSString* lang_code = [[NSLocale currentLocale] languageCode]; NSString* lang_code = [[NSLocale currentLocale] languageCode];
NSString* country_code = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; NSString* country_code = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];

View File

@@ -1035,7 +1035,7 @@ get_best_name(CTFace *self, PyObject *nameid) {
} }
static PyObject* static PyObject*
get_variation(CTFace *self) { get_variation(CTFace *self, PyObject *args UNUSED) {
RAII_CoreFoundation(CFDictionaryRef, src, CTFontCopyVariation(self->ct_font)); RAII_CoreFoundation(CFDictionaryRef, src, CTFontCopyVariation(self->ct_font));
return variation_to_python(src); return variation_to_python(src);
} }
@@ -1062,7 +1062,7 @@ get_features(CTFace *self, PyObject *a UNUSED) {
static PyObject* static PyObject*
get_variable_data(CTFace *self) { get_variable_data(CTFace *self, PyObject *args UNUSED) {
if (!ensure_name_table(self)) return NULL; if (!ensure_name_table(self)) return NULL;
RAII_PyObject(output, PyDict_New()); RAII_PyObject(output, PyDict_New());
if (!output) return NULL; if (!output) return NULL;
@@ -1078,7 +1078,7 @@ get_variable_data(CTFace *self) {
} }
static PyObject* static PyObject*
identify_for_debug(CTFace *self) { identify_for_debug(CTFace *self, PyObject *args UNUSED) {
RAII_PyObject(features, PyTuple_New(self->font_features.count)); if (!features) return NULL; RAII_PyObject(features, PyTuple_New(self->font_features.count)); if (!features) return NULL;
char buf[128]; char buf[128];
for (unsigned i = 0; i < self->font_features.count; i++) { for (unsigned i = 0; i < self->font_features.count; i++) {
@@ -1095,13 +1095,13 @@ identify_for_debug(CTFace *self) {
// Boilerplate {{{ // Boilerplate {{{
static PyObject* static PyObject*
display_name(CTFace *self) { display_name(CTFace *self, PyObject *args UNUSED) {
CFStringRef dn = CTFontCopyDisplayName(self->ct_font); CFStringRef dn = CTFontCopyDisplayName(self->ct_font);
return convert_cfstring(dn, true); return convert_cfstring(dn, true);
} }
static PyObject* static PyObject*
postscript_name(CTFace *self) { postscript_name(CTFace *self, PyObject *args UNUSED) {
return self->postscript_name ? Py_BuildValue("O", self->postscript_name) : PyUnicode_FromString(""); return self->postscript_name ? Py_BuildValue("O", self->postscript_name) : PyUnicode_FromString("");
} }

View File

@@ -42,14 +42,14 @@
#include <xlocale.h> #include <xlocale.h>
static PyObject* static PyObject*
user_cache_dir(void) { user_cache_dir(PyObject *self UNUSED, PyObject *args UNUSED) {
static char buf[1024]; static char buf[1024];
if (!confstr(_CS_DARWIN_USER_CACHE_DIR, buf, sizeof(buf) - 1)) return PyErr_SetFromErrno(PyExc_OSError); if (!confstr(_CS_DARWIN_USER_CACHE_DIR, buf, sizeof(buf) - 1)) return PyErr_SetFromErrno(PyExc_OSError);
return PyUnicode_FromString(buf); return PyUnicode_FromString(buf);
} }
static PyObject* static PyObject*
process_group_map(void) { process_group_map(PyObject *self UNUSED, PyObject *args UNUSED) {
int num_of_processes = proc_listallpids(NULL, 0); int num_of_processes = proc_listallpids(NULL, 0);
size_t bufsize = sizeof(pid_t) * (num_of_processes + 1024); size_t bufsize = sizeof(pid_t) * (num_of_processes + 1024);
RAII_ALLOC(pid_t, buf, malloc(bufsize)); RAII_ALLOC(pid_t, buf, malloc(bufsize));