Another effort to fix base64decode and associated unit test.

This commit is contained in:
clanmills 2021-03-08 08:58:24 +00:00
parent 87e536dadf
commit f1303cbcda
2 changed files with 2 additions and 2 deletions

View File

@ -215,7 +215,7 @@ namespace Exiv2 {
if (j < output_length) out[j++] = (triple >> 1 * 8) & 0xFF;
if (j < output_length) out[j++] = (triple >> 0 * 8) & 0xFF;
}
out[output_length++]=0;
out[output_length]=0;
result = output_length;
}

View File

@ -147,7 +147,7 @@ TEST(base64decode, decodesValidString)
const std::string original ("VGhpcyBpcyBhIHVuaXQgdGVzdA==");
const std::string expected ("This is a unit test");
char * result = new char [original.size()];
ASSERT_EQ(static_cast<long>(expected.size()+1),
ASSERT_EQ(static_cast<long>(expected.size()),
base64decode(original.c_str(), result, original.size()));
ASSERT_STREQ(expected.c_str(), result);
delete [] result;