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

Commit 7a57b8a3 authored by Steven Moreland's avatar Steven Moreland
Browse files

String16: operator<<

Before, this was printing the pointer to the char16_t* because of an
automatic conversion. However, this is almost never intended.

Bug: N/A
Test: dumpsys_test
Change-Id: Iaafcb2145cf93028cf3271813c56b8b74948f943
parent 579e4b3d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
#ifndef ANDROID_STRING16_H
#define ANDROID_STRING16_H

#include <string> // for std::string
#include <iostream>
#include <string>

#include <utils/Errors.h>
#include <utils/String8.h>
@@ -203,6 +204,11 @@ public:
// require any change to the underlying SharedBuffer contents or reference count.
ANDROID_TRIVIAL_MOVE_TRAIT(String16)

static inline std::ostream& operator<<(std::ostream& os, const String16& str) {
    os << String8(str).c_str();
    return os;
}

// ---------------------------------------------------------------------------

/*