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

Skip to content

Commit 0b13e7c

Browse files
committed
Changed all (hopefully) uses of unsigned 16 bit value to use H format specifier, now that h is signed-only.
1 parent 89d017d commit 0b13e7c

23 files changed

Lines changed: 86 additions & 86 deletions

Mac/Modules/app/Appmodule.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static PyObject *App_DrawThemeMenuBarBackground(_self, _args)
459459
Rect inBounds;
460460
ThemeMenuBarState inState;
461461
UInt32 inAttributes;
462-
if (!PyArg_ParseTuple(_args, "O&hl",
462+
if (!PyArg_ParseTuple(_args, "O&Hl",
463463
PyMac_GetRect, &inBounds,
464464
&inState,
465465
&inAttributes))
@@ -497,7 +497,7 @@ static PyObject *App_DrawThemeMenuBackground(_self, _args)
497497
OSStatus _err;
498498
Rect inMenuRect;
499499
ThemeMenuType inMenuType;
500-
if (!PyArg_ParseTuple(_args, "O&h",
500+
if (!PyArg_ParseTuple(_args, "O&H",
501501
PyMac_GetRect, &inMenuRect,
502502
&inMenuType))
503503
return NULL;
@@ -517,7 +517,7 @@ static PyObject *App_GetThemeMenuBackgroundRegion(_self, _args)
517517
OSStatus _err;
518518
Rect inMenuRect;
519519
ThemeMenuType menuType;
520-
if (!PyArg_ParseTuple(_args, "O&h",
520+
if (!PyArg_ParseTuple(_args, "O&H",
521521
PyMac_GetRect, &inMenuRect,
522522
&menuType))
523523
return NULL;
@@ -572,7 +572,7 @@ static PyObject *App_GetThemeMenuItemExtra(_self, _args)
572572
ThemeMenuItemType inItemType;
573573
SInt16 outHeight;
574574
SInt16 outWidth;
575-
if (!PyArg_ParseTuple(_args, "h",
575+
if (!PyArg_ParseTuple(_args, "H",
576576
&inItemType))
577577
return NULL;
578578
_err = GetThemeMenuItemExtra(inItemType,
@@ -633,7 +633,7 @@ static PyObject *App_GetThemeTabRegion(_self, _args)
633633
Rect inRect;
634634
ThemeTabStyle inStyle;
635635
ThemeTabDirection inDirection;
636-
if (!PyArg_ParseTuple(_args, "O&hh",
636+
if (!PyArg_ParseTuple(_args, "O&HH",
637637
PyMac_GetRect, &inRect,
638638
&inStyle,
639639
&inDirection))
@@ -696,7 +696,7 @@ static PyObject *App_GetThemeScrollBarThumbStyle(_self, _args)
696696
return NULL;
697697
_err = GetThemeScrollBarThumbStyle(&outStyle);
698698
if (_err != noErr) return PyMac_Error(_err);
699-
_res = Py_BuildValue("h",
699+
_res = Py_BuildValue("H",
700700
outStyle);
701701
return _res;
702702
}
@@ -712,7 +712,7 @@ static PyObject *App_GetThemeScrollBarArrowStyle(_self, _args)
712712
return NULL;
713713
_err = GetThemeScrollBarArrowStyle(&outStyle);
714714
if (_err != noErr) return PyMac_Error(_err);
715-
_res = Py_BuildValue("h",
715+
_res = Py_BuildValue("H",
716716
outStyle);
717717
return _res;
718718
}
@@ -728,7 +728,7 @@ static PyObject *App_GetThemeCheckBoxStyle(_self, _args)
728728
return NULL;
729729
_err = GetThemeCheckBoxStyle(&outStyle);
730730
if (_err != noErr) return PyMac_Error(_err);
731-
_res = Py_BuildValue("h",
731+
_res = Py_BuildValue("H",
732732
outStyle);
733733
return _res;
734734
}
@@ -741,7 +741,7 @@ static PyObject *App_UseThemeFont(_self, _args)
741741
OSStatus _err;
742742
ThemeFontID inFontID;
743743
ScriptCode inScript;
744-
if (!PyArg_ParseTuple(_args, "hh",
744+
if (!PyArg_ParseTuple(_args, "Hh",
745745
&inFontID,
746746
&inScript))
747747
return NULL;
@@ -853,7 +853,7 @@ static PyObject *App_DrawThemeScrollBarDelimiters(_self, _args)
853853
Rect inContRect;
854854
ThemeDrawState state;
855855
ThemeWindowAttributes attributes;
856-
if (!PyArg_ParseTuple(_args, "hO&ll",
856+
if (!PyArg_ParseTuple(_args, "HO&ll",
857857
&flavor,
858858
PyMac_GetRect, &inContRect,
859859
&state,
@@ -948,7 +948,7 @@ static PyObject *App_DrawThemeStandaloneGrowBox(_self, _args)
948948
ThemeGrowDirection growDirection;
949949
Boolean isSmall;
950950
ThemeDrawState state;
951-
if (!PyArg_ParseTuple(_args, "O&hbl",
951+
if (!PyArg_ParseTuple(_args, "O&Hbl",
952952
PyMac_GetPoint, &origin,
953953
&growDirection,
954954
&isSmall,
@@ -974,7 +974,7 @@ static PyObject *App_DrawThemeStandaloneNoGrowBox(_self, _args)
974974
ThemeGrowDirection growDirection;
975975
Boolean isSmall;
976976
ThemeDrawState state;
977-
if (!PyArg_ParseTuple(_args, "O&hbl",
977+
if (!PyArg_ParseTuple(_args, "O&Hbl",
978978
PyMac_GetPoint, &origin,
979979
&growDirection,
980980
&isSmall,
@@ -1000,7 +1000,7 @@ static PyObject *App_GetThemeStandaloneGrowBoxBounds(_self, _args)
10001000
ThemeGrowDirection growDirection;
10011001
Boolean isSmall;
10021002
Rect bounds;
1003-
if (!PyArg_ParseTuple(_args, "O&hb",
1003+
if (!PyArg_ParseTuple(_args, "O&Hb",
10041004
PyMac_GetPoint, &origin,
10051005
&growDirection,
10061006
&isSmall))

Mac/Modules/app/appsupport.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,30 @@
3838
ThemeBrush = Type("ThemeBrush", "h")
3939
ThemeColor = Type("ThemeColor", "h")
4040
ThemeTextColor = Type("ThemeTextColor", "h")
41-
ThemeMenuBarState = Type("ThemeMenuBarState", "h")
42-
ThemeMenuState = Type("ThemeMenuState", "h")
43-
ThemeMenuType = Type("ThemeMenuType", "h")
44-
ThemeMenuItemType = Type("ThemeMenuItemType", "h")
45-
ThemeFontID = Type("ThemeFontID", "h")
46-
ThemeTabStyle = Type("ThemeTabStyle", "h")
47-
ThemeTabDirection = Type("ThemeTabDirection", "h")
41+
ThemeMenuBarState = Type("ThemeMenuBarState", "H")
42+
ThemeMenuState = Type("ThemeMenuState", "H")
43+
ThemeMenuType = Type("ThemeMenuType", "H")
44+
ThemeMenuItemType = Type("ThemeMenuItemType", "H")
45+
ThemeFontID = Type("ThemeFontID", "H")
46+
ThemeTabStyle = Type("ThemeTabStyle", "H")
47+
ThemeTabDirection = Type("ThemeTabDirection", "H")
4848
ThemeDrawState = Type("ThemeDrawState", "l")
4949
ThemeCursor = Type("ThemeCursor", "l")
50-
ThemeCheckBoxStyle = Type("ThemeCheckBoxStyle", "h")
51-
ThemeScrollBarArrowStyle = Type("ThemeScrollBarArrowStyle", "h")
52-
ThemeScrollBarThumbStyle = Type("ThemeScrollBarThumbStyle", "h")
50+
ThemeCheckBoxStyle = Type("ThemeCheckBoxStyle", "H")
51+
ThemeScrollBarArrowStyle = Type("ThemeScrollBarArrowStyle", "H")
52+
ThemeScrollBarThumbStyle = Type("ThemeScrollBarThumbStyle", "H")
5353
CTabHandle = OpaqueByValueType("CTabHandle", "ResObj")
5454
ThemeTrackEnableState = Type("ThemeTrackEnableState", "b")
5555
ThemeTrackPressState = Type("ThemeTrackPressState", "b")
5656
ThemeThumbDirection = Type("ThemeThumbDirection", "b")
57-
ThemeTrackAttributes = Type("ThemeTrackAttributes", "h")
57+
ThemeTrackAttributes = Type("ThemeTrackAttributes", "H")
5858
ControlPartCode = Type("ControlPartCode", "h")
5959
ThemeWindowAttributes = Type("ThemeWindowAttributes", "l")
60-
ThemeWindowType = Type("ThemeWindowType", "h")
61-
ThemeTitleBarWidget = Type("ThemeTitleBarWidget", "h")
62-
ThemeArrowOrientation = Type("ThemeArrowOrientation", "h")
63-
ThemePopupArrowSize = Type("ThemePopupArrowSize", "h")
64-
ThemeGrowDirection = Type("ThemeGrowDirection", "h")
60+
ThemeWindowType = Type("ThemeWindowType", "H")
61+
ThemeTitleBarWidget = Type("ThemeTitleBarWidget", "H")
62+
ThemeArrowOrientation = Type("ThemeArrowOrientation", "H")
63+
ThemePopupArrowSize = Type("ThemePopupArrowSize", "H")
64+
ThemeGrowDirection = Type("ThemeGrowDirection", "H")
6565
ThemeSoundKind = OSTypeType("ThemeSoundKind")
6666
ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
6767
ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")

Mac/Modules/ctl/Ctlmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static PyObject *CtlObj_DragControl(_self, _args)
377377
Rect limitRect;
378378
Rect slopRect;
379379
DragConstraint axis;
380-
if (!PyArg_ParseTuple(_args, "O&O&O&h",
380+
if (!PyArg_ParseTuple(_args, "O&O&O&H",
381381
PyMac_GetPoint, &startPoint,
382382
PyMac_GetRect, &limitRect,
383383
PyMac_GetRect, &slopRect,
@@ -1080,7 +1080,7 @@ static PyObject *CtlObj_CountSubControls(_self, _args)
10801080
_err = CountSubControls(_self->ob_itself,
10811081
&outNumChildren);
10821082
if (_err != noErr) return PyMac_Error(_err);
1083-
_res = Py_BuildValue("h",
1083+
_res = Py_BuildValue("H",
10841084
outNumChildren);
10851085
return _res;
10861086
}
@@ -1093,7 +1093,7 @@ static PyObject *CtlObj_GetIndexedSubControl(_self, _args)
10931093
OSErr _err;
10941094
UInt16 inIndex;
10951095
ControlHandle outSubControl;
1096-
if (!PyArg_ParseTuple(_args, "h",
1096+
if (!PyArg_ParseTuple(_args, "H",
10971097
&inIndex))
10981098
return NULL;
10991099
_err = GetIndexedSubControl(_self->ob_itself,

Mac/Modules/ctl/ctlsupport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
3030
AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
3131
ControlPartCode = Type("ControlPartCode", "h")
32-
DragConstraint = Type("DragConstraint", "h")
32+
DragConstraint = Type("DragConstraint", "H")
3333
ControlVariant = Type("ControlVariant", "h")
3434
IconTransformType = Type("IconTransformType", "h")
3535
ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")

Mac/Modules/dlg/Dlgmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ static PyObject *DlgObj_SetModalDialogEventMask(_self, _args)
659659
PyObject *_res = NULL;
660660
OSStatus _err;
661661
EventMask inMask;
662-
if (!PyArg_ParseTuple(_args, "h",
662+
if (!PyArg_ParseTuple(_args, "H",
663663
&inMask))
664664
return NULL;
665665
_err = SetModalDialogEventMask(_self->ob_itself,
@@ -682,7 +682,7 @@ static PyObject *DlgObj_GetModalDialogEventMask(_self, _args)
682682
_err = GetModalDialogEventMask(_self->ob_itself,
683683
&outMask);
684684
if (_err != noErr) return PyMac_Error(_err);
685-
_res = Py_BuildValue("h",
685+
_res = Py_BuildValue("H",
686686
outMask);
687687
return _res;
688688
}

Mac/Modules/dlg/dlgsupport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h")
2727
AlertType = Type("AlertType", "h")
2828
StringPtr = Str255
29-
EventMask = Type("EventMask", "h")
29+
EventMask = Type("EventMask", "H")
3030

3131
includestuff = includestuff + """
3232
#include <Dialogs.h>

Mac/Modules/drag/Dragmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static PyObject *DragObj_CountDragItems(_self, _args)
248248
_err = CountDragItems(_self->ob_itself,
249249
&numItems);
250250
if (_err != noErr) return PyMac_Error(_err);
251-
_res = Py_BuildValue("h",
251+
_res = Py_BuildValue("H",
252252
numItems);
253253
return _res;
254254
}
@@ -261,7 +261,7 @@ static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args)
261261
OSErr _err;
262262
UInt16 index;
263263
ItemReference theItemRef;
264-
if (!PyArg_ParseTuple(_args, "h",
264+
if (!PyArg_ParseTuple(_args, "H",
265265
&index))
266266
return NULL;
267267
_err = GetDragItemReferenceNumber(_self->ob_itself,
@@ -288,7 +288,7 @@ static PyObject *DragObj_CountDragItemFlavors(_self, _args)
288288
theItemRef,
289289
&numFlavors);
290290
if (_err != noErr) return PyMac_Error(_err);
291-
_res = Py_BuildValue("h",
291+
_res = Py_BuildValue("H",
292292
numFlavors);
293293
return _res;
294294
}
@@ -302,7 +302,7 @@ static PyObject *DragObj_GetFlavorType(_self, _args)
302302
ItemReference theItemRef;
303303
UInt16 index;
304304
FlavorType theType;
305-
if (!PyArg_ParseTuple(_args, "lh",
305+
if (!PyArg_ParseTuple(_args, "lH",
306306
&theItemRef,
307307
&index))
308308
return NULL;

Mac/Modules/evt/Evtmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static PyObject *Evt_SetEventMask(_self, _args)
167167
{
168168
PyObject *_res = NULL;
169169
EventMask value;
170-
if (!PyArg_ParseTuple(_args, "h",
170+
if (!PyArg_ParseTuple(_args, "H",
171171
&value))
172172
return NULL;
173173
SetEventMask(value);
@@ -184,7 +184,7 @@ static PyObject *Evt_GetNextEvent(_self, _args)
184184
Boolean _rv;
185185
EventMask eventMask;
186186
EventRecord theEvent;
187-
if (!PyArg_ParseTuple(_args, "h",
187+
if (!PyArg_ParseTuple(_args, "H",
188188
&eventMask))
189189
return NULL;
190190
_rv = GetNextEvent(eventMask,
@@ -203,7 +203,7 @@ static PyObject *Evt_EventAvail(_self, _args)
203203
Boolean _rv;
204204
EventMask eventMask;
205205
EventRecord theEvent;
206-
if (!PyArg_ParseTuple(_args, "h",
206+
if (!PyArg_ParseTuple(_args, "H",
207207
&eventMask))
208208
return NULL;
209209
_rv = EventAvail(eventMask,
@@ -222,7 +222,7 @@ static PyObject *Evt_PostEvent(_self, _args)
222222
OSErr _err;
223223
EventKind eventNum;
224224
UInt32 eventMsg;
225-
if (!PyArg_ParseTuple(_args, "hl",
225+
if (!PyArg_ParseTuple(_args, "Hl",
226226
&eventNum,
227227
&eventMsg))
228228
return NULL;
@@ -244,7 +244,7 @@ static PyObject *Evt_OSEventAvail(_self, _args)
244244
Boolean _rv;
245245
EventMask mask;
246246
EventRecord theEvent;
247-
if (!PyArg_ParseTuple(_args, "h",
247+
if (!PyArg_ParseTuple(_args, "H",
248248
&mask))
249249
return NULL;
250250
_rv = OSEventAvail(mask,
@@ -266,7 +266,7 @@ static PyObject *Evt_GetOSEvent(_self, _args)
266266
Boolean _rv;
267267
EventMask mask;
268268
EventRecord theEvent;
269-
if (!PyArg_ParseTuple(_args, "h",
269+
if (!PyArg_ParseTuple(_args, "H",
270270
&mask))
271271
return NULL;
272272
_rv = GetOSEvent(mask,
@@ -285,7 +285,7 @@ static PyObject *Evt_FlushEvents(_self, _args)
285285
PyObject *_res = NULL;
286286
EventMask whichMask;
287287
EventMask stopMask;
288-
if (!PyArg_ParseTuple(_args, "hh",
288+
if (!PyArg_ParseTuple(_args, "HH",
289289
&whichMask,
290290
&stopMask))
291291
return NULL;

Mac/Modules/evt/evtsupport.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
# RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
3030

3131
KeyMap = ArrayOutputBufferType("KeyMap")
32-
MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
33-
MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
34-
EventMask = Type("EventMask", "h")
35-
EventKind = Type("EventKind", "h")
32+
##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
33+
##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
34+
EventMask = Type("EventMask", "H")
35+
EventKind = Type("EventKind", "H")
3636

3737
includestuff = includestuff + """
3838
#include <%s>""" % MACHEADERFILE + """

Mac/Modules/help/Helpmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static PyObject *Help_HMSetFontSize(_self, _args)
148148
PyObject *_res = NULL;
149149
OSErr _err;
150150
UInt16 fontSize;
151-
if (!PyArg_ParseTuple(_args, "h",
151+
if (!PyArg_ParseTuple(_args, "H",
152152
&fontSize))
153153
return NULL;
154154
_err = HMSetFontSize(fontSize);
@@ -185,7 +185,7 @@ static PyObject *Help_HMGetFontSize(_self, _args)
185185
return NULL;
186186
_err = HMGetFontSize(&fontSize);
187187
if (_err != noErr) return PyMac_Error(_err);
188-
_res = Py_BuildValue("h",
188+
_res = Py_BuildValue("H",
189189
fontSize);
190190
return _res;
191191
}

0 commit comments

Comments
 (0)