@@ -58,8 +58,7 @@ static Tk_PhotoSetSize_84_t TK_PHOTO_SET_SIZE_84;
58
58
static Tk_PhotoPutBlock_85_t TK_PHOTO_PUT_BLOCK_85 ;
59
59
60
60
static Imaging
61
- ImagingFind (const char * name )
62
- {
61
+ ImagingFind (const char * name ) {
63
62
Py_ssize_t id ;
64
63
65
64
/* FIXME: use CObject instead? */
@@ -77,8 +76,7 @@ ImagingFind(const char *name)
77
76
78
77
static int
79
78
PyImagingPhotoPut (ClientData clientdata , Tcl_Interp * interp , int argc ,
80
- const char * * argv )
81
- {
79
+ const char * * argv ) {
82
80
Imaging im ;
83
81
Tk_PhotoHandle photo ;
84
82
Tk_PhotoImageBlock block ;
@@ -112,20 +110,17 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp *interp, int argc,
112
110
if (strcmp (im -> mode , "1" ) == 0 || strcmp (im -> mode , "L" ) == 0 ) {
113
111
block .pixelSize = 1 ;
114
112
block .offset [0 ] = block .offset [1 ] = block .offset [2 ] = 0 ;
115
- }
116
- else if (strncmp (im -> mode , "RGB" , 3 ) == 0 ) {
113
+ } else if (strncmp (im -> mode , "RGB" , 3 ) == 0 ) {
117
114
block .pixelSize = 4 ;
118
115
block .offset [0 ] = 0 ;
119
116
block .offset [1 ] = 1 ;
120
117
block .offset [2 ] = 2 ;
121
118
if (strcmp (im -> mode , "RGBA" ) == 0 ) {
122
119
block .offset [3 ] = 3 ; /* alpha (or reserved, under 8.2) */
123
- }
124
- else {
120
+ } else {
125
121
block .offset [3 ] = 0 ; /* no alpha */
126
122
}
127
- }
128
- else {
123
+ } else {
129
124
TCL_APPEND_RESULT (interp , "Bad mode" , (char * )NULL );
130
125
return TCL_ERROR ;
131
126
}
@@ -143,8 +138,7 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp *interp, int argc,
143
138
/* (fixed in Tk 8.5a3) */
144
139
TK_PHOTO_SET_SIZE_84 (photo , block .width , block .height );
145
140
}
146
- }
147
- else {
141
+ } else {
148
142
/* Tk >=8.5 */
149
143
TK_PHOTO_PUT_BLOCK_85 (interp , photo , & block , 0 , 0 , block .width , block .height ,
150
144
TK_PHOTO_COMPOSITE_SET );
@@ -155,8 +149,7 @@ PyImagingPhotoPut(ClientData clientdata, Tcl_Interp *interp, int argc,
155
149
156
150
static int
157
151
PyImagingPhotoGet (ClientData clientdata , Tcl_Interp * interp , int argc ,
158
- const char * * argv )
159
- {
152
+ const char * * argv ) {
160
153
Imaging im ;
161
154
Tk_PhotoHandle photo ;
162
155
Tk_PhotoImageBlock block ;
@@ -198,8 +191,7 @@ PyImagingPhotoGet(ClientData clientdata, Tcl_Interp *interp, int argc,
198
191
}
199
192
200
193
void
201
- TkImaging_Init (Tcl_Interp * interp )
202
- {
194
+ TkImaging_Init (Tcl_Interp * interp ) {
203
195
TCL_CREATE_COMMAND (interp , "PyImagingPhoto" , PyImagingPhotoPut , (ClientData )0 ,
204
196
(Tcl_CmdDeleteProc * )NULL );
205
197
TCL_CREATE_COMMAND (interp , "PyImagingPhotoGet" , PyImagingPhotoGet , (ClientData )0 ,
@@ -229,8 +221,7 @@ TkImaging_Init(Tcl_Interp *interp)
229
221
#define TKINTER_PKG "tkinter"
230
222
231
223
FARPROC
232
- _dfunc (HMODULE lib_handle , const char * func_name )
233
- {
224
+ _dfunc (HMODULE lib_handle , const char * func_name ) {
234
225
/*
235
226
* Load function `func_name` from `lib_handle`.
236
227
* Set Python exception if we can't find `func_name` in `lib_handle`.
@@ -248,8 +239,7 @@ _dfunc(HMODULE lib_handle, const char *func_name)
248
239
}
249
240
250
241
int
251
- get_tcl (HMODULE hMod )
252
- {
242
+ get_tcl (HMODULE hMod ) {
253
243
/*
254
244
* Try to fill Tcl global vars with function pointers. Return 0 for no
255
245
* functions found, 1 for all functions found, -1 for some but not all
@@ -267,8 +257,7 @@ get_tcl(HMODULE hMod)
267
257
}
268
258
269
259
int
270
- get_tk (HMODULE hMod )
271
- {
260
+ get_tk (HMODULE hMod ) {
272
261
/*
273
262
* Try to fill Tk global vars with function pointers. Return 0 for no
274
263
* functions found, 1 for all functions found, -1 for some but not all
@@ -300,8 +289,7 @@ get_tk(HMODULE hMod)
300
289
}
301
290
302
291
int
303
- load_tkinter_funcs (void )
304
- {
292
+ load_tkinter_funcs (void ) {
305
293
/*
306
294
* Load Tcl and Tk functions by searching all modules in current process.
307
295
* Return 0 for success, non-zero for failure.
@@ -347,8 +335,7 @@ load_tkinter_funcs(void)
347
335
348
336
if (found_tcl == 0 ) {
349
337
PyErr_SetString (PyExc_RuntimeError , "Could not find Tcl routines" );
350
- }
351
- else {
338
+ } else {
352
339
PyErr_SetString (PyExc_RuntimeError , "Could not find Tk routines" );
353
340
}
354
341
return 1 ;
@@ -364,8 +351,7 @@ load_tkinter_funcs(void)
364
351
365
352
/* From module __file__ attribute to char *string for dlopen. */
366
353
char *
367
- fname2char (PyObject * fname )
368
- {
354
+ fname2char (PyObject * fname ) {
369
355
PyObject * bytes ;
370
356
bytes = PyUnicode_EncodeFSDefault (fname );
371
357
if (bytes == NULL ) {
@@ -377,8 +363,7 @@ fname2char(PyObject *fname)
377
363
#include <dlfcn.h>
378
364
379
365
void *
380
- _dfunc (void * lib_handle , const char * func_name )
381
- {
366
+ _dfunc (void * lib_handle , const char * func_name ) {
382
367
/*
383
368
* Load function `func_name` from `lib_handle`.
384
369
* Set Python exception if we can't find `func_name` in `lib_handle`.
@@ -397,8 +382,7 @@ _dfunc(void *lib_handle, const char *func_name)
397
382
}
398
383
399
384
int
400
- _func_loader (void * lib )
401
- {
385
+ _func_loader (void * lib ) {
402
386
/*
403
387
* Fill global function pointers from dynamic lib.
404
388
* Return 1 if any pointer is NULL, 0 otherwise.
@@ -432,8 +416,7 @@ _func_loader(void *lib)
432
416
}
433
417
434
418
int
435
- load_tkinter_funcs (void )
436
- {
419
+ load_tkinter_funcs (void ) {
437
420
/*
438
421
* Load tkinter global funcs from tkinter compiled module.
439
422
* Return 0 for success, non-zero for failure.
0 commit comments