Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Unified Diff: webrtc/examples/android/media_demo/jni/jni_helpers.cc

Issue 1430023005: Remove ICU usage from jni_helpers.cc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Once more with feeling. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/build/webrtc.gni ('k') | webrtc/webrtc_examples.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/android/media_demo/jni/jni_helpers.cc
diff --git a/webrtc/examples/android/media_demo/jni/jni_helpers.cc b/webrtc/examples/android/media_demo/jni/jni_helpers.cc
index b0d1a7425c1326d98ecb2b325ccc4a5dc4385bef..7a4f5e4f6cd77d9884e0fc4d93a202cc6dffc4a6 100644
--- a/webrtc/examples/android/media_demo/jni/jni_helpers.cc
+++ b/webrtc/examples/android/media_demo/jni/jni_helpers.cc
@@ -12,10 +12,6 @@
#include <limits>
-#include "unicode/unistr.h"
-
-using icu::UnicodeString;
-
jmethodID GetMethodID(JNIEnv* jni, jclass c, const std::string& name,
const char* signature) {
jmethodID m = jni->GetMethodID(c, name.c_str(), signature);
@@ -36,14 +32,13 @@ jlong jlongFromPointer(void* ptr) {
// Given a (UTF-16) jstring return a new UTF-8 native string.
std::string JavaToStdString(JNIEnv* jni, const jstring& j_string) {
- const jchar* jchars = jni->GetStringChars(j_string, NULL);
- CHECK_JNI_EXCEPTION(jni, "Error during GetStringChars");
- UnicodeString ustr(jchars, jni->GetStringLength(j_string));
- CHECK_JNI_EXCEPTION(jni, "Error during GetStringLength");
- jni->ReleaseStringChars(j_string, jchars);
- CHECK_JNI_EXCEPTION(jni, "Error during ReleaseStringChars");
- std::string ret;
- return ustr.toUTF8String(ret);
+ const char* chars = jni->GetStringUTFChars(j_string, NULL);
+ CHECK_JNI_EXCEPTION(jni, "Error during GetStringUTFChars");
+ std::string str(chars, jni->GetStringUTFLength(j_string));
+ CHECK_JNI_EXCEPTION(jni, "Error during GetStringUTFLength");
+ jni->ReleaseStringUTFChars(j_string, chars);
+ CHECK_JNI_EXCEPTION(jni, "Error during ReleaseStringUTFChars");
+ return str;
}
ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni, const char** classes,
« no previous file with comments | « webrtc/build/webrtc.gni ('k') | webrtc/webrtc_examples.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698