|
@@ -9,7 +9,7 @@
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
/* Converts a hex character to its integer value */
|
|
/* Converts a hex character to its integer value */
|
|
-char from_hex(char ch) {
|
|
|
|
|
|
+char from_hex(unsigned char ch) {
|
|
return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
|
|
return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22,7 +22,7 @@ char to_hex(char code) {
|
|
/* Returns a url-encoded version of str */
|
|
/* Returns a url-encoded version of str */
|
|
/* IMPORTANT: be sure that outbuf is big enougth */
|
|
/* IMPORTANT: be sure that outbuf is big enougth */
|
|
char *url_encode(char *outbuf, uint32_t outlen, char *inbuf) {
|
|
char *url_encode(char *outbuf, uint32_t outlen, char *inbuf) {
|
|
- char *pstr = inbuf, *buf = outbuf, *pbuf = buf;
|
|
|
|
|
|
+ unsigned char *pstr = inbuf, *buf = outbuf, *pbuf = buf;
|
|
while ((*pstr) && outlen > 3) {
|
|
while ((*pstr) && outlen > 3) {
|
|
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
|
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
|
*pbuf++ = *pstr;
|
|
*pbuf++ = *pstr;
|