[Python-checkins] python/nondist/sandbox/datetime datetime.c,1.44,1.45 obj_delta.c,1.22,1.23

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年12月06日 18:23:10 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv17644
Modified Files:
	datetime.c obj_delta.c 
Log Message:
Fixed mismatches between integer format codes and integer args, as
Jeremy helpfully passed on via gcc wngs. If you see a wng in this code,
pass it on! "No warnings" is a goal.
Index: datetime.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** datetime.c	6 Dec 2002 17:04:58 -0000	1.44
--- datetime.c	7 Dec 2002 02:23:08 -0000	1.45
***************
*** 116,120 ****
 	 * on boxes where sizeof(long) > sizeof(int). So roll our own.
 	 */
! 	PyOS_snprintf(buf, sizeof(buf), "days=%ld; must have magnitude <= %ld",
 		 days, MAX_DELTA_DAYS);
 	PyErr_SetString(exception, buf);
--- 116,120 ----
 	 * on boxes where sizeof(long) > sizeof(int). So roll our own.
 	 */
! 	PyOS_snprintf(buf, sizeof(buf), "days=%ld; must have magnitude <= %d",
 		 days, MAX_DELTA_DAYS);
 	PyErr_SetString(exception, buf);
Index: obj_delta.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** obj_delta.c	5 Dec 2002 04:49:42 -0000	1.22
--- obj_delta.c	7 Dec 2002 02:23:08 -0000	1.23
***************
*** 554,567 ****
 
 	if (days) {
! 		i += sprintf(buf + i, "%d day%s, ", days,
 			 (days == 1 || days == -1) ? "" : "s");
 		assert(i < sizeof(buf));
 	}
 
! 	i += sprintf(buf + i, "%d:%02d:%02d", hours, minutes, seconds);
 	assert(i < sizeof(buf));
 
 	if (us) {
! 		i += sprintf(buf + i, ".%06d", us);
 		assert(i < sizeof(buf));
 	}
--- 554,568 ----
 
 	if (days) {
! 		i += sprintf(buf + i, "%d day%s, ", (int)days,
 			 (days == 1 || days == -1) ? "" : "s");
 		assert(i < sizeof(buf));
 	}
 
! 	i += sprintf(buf + i, "%d:%02d:%02d", (int)hours, (int)minutes,
! 					 (int)seconds);
 	assert(i < sizeof(buf));
 
 	if (us) {
! 		i += sprintf(buf + i, ".%06d", (int)us);
 		assert(i < sizeof(buf));
 	}

AltStyle によって変換されたページ (->オリジナル) /