@@ -193,7 +193,10 @@ FT2Image::py_write_bitmap(const Py::Tuple & args)
193
193
194
194
write_bitmap (fh);
195
195
196
- mpl_PyFile_DupClose (py_file, fh, offset);
196
+ if (mpl_PyFile_DupClose (py_file, fh, offset))
197
+ {
198
+ throw Py::Exception ();
199
+ }
197
200
mpl_PyFile_CloseFile (py_file);
198
201
Py_DECREF (py_file);
199
202
@@ -2143,7 +2146,10 @@ static void close_file_callback(FT_Stream stream)
2143
2146
{
2144
2147
py_file_def *def = (py_file_def *)stream->descriptor .pointer ;
2145
2148
2146
- mpl_PyFile_DupClose (def->py_file , def->fp , def->offset );
2149
+ if (mpl_PyFile_DupClose (def->py_file , def->fp , def->offset ))
2150
+ {
2151
+ throw Py::Exception ();
2152
+ }
2147
2153
2148
2154
if (def->close_file ) {
2149
2155
mpl_PyFile_CloseFile (def->py_file );
@@ -2165,7 +2171,7 @@ FT2Font::make_open_args(PyObject *py_file_arg, FT_Open_Args *open_args)
2165
2171
py_file_def *stream_info = NULL ;
2166
2172
long file_size;
2167
2173
FT_Byte *new_memory;
2168
- mpl_off_t offset;
2174
+ mpl_off_t offset = 0 ;
2169
2175
2170
2176
int result = -1 ;
2171
2177
@@ -2208,7 +2214,7 @@ FT2Font::make_open_args(PyObject *py_file_arg, FT_Open_Args *open_args)
2208
2214
open_args->stream = &stream;
2209
2215
} else {
2210
2216
if (PyObject_HasAttrString (py_file_arg, " read" ) &&
2211
- (data = PyObject_CallMethod (py_file_arg, " read" , " " ))) {
2217
+ (data = PyObject_CallMethod (py_file_arg, ( char *) " read" , ( char *) " " ))) {
2212
2218
if (PyBytes_AsStringAndSize (data, &data_ptr, &data_len)) {
2213
2219
goto exit ;
2214
2220
}
0 commit comments