Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd06486

Browse files
committed
Shut up many more gcc warnings.
1 parent 5a1516b commit fd06486

31 files changed

Lines changed: 186 additions & 110 deletions

Mac/Modules/ae/_AEmodule.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66

77

8+
#ifdef _WIN32
9+
#include "pywintoolbox.h"
10+
#else
811
#include "macglue.h"
912
#include "pymactoolbox.h"
13+
#endif
1014

1115
/* Macro to test whether a weak-loaded CFM function exists */
1216
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@@ -158,7 +162,6 @@ static PyObject *AEDesc_AEPutPtr(AEDescObject *_self, PyObject *_args)
158162
if (_err != noErr) return PyMac_Error(_err);
159163
Py_INCREF(Py_None);
160164
_res = Py_None;
161-
dataPtr__error__: ;
162165
return _res;
163166
}
164167

@@ -302,7 +305,6 @@ static PyObject *AEDesc_AEPutParamPtr(AEDescObject *_self, PyObject *_args)
302305
if (_err != noErr) return PyMac_Error(_err);
303306
Py_INCREF(Py_None);
304307
_res = Py_None;
305-
dataPtr__error__: ;
306308
return _res;
307309
}
308310

@@ -517,7 +519,6 @@ static PyObject *AEDesc_AEPutAttributePtr(AEDescObject *_self, PyObject *_args)
517519
if (_err != noErr) return PyMac_Error(_err);
518520
Py_INCREF(Py_None);
519521
_res = Py_None;
520-
dataPtr__error__: ;
521522
return _res;
522523
}
523524

@@ -827,7 +828,6 @@ static PyObject *AE_AECoercePtr(PyObject *_self, PyObject *_args)
827828
if (_err != noErr) return PyMac_Error(_err);
828829
_res = Py_BuildValue("O&",
829830
AEDesc_New, &result);
830-
dataPtr__error__: ;
831831
return _res;
832832
}
833833

@@ -851,7 +851,6 @@ static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args)
851851
if (_err != noErr) return PyMac_Error(_err);
852852
_res = Py_BuildValue("O&",
853853
AEDesc_New, &result);
854-
dataPtr__error__: ;
855854
return _res;
856855
}
857856

@@ -875,7 +874,6 @@ static PyObject *AE_AECreateList(PyObject *_self, PyObject *_args)
875874
if (_err != noErr) return PyMac_Error(_err);
876875
_res = Py_BuildValue("O&",
877876
AEDesc_New, &resultList);
878-
factoringPtr__error__: ;
879877
return _res;
880878
}
881879

@@ -930,7 +928,6 @@ static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args)
930928
if (_err != noErr) return PyMac_Error(_err);
931929
_res = Py_BuildValue("O&",
932930
AEDesc_New, &theAEDesc);
933-
dataPtr__error__: ;
934931
return _res;
935932
}
936933
#endif

Mac/Modules/app/_Appmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66

77

8+
#ifdef _WIN32
9+
#include "pywintoolbox.h"
10+
#else
811
#include "macglue.h"
912
#include "pymactoolbox.h"
13+
#endif
1014

1115
/* Macro to test whether a weak-loaded CFM function exists */
1216
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

Mac/Modules/cf/_CFmodule.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66

77

8+
#ifdef _WIN32
9+
#include "pywintoolbox.h"
10+
#else
811
#include "macglue.h"
912
#include "pymactoolbox.h"
13+
#endif
1014

1115
/* Macro to test whether a weak-loaded CFM function exists */
1216
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@@ -272,7 +276,7 @@ static int CFTypeRefObj_compare(CFTypeRefObject *self, CFTypeRefObject *other)
272276
static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
273277
{
274278
char buf[100];
275-
sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", CFGetTypeID(self->ob_itself), (unsigned long)self, (unsigned long)self->ob_itself);
279+
sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);
276280
return PyString_FromString(buf);
277281
}
278282

