diff --git a/src/_macosx.m b/src/_macosx.m index 2c7733033f24..ef66f56ddadc 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -812,10 +812,10 @@ static CGFloat _get_device_scale(CGContextRef cr) FigureManager_set_window_title(FigureManager* self, PyObject *args, PyObject *kwds) { - char* title; - if(!PyArg_ParseTuple(args, "es", "UTF-8", &title)) + const char* title; + if (!PyArg_ParseTuple(args, "s", &title)) { return NULL; - + } Window* window = self->window; if(window) { @@ -826,7 +826,6 @@ static CGFloat _get_device_scale(CGContextRef cr) [window setTitle: ns_title]; [pool release]; } - PyMem_Free(title); Py_RETURN_NONE; } @@ -1369,10 +1368,10 @@ -(void)save_figure:(id)sender { int result; const char* title; - char* default_filename; - if(!PyArg_ParseTuple(args, "ses", &title, "UTF-8", &default_filename)) + const char* default_filename; + if (!PyArg_ParseTuple(args, "ss", &title, &default_filename)) { return NULL; - + } NSSavePanel* panel = [NSSavePanel savePanel]; [panel setTitle: [NSString stringWithCString: title encoding: NSASCIIStringEncoding]]; @@ -1380,7 +1379,6 @@ -(void)save_figure:(id)sender [[NSString alloc] initWithCString: default_filename encoding: NSUTF8StringEncoding]; - PyMem_Free(default_filename); #ifdef COMPILING_FOR_10_6 [panel setNameFieldStringValue: ns_default_filename]; result = [panel runModal]; diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp index f71b62813fc0..fbde6fd8d05e 100644 --- a/src/ft2font_wrapper.cpp +++ b/src/ft2font_wrapper.cpp @@ -1066,15 +1066,10 @@ static PyObject *PyFT2Font_get_name_index(PyFT2Font *self, PyObject *args, PyObj { char *glyphname; long name_index; - - if (!PyArg_ParseTuple(args, "es:get_name_index", "ascii", &glyphname)) { + if (!PyArg_ParseTuple(args, "s:get_name_index", &glyphname)) { return NULL; } - CALL_CPP("get_name_index", name_index = self->x->get_name_index(glyphname)); - - PyMem_Free(glyphname); - return PyLong_FromLong(name_index); } @@ -1114,8 +1109,7 @@ const char *PyFT2Font_get_sfnt_table__doc__ = static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObject *kwds) { char *tagname; - - if (!PyArg_ParseTuple(args, "es:get_sfnt_table", "ascii", &tagname)) { + if (!PyArg_ParseTuple(args, "s:get_sfnt_table", &tagname)) { return NULL; } @@ -1128,8 +1122,6 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj } } - PyMem_Free(tagname); - void *table = FT_Get_Sfnt_Table(self->x->get_face(), (FT_Sfnt_Tag)tag); if (!table) { Py_RETURN_NONE;