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

This commit is contained in:
christos
2011-08-16 16:45:20 +00:00
parent d9b5972014
commit c0180dc6d9
2 changed files with 11 additions and 10 deletions

View File

@@ -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 @@ version.c: VERSION
.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

View File

@@ -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 @@ mopFileGetLX(buf, idx, cnt)
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 @@ mopFileGetBX(buf, idx, cnt)
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);