diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-04-18 16:18:30 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-21 15:38:30 +0000 |
commit | 27da23d53ccce622bc51822f59df8def79b4df95 (patch) | |
tree | 1202440e0fbf7a2fc1bb54993d11cda7b245f1b4 /ext/Digest | |
parent | ec0624293b57ae07d6b2c32bae099d4f163e7e07 (diff) | |
download | perl-27da23d53ccce622bc51822f59df8def79b4df95.tar.gz |
Symbian port of Perl
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com>
p4raw-id: //depot/perl@24271
Diffstat (limited to 'ext/Digest')
-rw-r--r-- | ext/Digest/MD5/MD5.xs | 18 | ||||
-rw-r--r-- | ext/Digest/MD5/t/files.t | 6 |
2 files changed, 17 insertions, 7 deletions
diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs index 1abe4c429c..a89bbd7b8e 100644 --- a/ext/Digest/MD5/MD5.xs +++ b/ext/Digest/MD5/MD5.xs @@ -153,7 +153,7 @@ typedef struct { * padding is also the reason the buffer in MD5_CTX have to be * 128 bytes. */ -static unsigned char PADDING[64] = { +static const unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -484,7 +484,7 @@ static MD5_CTX* get_md5_ctx(pTHX_ SV* sv) static char* hex_16(const unsigned char* from, char* to) { - static char *hexdigits = "0123456789abcdef"; + static const char hexdigits[] = "0123456789abcdef"; const unsigned char *end = from + 16; char *d = to; @@ -499,7 +499,7 @@ static char* hex_16(const unsigned char* from, char* to) static char* base64_16(const unsigned char* from, char* to) { - static char* base64 = + static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const unsigned char *end = from + 16; unsigned char c1, c2, c3; @@ -626,10 +626,18 @@ addfile(self, fh) PREINIT: MD5_CTX* context = get_md5_ctx(aTHX_ self); STRLEN fill = context->bytes_low & 0x3F; +#ifdef USE_HEAP_INSTEAD_OF_STACK + unsigned char* buffer; +#else unsigned char buffer[4096]; +#endif int n; CODE: if (fh) { +#ifdef USE_HEAP_INSTEAD_OF_STACK + New(0, buffer, 4096, unsigned char); + assert(buffer); +#endif if (fill) { /* The MD5Update() function is faster if it can work with * complete blocks. This will fill up any buffered block @@ -646,7 +654,9 @@ addfile(self, fh) while ( (n = PerlIO_read(fh, buffer, sizeof(buffer))) > 0) { MD5Update(context, buffer, n); } - +#ifdef USE_HEAP_INSTEAD_OF_STACK + Safefree(buffer); +#endif if (PerlIO_error(fh)) { croak("Reading from filehandle failed"); } diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t index 3f183206dd..615590e704 100644 --- a/ext/Digest/MD5/t/files.t +++ b/ext/Digest/MD5/t/files.t @@ -23,7 +23,7 @@ if (ord "A" == 193) { # EBCDIC 15e4c91ad67f5ff238033305376c9140 Changes 0565ec21b15c0f23f4c51fb327c8926d README f0f77710cd8d5ba7d9faedec8d02dc2f MD5.pm -f9848c0ee3b20a9177465eec19361e6c MD5.xs +f6314d62d3aa97dcf4cba66b4c39b105 MD5.xs 276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt EOT } elsif ("\n" eq "\015") { # MacOS @@ -31,7 +31,7 @@ EOT dea016b088ab4d88a5e7cbd9c15a9c88 Changes 6c950a0211a5a28f023bb482037698cd README f057c88277ecee875cf6f0352468407a MD5.pm -5bae62404829e6fd8ad0d4f8d5ccea54 MD5.xs +a526b0218e43c702a6c994a82620686f MD5.xs 754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt EOT } else { @@ -40,7 +40,7 @@ EOT 0f09886e2c129bdabf57674c6822bd4f Changes 6c950a0211a5a28f023bb482037698cd README f057c88277ecee875cf6f0352468407a MD5.pm -5bae62404829e6fd8ad0d4f8d5ccea54 MD5.xs +a526b0218e43c702a6c994a82620686f MD5.xs 754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt EOT } |