Skip to content

Commit

Permalink
The method urlenc_decode was removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Polyakiv-Andrey authored and AaronAtDuo committed Sep 16, 2024
1 parent 14bf169 commit bbec1e2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
35 changes: 0 additions & 35 deletions lib/urlenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,3 @@ urlenc_encode(const char *string)
ns[strindex] = 0;
return (ns);
}

char *
urlenc_decode(const char *string, size_t *olen)
{
size_t alloc, strindex=0;
char *ns = NULL;
unsigned char in;
long hex;

if (!string) return NULL;
alloc = strlen(string) + 1;
if ((ns = malloc(alloc)) == NULL)
return (NULL);

while(--alloc > 0) {
in = *string;
if (('%' == in) && isxdigit(string[1]) && isxdigit(string[2])) {
char hexstr[3]; /* '%XX' */
hexstr[0] = string[1];
hexstr[1] = string[2];
hexstr[2] = 0;
hex = strtol(hexstr, NULL, 16);
in = (unsigned char)hex; /* hex is always < 256 */
string += 2;
alloc -= 2;
} else if ('+' == in) {
in = ' ';
}
ns[strindex++] = in;
string++;
}
ns[strindex] = 0;
if (olen) *olen = strindex;
return (ns);
}
1 change: 0 additions & 1 deletion lib/urlenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
#define URLENC_H

char *urlenc_encode(const char *string);
char *urlenc_decode(const char *string, size_t *olen);

#endif /* URLENC_H */

0 comments on commit bbec1e2

Please sign in to comment.