Module Name:    src
Committed By:   christos
Date:           Tue Aug 16 16:45:20 UTC 2011

Modified Files:
        src/usr.sbin/mopd/common: Makefile file.c

Log Message:
gcc-4.5 is picky about potential negative indexes. appease it.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/mopd/common/Makefile
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/mopd/common/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/mopd/common/Makefile
diff -u src/usr.sbin/mopd/common/Makefile:1.16 src/usr.sbin/mopd/common/Makefile:1.17
--- src/usr.sbin/mopd/common/Makefile:1.16	Tue Jun 21 22:49:45 2011
+++ src/usr.sbin/mopd/common/Makefile	Tue Aug 16 12:45:20 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2011/06/22 02:49:45 mrg Exp $
+#	$NetBSD: Makefile,v 1.17 2011/08/16 16:45:20 christos Exp $
 
 LIBISPRIVATE=	yes
 
@@ -23,8 +23,3 @@
 .if defined(HAVE_GCC) || defined(HAVE_PCC)
 COPTS.print.c+=	-Wno-pointer-sign
 .endif
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.file.c+=	-Wno-error
-.endif

Index: src/usr.sbin/mopd/common/file.c
diff -u src/usr.sbin/mopd/common/file.c:1.12 src/usr.sbin/mopd/common/file.c:1.13
--- src/usr.sbin/mopd/common/file.c:1.12	Mon Oct 19 20:51:13 2009
+++ src/usr.sbin/mopd/common/file.c	Tue Aug 16 12:45:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.12 2009/10/20 00:51:13 snj Exp $	*/
+/*	$NetBSD: file.c,v 1.13 2011/08/16 16:45:20 christos Exp $	*/
 
 /*
  * Copyright (c) 1995-96 Mats O Jansson.  All rights reserved.
@@ -26,7 +26,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: file.c,v 1.12 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: file.c,v 1.13 2011/08/16 16:45:20 christos Exp $");
 #endif
 
 #include "os.h"
@@ -115,7 +115,10 @@
 	int i;
 
 	for (i = 0; i < cnt; i++) {
-		ret = ret*256 + buf[idx+cnt-1-i];
+		int j = idx + cnt - 1 - i;
+		if (j < 0)
+			abort();
+		ret = ret * 256 + buf[j];
 	}
 
 	return(ret);
@@ -130,7 +133,10 @@
 	int i;
 
 	for (i = 0; i < cnt; i++) {
-		ret = ret*256 + buf[idx+i];
+		int j = idx + i;
+		if (j < 0)
+			abort();
+		ret = ret * 256 + buf[j];
 	}
 
 	return(ret);

Reply via email to