Merge "Minor refactor to support strings with embedded zeros."
am: db2ffaa0f0
Change-Id: I849a3d8b50d1a170e08b413e2d806d25b178cdf7
diff --git a/adb/adb_io.cpp b/adb/adb_io.cpp
index 6cc274b..e6fefda 100644
--- a/adb/adb_io.cpp
+++ b/adb/adb_io.cpp
@@ -38,7 +38,8 @@
// The cost of sending two strings outweighs the cost of formatting.
// "adb sync" performance is affected by this.
- return WriteFdFmt(fd, "%04x%.*s", length, length, s.c_str());
+ auto str = android::base::StringPrintf("%04x", length).append(s);
+ return WriteFdExactly(fd, str);
}
bool ReadProtocolString(int fd, std::string* s, std::string* error) {