Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b96354fc authored by Austin Borger's avatar Austin Borger Committed by Gerrit Code Review
Browse files

Merge "cameraserver: Use String8/String16 constructor conversions." into main

parents 502ad30e 3fc6a92b
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
#ifndef ANDROID_SERVERS_CAMERA_STRINGUTILS_H
#define ANDROID_SERVERS_CAMERA_STRINGUTILS_H

#include <codecvt>
#include <locale>
#include <memory>
#include <optional>
#include <string>
@@ -65,8 +63,8 @@ namespace android {
    }

    inline std::string toStdString(const String16 &str) {
        std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
        return convert.to_bytes(str.c_str());
        String8 str8(str);
        return std::string(str8.c_str());
    }

    /**
@@ -74,8 +72,9 @@ namespace android {
     * len is the number of characters.
     */
    inline std::string toStdString(const char16_t *str, size_t len) {
        std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
        return convert.to_bytes(str, str + len);
        String16 str16(str, len);
        String8 str8(str16);
        return std::string(str8.c_str());
    }
} // namespace android