Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/jni/Utils.cpp

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: Created April 28, 2017, 8:24 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/jni/Utils.cpp
diff --git a/libadblockplus-android/jni/Utils.cpp b/libadblockplus-android/jni/Utils.cpp
index 282ae5b344ea6640f6a6de8c3daf89e6b8f87f13..b18d91d4d8dc75df0e831780ad40fecd8ea29633 100644
--- a/libadblockplus-android/jni/Utils.cpp
+++ b/libadblockplus-android/jni/Utils.cpp
@@ -16,6 +16,8 @@
*/
#include <string>
+#include <sstream>
+#include <iostream>
#include "Utils.h"
@@ -98,6 +100,16 @@ std::string JniJavaToStdString(JNIEnv* env, jstring str)
return ret;
}
+std::string JniStdStreamToStdString(std::istream *in)
+{
+ std::string ret;
+ char buffer[1024];
+ while (in->read(buffer, sizeof(buffer)))
+ ret.append(buffer, sizeof(buffer));
+ ret.append(buffer, in->gcount());
+ return ret;
+}
+
jstring JniStdStringToJava(JNIEnv* env, std::string str)
{
return env->NewStringUTF(str.c_str());
« no previous file with comments | « libadblockplus-android/jni/Utils.h ('k') | libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld