Permalink
Browse files

src: make PercentDecode return void

It only returns 0, nor is it likely to have any error conditions in the
future.

PR-URL: #11922
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
TimothyGu committed Mar 16, 2017
1 parent c515a98 commit d23123643d98165c67ad51d1fdecf06486b1c6d9
Showing with 6 additions and 8 deletions.
  1. +1 −2 src/node_url.cc
  2. +5 −6 src/node_url.h
View
@@ -368,8 +368,7 @@ namespace url {
}
// First, we have to percent decode
if (PercentDecode(input, length, &decoded) < 0)
goto end;
PercentDecode(input, length, &decoded);
// Then we have to punycode toASCII
if (!ToASCII(&decoded, &decoded))
View
@@ -376,11 +376,11 @@ static inline unsigned hex2bin(const char ch) {
return static_cast<unsigned>(-1);
}
static inline int PercentDecode(const char* input,
size_t len,
std::string* dest) {
static inline void PercentDecode(const char* input,
size_t len,
std::string* dest) {
if (len == 0)
return 0;
return;
dest->reserve(len);
const char* pointer = input;
const char* end = input + len;
@@ -399,11 +399,10 @@ static inline int PercentDecode(const char* input,
unsigned a = hex2bin(pointer[1]);
unsigned b = hex2bin(pointer[2]);
char c = static_cast<char>(a * 16 + b);
*dest += static_cast<char>(c);
*dest += c;
pointer += 3;
}
}
return 0;
}
#define SPECIALS(XX) \

0 comments on commit d231236

Please sign in to comment.