@@ -422,7 +426,7 @@ static int CFArrayRefObj_compare(CFArrayRefObject *self, CFArrayRefObject *other
422426
static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
423427
{
424428
char buf[100];
425-
sprintf(buf, "<CFArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
429+
sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
426430
return PyString_FromString(buf);
427431
}
428432

@@ -575,7 +579,7 @@ static int CFMutableArrayRefObj_compare(CFMutableArrayRefObject *self, CFMutable
575579
static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
576580
{
577581
char buf[100];
578-
sprintf(buf, "<CFMutableArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
582+
sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
579583
return PyString_FromString(buf);
580584
}
581585

@@ -707,7 +711,7 @@ static int CFDictionaryRefObj_compare(CFDictionaryRefObject *self, CFDictionaryR
707711
static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
708712
{
709713
char buf[100];
710-
sprintf(buf, "<CFDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
714+
sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
711715
return PyString_FromString(buf);
712716
}
713717

@@ -823,7 +827,7 @@ static int CFMutableDictionaryRefObj_compare(CFMutableDictionaryRefObject *self,
823827
static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *self)
824828
{
825829
char buf[100];
826-
sprintf(buf, "<CFMutableDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
830+
sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
827831
return PyString_FromString(buf);
828832
}
829833

@@ -973,7 +977,7 @@ static int CFDataRefObj_compare(CFDataRefObject *self, CFDataRefObject *other)
973977
static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
974978
{
975979
char buf[100];
976-
sprintf(buf, "<CFDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
980+
sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
977981
return PyString_FromString(buf);
978982
}
979983

@@ -1096,7 +1100,6 @@ static PyObject *CFMutableDataRefObj_CFDataAppendBytes(CFMutableDataRefObject *_
10961100
bytes__in__, bytes__len__);
10971101
Py_INCREF(Py_None);
10981102
_res = Py_None;
1099-
bytes__error__: ;
11001103
return _res;
11011104
}
11021105

@@ -1118,7 +1121,6 @@ static PyObject *CFMutableDataRefObj_CFDataReplaceBytes(CFMutableDataRefObject *
11181121
newBytes__in__, newBytes__len__);
11191122
Py_INCREF(Py_None);
11201123
_res = Py_None;
1121-
newBytes__error__: ;
11221124
return _res;
11231125
}
11241126

@@ -1171,7 +1173,7 @@ static int CFMutableDataRefObj_compare(CFMutableDataRefObject *self, CFMutableDa
11711173
static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
11721174
{
11731175
char buf[100];
1174-
sprintf(buf, "<CFMutableDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
1176+
sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
11751177
return PyString_FromString(buf);
11761178
}
11771179

@@ -1774,7 +1776,7 @@ static int CFStringRefObj_compare(CFStringRefObject *self, CFStringRefObject *ot
17741776
static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
17751777
{
17761778
char buf[100];
1777-
sprintf(buf, "<CFStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
1779+
sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
17781780
return PyString_FromString(buf);
17791781
}
17801782

@@ -2061,7 +2063,7 @@ static int CFMutableStringRefObj_compare(CFMutableStringRefObject *self, CFMutab
20612063
static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
20622064
{
20632065
char buf[100];
2064-
sprintf(buf, "<CFMutableStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
2066+
sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
20652067
return PyString_FromString(buf);
20662068
}
20672069

@@ -2433,7 +2435,7 @@ static int CFURLRefObj_compare(CFURLRefObject *self, CFURLRefObject *other)
24332435
static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
24342436
{
24352437
char buf[100];
2436-
sprintf(buf, "<CFURL object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
2438+
sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
24372439
return PyString_FromString(buf);
24382440
}
24392441

@@ -2590,7 +2592,6 @@ static PyObject *CF_CFDataCreate(PyObject *_self, PyObject *_args)
25902592
bytes__in__, bytes__len__);
25912593
_res = Py_BuildValue("O&",
25922594
CFDataRefObj_New, _rv);
2593-
bytes__error__: ;
25942595
return _res;
25952596
}
25962597

@@ -2611,7 +2612,6 @@ static PyObject *CF_CFDataCreateWithBytesNoCopy(PyObject *_self, PyObject *_args
26112612
(CFAllocatorRef)NULL);
26122613
_res = Py_BuildValue("O&",
26132614
CFDataRefObj_New, _rv);
2614-
bytes__error__: ;
26152615
return _res;
26162616
}
26172617

@@ -2848,7 +2848,6 @@ static PyObject *CF_CFStringCreateWithBytes(PyObject *_self, PyObject *_args)
28482848
isExternalRepresentation);
28492849
_res = Py_BuildValue("O&",
28502850
CFStringRefObj_New, _rv);
2851-
bytes__error__: ;
28522851
return _res;
28532852
}
28542853

@@ -3038,7 +3037,6 @@ static PyObject *CF_CFURLCreateWithBytes(PyObject *_self, PyObject *_args)
30383037
baseURL);
30393038
_res = Py_BuildValue("O&",
30403039
CFURLRefObj_New, _rv);
3041-
URLBytes__error__: ;
30423040
return _res;
30433041
}
30443042

Mac/Modules/cf/cfsupport.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def outputRepr(self):
190190
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
191191
OutLbrace()
192192
Output("char buf[100];")
193-
Output("""sprintf(buf, "<CFTypeRef type-%%d object at 0x%%8.8x for 0x%%8.8x>", CFGetTypeID(self->ob_itself), (unsigned long)self, (unsigned long)self->ob_itself);""")
193+
Output("""sprintf(buf, "<CFTypeRef type-%%d object at 0x%%8.8x for 0x%%8.8x>", CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);""")
194194
Output("return PyString_FromString(buf);")
195195
OutRbrace()
196196

@@ -205,7 +205,7 @@ def outputRepr(self):
205205
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
206206
OutLbrace()
207207
Output("char buf[100];")
208-
Output("""sprintf(buf, "<CFArrayRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
208+
Output("""sprintf(buf, "<CFArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
209209
Output("return PyString_FromString(buf);")
210210
OutRbrace()
211211

@@ -217,7 +217,7 @@ def outputRepr(self):
217217
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
218218
OutLbrace()
219219
Output("char buf[100];")
220-
Output("""sprintf(buf, "<CFMutableArrayRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
220+
Output("""sprintf(buf, "<CFMutableArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
221221
Output("return PyString_FromString(buf);")
222222
OutRbrace()
223223

@@ -229,7 +229,7 @@ def outputRepr(self):
229229
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
230230
OutLbrace()
231231
Output("char buf[100];")
232-
Output("""sprintf(buf, "<CFDictionaryRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
232+
Output("""sprintf(buf, "<CFDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
233233
Output("return PyString_FromString(buf);")
234234
OutRbrace()
235235

@@ -241,7 +241,7 @@ def outputRepr(self):
241241
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
242242
OutLbrace()
243243
Output("char buf[100];")
244-
Output("""sprintf(buf, "<CFMutableDictionaryRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
244+
Output("""sprintf(buf, "<CFMutableDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
245245
Output("return PyString_FromString(buf);")
246246
OutRbrace()
247247

@@ -253,7 +253,7 @@ def outputRepr(self):
253253
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
254254
OutLbrace()
255255
Output("char buf[100];")
256-
Output("""sprintf(buf, "<CFDataRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
256+
Output("""sprintf(buf, "<CFDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
257257
Output("return PyString_FromString(buf);")
258258
OutRbrace()
259259

@@ -265,7 +265,7 @@ def outputRepr(self):
265265
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
266266
OutLbrace()
267267
Output("char buf[100];")
268-
Output("""sprintf(buf, "<CFMutableDataRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
268+
Output("""sprintf(buf, "<CFMutableDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
269269
Output("return PyString_FromString(buf);")
270270
OutRbrace()
271271

@@ -296,7 +296,7 @@ def outputRepr(self):
296296
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
297297
OutLbrace()
298298
Output("char buf[100];")
299-
Output("""sprintf(buf, "<CFStringRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
299+
Output("""sprintf(buf, "<CFStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
300300
Output("return PyString_FromString(buf);")
301301
OutRbrace()
302302

@@ -312,7 +312,7 @@ def outputRepr(self):
312312
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
313313
OutLbrace()
314314
Output("char buf[100];")
315-
Output("""sprintf(buf, "<CFMutableStringRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
315+
Output("""sprintf(buf, "<CFMutableStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
316316
Output("return PyString_FromString(buf);")
317317
OutRbrace()
318318

@@ -324,7 +324,7 @@ def outputRepr(self):
324324
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
325325
OutLbrace()
326326
Output("char buf[100];")
327-
Output("""sprintf(buf, "<CFURL object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
327+
Output("""sprintf(buf, "<CFURL object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
328328
Output("return PyString_FromString(buf);")
329329
OutRbrace()
330330

Mac/Modules/cm/_Cmmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66

77

8+
#ifdef _WIN32
9+
#include "pywintoolbox.h"
10+
#else
811
#include "macglue.h"
912
#include "pymactoolbox.h"
13+
#endif
1014

1115
/* Macro to test whether a weak-loaded CFM function exists */
1216
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

Mac/Modules/ctl/_Ctlmodule.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66

77

8+
#ifdef _WIN32
9+
#include "pywintoolbox.h"
10+
#else
811
#include "macglue.h"
912
#include "pymactoolbox.h"
13+
#endif
1014

1115
/* Macro to test whether a weak-loaded CFM function exists */
1216
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@@ -1676,7 +1680,8 @@ static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_a
16761680
if (_err != noErr) {
16771681
return PyMac_Error(_err);
16781682
}
1679-
return Py_BuildValue("O&", OptResObj_New, hdl);
1683+
_res = Py_BuildValue("O&", OptResObj_New, hdl);
1684+
return _res;
16801685

16811686
}
16821687

@@ -2526,6 +2531,7 @@ settrackfunc(PyObject *obj)
25262531
}
25272532
tracker = obj;
25282533
Py_INCREF(tracker);
2534+
return 1;
25292535
}
25302536

25312537
static void
@@ -2575,7 +2581,7 @@ setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr
25752581
if ( (self->ob_callbackdict = PyDict_New()) == NULL )
25762582
return -1;
25772583
/* And store the Python callback */
2578-
sprintf(keybuf, "%x", which);
2584+
sprintf(keybuf, "%x", (unsigned)which);
25792585
if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
25802586
return -1;
25812587
return 0;
@@ -2587,7 +2593,7 @@ callcallback(ControlObject *self, OSType which, PyObject *arglist)
25872593
char keybuf[9];
25882594
PyObject *func, *rv;
25892595

2590-
sprintf(keybuf, "%x", which);
2596+
sprintf(keybuf, "%x", (unsigned)which);
25912597
if ( self->ob_callbackdict == NULL ||
25922598
(func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
25932599
PySys_WriteStderr("Control callback %x without callback object\n", which);

0 commit comments

Comments
 (0)