changeset 540:d4fe3a947929

Use sizeof() instead of hardcoded buffer sizes.
author zas_
date Thu, 01 May 2008 23:20:26 +0000
parents 58b7c38d5a5b
children 116346636d42
files src/cache.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache.c	Thu May 01 22:59:54 2008 +0000
+++ b/src/cache.c	Thu May 01 23:20:26 2008 +0000
@@ -230,7 +230,7 @@
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			}
-		while (b != ']' && p < 1023)
+		while (b != ']' && p < sizeof(buf) - 1)
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			buf[p] = b;
@@ -272,7 +272,7 @@
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			}
-		while (b != ']' && p < 1023)
+		while (b != ']' && p < sizeof(buf) - 1)
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			buf[p] = b;
@@ -312,7 +312,7 @@
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			}
-		while (b != ']' && p < 1023)
+		while (b != ']' && p < sizeof(buf) - 1)
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			buf[p] = b;
@@ -352,7 +352,7 @@
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			}
-		while (b != ']' && p < 63)
+		while (b != ']' && p < sizeof(buf) - 1)
 			{
 			if (fread(&b, sizeof(b), 1, f) != 1) return FALSE;
 			buf[p] = b;