--------------------- PatchSet 6460 Date: 2005/03/03 02:00:35 Author: hno Branch: lfs-2_5 Tag: (none) Log: Clean up LFS support to minimize use of #ifdefs Members: src/HttpHeaderTools.c:1.7.12.3.8.1->1.7.12.3.8.2 src/cache_cf.c:1.38.6.18.2.1->1.38.6.18.2.2 src/defines.h:1.15.6.3->1.15.6.3.26.1 src/ftp.c:1.18.6.18.2.2->1.18.6.18.2.3 Index: squid/src/HttpHeaderTools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeaderTools.c,v retrieving revision 1.7.12.3.8.1 retrieving revision 1.7.12.3.8.2 diff -u -r1.7.12.3.8.1 -r1.7.12.3.8.2 --- squid/src/HttpHeaderTools.c 25 Feb 2005 10:48:45 -0000 1.7.12.3.8.1 +++ squid/src/HttpHeaderTools.c 3 Mar 2005 02:00:35 -0000 1.7.12.3.8.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.7.12.3.8.1 2005/02/25 10:48:45 hno Exp $ + * $Id: HttpHeaderTools.c,v 1.7.12.3.8.2 2005/03/03 02:00:35 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -322,11 +322,7 @@ off_t v; char *end; int res; -#if SIZEOF_OFF_T > SIZEOF_LONG - v = strtoll(start, &end, 10); -#else - v = strtol(start, &end, 10); -#endif + v = strto_off_t(start, &end, 10); res = start != end; assert(value); *value = res ? v : 0; Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.38.6.18.2.1 retrieving revision 1.38.6.18.2.2 diff -u -r1.38.6.18.2.1 -r1.38.6.18.2.2 --- squid/src/cache_cf.c 25 Feb 2005 10:48:46 -0000 1.38.6.18.2.1 +++ squid/src/cache_cf.c 3 Mar 2005 02:00:35 -0000 1.38.6.18.2.2 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.38.6.18.2.1 2005/02/25 10:48:46 hno Exp $ + * $Id: cache_cf.c,v 1.38.6.18.2.2 2005/03/03 02:00:35 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -230,10 +230,8 @@ off_t i; if (token == NULL) self_destruct(); -#if SIZEOF_OFF_T > SIZEOF_LONG - i = strtoll(token, &end, 0); -#else - i = strtol(token, &end, 0); + i = strto_off_t(token, &end, 0); +#if SIZEOF_OFF_T <= SIZEOF_INT { double d = strtod(token, NULL); if (d > INT_MAX) Index: squid/src/defines.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/defines.h,v retrieving revision 1.15.6.3 retrieving revision 1.15.6.3.26.1 diff -u -r1.15.6.3 -r1.15.6.3.26.1 --- squid/src/defines.h 8 Aug 2002 20:18:40 -0000 1.15.6.3 +++ squid/src/defines.h 3 Mar 2005 02:00:37 -0000 1.15.6.3.26.1 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.15.6.3 2002/08/08 20:18:40 squidadm Exp $ + * $Id: defines.h,v 1.15.6.3.26.1 2005/03/03 02:00:37 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -307,4 +307,13 @@ #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR)) #endif +/* + * Macro to simplify off_t parsing + */ +#if SIZEOF_OFF_T > SIZEOF_LONG + #define strto_off_t strtoll +#else + #define strto_off_t strtol +#endif + #endif /* SQUID_DEFINES_H */ Index: squid/src/ftp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ftp.c,v retrieving revision 1.18.6.18.2.2 retrieving revision 1.18.6.18.2.3 diff -u -r1.18.6.18.2.2 -r1.18.6.18.2.3 --- squid/src/ftp.c 3 Mar 2005 00:11:55 -0000 1.18.6.18.2.2 +++ squid/src/ftp.c 3 Mar 2005 02:00:38 -0000 1.18.6.18.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ftp.c,v 1.18.6.18.2.2 2005/03/03 00:11:55 hno Exp $ + * $Id: ftp.c,v 1.18.6.18.2.3 2005/03/03 02:00:38 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -537,7 +537,7 @@ month, day, year); if ((t = strstr(buf, tbuf))) { p->type = *tokens[0]; - p->size = strtoll(size, NULL, 10); + p->size = strto_off_t(size, NULL, 10); p->date = xstrdup(tbuf); if (flags.skip_whitespace) { t += strlen(tbuf); @@ -566,7 +566,7 @@ p->type = 'd'; } else { p->type = '-'; - p->size = strtoll(tokens[2], NULL, 10); + p->size = strto_off_t(tokens[2], NULL, 10); } snprintf(tbuf, 128, "%s %s", tokens[0], tokens[1]); p->date = xstrdup(tbuf); @@ -604,10 +604,10 @@ p->name = xstrndup(ct + 1, l + 1); break; case 's': - p->size = strtoll(ct + 1, NULL, 10); + p->size = strto_off_t(ct + 1, NULL, 10); break; case 'm': - t = (time_t) strtoll(ct + 1, &tmp, 0); + t = (time_t) strto_off_t(ct + 1, &tmp, 0); if (*tmp || (tmp == ct + 1)) break; /* not a valid integer */ p->date = xstrdup(ctime(&t)); @@ -1712,7 +1712,7 @@ debug(9, 3) ("This is ftpReadSize\n"); if (code == 213) { ftpUnhack(ftpState); - ftpState->size = (off_t)strtoll(ftpState->ctrl.last_reply, NULL, 10); + ftpState->size = strto_off_t(ftpState->ctrl.last_reply, NULL, 10); if (ftpState->size == 0) { debug(9, 2) ("ftpReadSize: SIZE reported %s on %s\n", ftpState->ctrl.last_reply,