adb: switch unix_open to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Ieecc9b1b7f2111f4da45d4bbd1b7703535fe7d4d
diff --git a/sysdeps_win32.cpp b/sysdeps_win32.cpp
index 8a6541d..dbc8920 100644
--- a/sysdeps_win32.cpp
+++ b/sysdeps_win32.cpp
@@ -29,6 +29,7 @@
#include <memory>
#include <mutex>
#include <string>
+#include <string_view>
#include <unordered_map>
#include <vector>
@@ -2203,15 +2204,15 @@
}
}
-int unix_open(const char* path, int options, ...) {
+int unix_open(std::string_view path, int options, ...) {
std::wstring path_wide;
- if (!android::base::UTF8ToWide(path, &path_wide)) {
+ if (!android::base::UTF8ToWide(path.data(), path.size(), &path_wide)) {
return -1;
}
if ((options & O_CREAT) == 0) {
return _wopen(path_wide.c_str(), options);
} else {
- int mode;
+ int mode;
va_list args;
va_start(args, options);
mode = va_arg(args, int);