Explorar el Código

[urlcode.c] fix error

balbekova hace 5 años
padre
commit
d415f727e7
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      modules/common/urlcode.c

+ 2 - 2
modules/common/urlcode.c

@@ -9,7 +9,7 @@
 #include <stdint.h>
 
 /* 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;
 }
 
@@ -22,7 +22,7 @@ char to_hex(char code) {
 /* Returns a url-encoded version of str */
 /* IMPORTANT: be sure that outbuf is big enougth */
 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) {
     if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
       *pbuf++ = *pstr;