Skip Menu |

This queue is for tickets about the Digest-SHA1 CPAN distribution.

Report information
The Basics
Id: 31915
Status: resolved
Priority: 0/
Queue: Digest-SHA1

People
Owner: Nobody in particular
Requestors: SMPETERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Quiet warnings when compiled with -Wwrite-strings
The compile generates a few warnings when the gcc option -Wwrite-strings is added. The following patch quiets these warnings. --- SHA1.xs.old 2007-12-26 15:53:11.000000000 -0600 +++ SHA1.xs 2007-12-26 15:54:45.000000000 -0600 @@ -383,7 +383,7 @@ static char* hex_20(const unsigned char* from, char* to) { - static char *hexdigits = "0123456789abcdef"; + static const char *hexdigits = "0123456789abcdef"; const unsigned char *end = from + 20; char *d = to; @@ -398,7 +398,7 @@ static char* base64_20(const unsigned char* from, char* to) { - static char* base64 = + static const char* base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const unsigned char *end = from + 20; unsigned char c1, c2, c3; @@ -485,7 +485,7 @@ SV* self PREINIT: SHA_INFO* cont = get_sha_info(aTHX_ self); - char *myname = sv_reftype(SvRV(self),TRUE); + const char *myname = sv_reftype(SvRV(self),TRUE); SHA_INFO* context; PPCODE: New(55, context, 1, SHA_INFO); @@ -571,7 +571,7 @@ sha_init(&ctx); if (DOWARN) { - char *msg = 0; + const char *msg = 0; if (items == 1) { if (SvROK(ST(0))) { SV* sv = SvRV(ST(0)); @@ -588,7 +588,7 @@ } } if (msg) { - char *f = (ix == F_BIN) ? "sha1" : + const char *f = (ix == F_BIN) ? "sha1" : (ix == F_HEX) ? "sha1_hex" : "sha1_base64"; warn("&Digest::SHA1::%s function %s", f, msg); }
Thanks. Applied.