mirror of https://github.com/aria2/aria2
Base32 decode lowercased characters as well
parent
432675e512
commit
d0b6a88f9c
|
@ -64,6 +64,8 @@ std::string decode(InputIterator first, InputIterator last)
|
||||||
unsigned char value;
|
unsigned char value;
|
||||||
if('A' <= ch && ch <= 'Z') {
|
if('A' <= ch && ch <= 'Z') {
|
||||||
value = ch-'A';
|
value = ch-'A';
|
||||||
|
} else if('a' <= ch && ch <= 'z') {
|
||||||
|
value = ch-'a';
|
||||||
} else if('2' <= ch && ch <= '7') {
|
} else if('2' <= ch && ch <= '7') {
|
||||||
value = ch-'2'+26;
|
value = ch-'2'+26;
|
||||||
} else if(ch == '=') {
|
} else if(ch == '=') {
|
||||||
|
|
|
@ -48,6 +48,9 @@ void Base32Test::testDecode()
|
||||||
s = "GEZDGNBV";
|
s = "GEZDGNBV";
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("12345"),
|
CPPUNIT_ASSERT_EQUAL(std::string("12345"),
|
||||||
base32::decode(s.begin(), s.end()));
|
base32::decode(s.begin(), s.end()));
|
||||||
|
s = "gezdgnbv";
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string("12345"),
|
||||||
|
base32::decode(s.begin(), s.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue