A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-September/009390.html below:

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.38,2.39

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.38,2.39Trent Mick trentm@ActiveState.com
Fri, 15 Sep 2000 08:30:28 -0700
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?


No biggie though.

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