# HG changeset patch # User zas_ # Date 1209684026 0 # Node ID d4fe3a94792902d2f74e6b3cdcc1f230d6c9a712 # Parent 58b7c38d5a5bcd46f8a7b4116b5b2ce0133ea5d1 Use sizeof() instead of hardcoded buffer sizes. diff -r 58b7c38d5a5b -r d4fe3a947929 src/cache.c --- 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;