mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Treat input to base64_encode as unsigned chars.
This commit is contained in:
parent
05aed0cca2
commit
d025e62556
@ -1,3 +1,8 @@
|
|||||||
|
2005-04-23 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* utils.c (base64_encode): Treat input as unsigned chars.
|
||||||
|
Required for correct encoding of binary stuff.
|
||||||
|
|
||||||
2005-04-23 Hrvoje Niksic <hniksic@xemacs.org>
|
2005-04-23 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* http-ntlm.c: Format the function definitions in an
|
* http-ntlm.c: Format the function definitions in an
|
||||||
|
@ -1825,7 +1825,7 @@ xsleep (double seconds)
|
|||||||
|
|
||||||
#endif /* not WINDOWS */
|
#endif /* not WINDOWS */
|
||||||
|
|
||||||
/* Encode the string S of length LENGTH to base64 format and place it
|
/* Encode the string STR of length LENGTH to base64 format and place it
|
||||||
to B64STORE. The output will be \0-terminated, and must point to a
|
to B64STORE. The output will be \0-terminated, and must point to a
|
||||||
writable buffer of at least 1+BASE64_LENGTH(length) bytes. It
|
writable buffer of at least 1+BASE64_LENGTH(length) bytes. It
|
||||||
returns the length of the resulting base64 data, not counting the
|
returns the length of the resulting base64 data, not counting the
|
||||||
@ -1835,7 +1835,7 @@ xsleep (double seconds)
|
|||||||
base64 data. */
|
base64 data. */
|
||||||
|
|
||||||
int
|
int
|
||||||
base64_encode (const char *s, int length, char *b64store)
|
base64_encode (const char *str, int length, char *b64store)
|
||||||
{
|
{
|
||||||
/* Conversion table. */
|
/* Conversion table. */
|
||||||
static char tbl[64] = {
|
static char tbl[64] = {
|
||||||
@ -1849,7 +1849,8 @@ base64_encode (const char *s, int length, char *b64store)
|
|||||||
'4','5','6','7','8','9','+','/'
|
'4','5','6','7','8','9','+','/'
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
unsigned char *p = (unsigned char *) b64store;
|
const unsigned char *s = (const unsigned char *) str;
|
||||||
|
char *p = b64store;
|
||||||
|
|
||||||
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
|
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
|
||||||
for (i = 0; i < length; i += 3)
|
for (i = 0; i < length; i += 3)
|
||||||
@ -1870,7 +1871,7 @@ base64_encode (const char *s, int length, char *b64store)
|
|||||||
/* ...and zero-terminate it. */
|
/* ...and zero-terminate it. */
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
return p - (unsigned char *) b64store;
|
return p - b64store;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IS_ASCII(c) (((c) & 0x80) == 0)
|
#define IS_ASCII(c) (((c) & 0x80) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user