break;
}
+ case 'H': /* unsigned short int */
+ {
+ unsigned short *p = va_arg(*p_va, unsigned short *);
+ long ival = PyInt_AsLong(arg);
+ if (ival == -1 && PyErr_Occurred())
+ return "integer<H>";
+ else if (ival < 0) {
+ PyErr_SetString(PyExc_OverflowError,
+ "unsigned short integer is less than minimum");
+ return "integer<H>";
+ }
+ else if (ival > USHRT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "unsigned short integer is greater than maximum");
+ return "integer<H>";
+ }
+ else
+ *p = (unsigned short) ival;
+ break;
+ }
+
case 'i': /* signed int */
{
int *p = va_arg(*p_va, int *);
*p = ival;
break;
}
-
case 'l': /* long int */
{
long *p = va_arg(*p_va, long *);
break;
}
+ case 'H': /* unsigned short int */
+ {
+ (void) va_arg(*p_va, unsigned short *);
+ break;
+ }
+
case 'i': /* int */
{
(void) va_arg(*p_va, int *);
case 'h':
case 'i':
return PyInt_FromLong((long)va_arg(*p_va, int));
+
+ case 'H':
+ return PyInt_FromLong((long)va_arg(*p_va, unsigned int));
case 'l':
return PyInt_FromLong((long)va_arg(*p_va, long));