Fix build and tests

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I3671e40fd0f8f028e3c8e46c4a47de0d2cc9aeff
This commit is contained in:
Alexey Polyudov
2020-04-04 12:55:06 -07:00
parent a067c89eca
commit 18c09c5abe
15 changed files with 46 additions and 29 deletions
+8 -7
View File
@@ -1,6 +1,5 @@
#include "platform/base64_utils.h"
#include "strings/escaping.h"
#include "absl/strings/escaping.h"
namespace location {
@@ -10,8 +9,7 @@ std::string Base64Utils::encode(ConstPtr<ByteArray> bytes) {
std::string base64_string;
if (!bytes.isNull()) {
absl::WebSafeBase64Escape(std::string(bytes->getData(), bytes->size()),
&base64_string);
absl::WebSafeBase64Escape(bytes->asString(), &base64_string);
}
return base64_string;
@@ -19,8 +17,7 @@ std::string Base64Utils::encode(ConstPtr<ByteArray> bytes) {
std::string Base64Utils::encode(const ByteArray& bytes) {
std::string base64_string;
absl::WebSafeBase64Escape(std::string(bytes.getData(), bytes.size()),
&base64_string);
absl::WebSafeBase64Escape(bytes.asString(), &base64_string);
return base64_string;
}
@@ -39,7 +36,7 @@ Ptr<ByteArray> Base64Utils::decode(const std::string& base64_string) {
return Ptr<ByteArray>();
}
return MakePtr(new ByteArray(decoded_string.data(), decoded_string.size()));
return MakePtr(new ByteArray(decoded_string));
}
template<>
@@ -49,7 +46,11 @@ ByteArray Base64Utils::decode(const std::string& base64_string) {
return ByteArray();
}
return ByteArray(decoded_string.data(), decoded_string.size());
return ByteArray(decoded_string);
}
Ptr<ByteArray> Base64Utils::decode(const std::string& base64_string) {
return decode<Ptr<ByteArray>>(base64_string);
}
} // namespace nearby