You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by di...@apache.org on 2001/10/08 19:51:57 UTC
cvs commit: apache-1.3/src/support htpasswd.c
dirkx 01/10/08 10:51:57
Modified: src/support htpasswd.c
Log:
One of 2 fixes to quell a compiler warning. According to fanf@apache.org
> Before C99 the correct way to print a size_t is to use %lu, since
> long was guaranteed to be the widest integral type, so redoing the
> fix on that basis would be better. However with C99 size_t can be
> as wide as unsigned long long so you need to use that format to
> be safe, but then you compromise portability.
So options; simply cast to (int) as I know the value is small; use %lu
without a cast - but get warnings later on >C99. Or kind of the compromize
below; do %lu but cast to be sure.
Feel free to patch in a better fix !
Dw
Revision Changes Path
1.44 +6 -6 apache-1.3/src/support/htpasswd.c
Index: htpasswd.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/support/htpasswd.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- htpasswd.c 2001/07/25 15:08:04 1.43
+++ htpasswd.c 2001/10/08 17:51:57 1.44
@@ -193,8 +193,8 @@
return usage();
#else
if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) {
- ap_snprintf(record, (rlen - 1), "password too long (>%d)",
- sizeof(pwin) - 1);
+ ap_snprintf(record, (rlen - 1), "password too long (>%lu)",
+ (unsigned long) (sizeof(pwin) - 1));
return ERR_OVERFLOW;
}
ap_getpass("Re-type new password: ", pwv, sizeof(pwv));
@@ -456,8 +456,8 @@
}
strcpy(pwfilename, argv[i]);
if (strlen(argv[i + 1]) > (sizeof(user) - 1)) {
- fprintf(stderr, "%s: username too long (>%d)\n", argv[0],
- sizeof(user) - 1);
+ fprintf(stderr, "%s: username too long (>%lu)\n", argv[0],
+ (unsigned long)(sizeof(user) - 1));
return ERR_OVERFLOW;
}
}
@@ -469,8 +469,8 @@
}
if (noninteractive) {
if (strlen(argv[i + 2]) > (sizeof(password) - 1)) {
- fprintf(stderr, "%s: password too long (>%d)\n", argv[0],
- sizeof(password) - 1);
+ fprintf(stderr, "%s: password too long (>%lu)\n", argv[0],
+ (unsigned long)(sizeof(password) - 1));
return ERR_OVERFLOW;
}
strcpy(password, argv[i + 2]);