On Fri, Sep 15, 2000 at 08:30:28AM -0700, Trent Mick wrote: > On Fri, Sep 15, 2000 at 12:32:01AM -0700, Martin v. Löwis wrote: > > Modified Files: > > structmodule.c > > Log Message: > > Check range for bytes and shorts. Closes bug #110845. > > > > > > + if (x < -32768 || x > 32767){ > > + PyErr_SetString(StructError, > > + "short format requires -32768<=number<=32767"); > > + return -1; > > + } > > Would it not be cleaner to use SHRT_MIN and SHRT_MAX (from limits.h I think) > here? > > > + if (x < 0 || x > 65535){ > > + PyErr_SetString(StructError, > > + "short format requires 0<=number<=65535"); > > + return -1; > > + } > > + * (unsigned short *)p = (unsigned short)x; > > And USHRT_MIN and USHRT_MAX here? > Heh, heh. I jump a bit quickly on that one. Three checkin messages later this suggestion was applied. :) SOrry about that, Martin. Trent -- Trent Mick TrentM@ActiveState.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4