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

Side by Side Diff: libadblockplus-android/jni/JniFilter.cpp

Issue 29347012: Issue 4188 - Update libadblockplus-android to use the latest libadblockplus (Closed)
Patch Set: Changes in libadblockplus-android repo Created June 24, 2016, 2:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | libadblockplus-android/jni/JniSubscription.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 10 matching lines...) Expand all
21 21
22 static AdblockPlus::Filter* GetFilterPtr(jlong ptr) 22 static AdblockPlus::Filter* GetFilterPtr(jlong ptr)
23 { 23 {
24 return JniLongToTypePtr<AdblockPlus::FilterPtr>(ptr)->get(); 24 return JniLongToTypePtr<AdblockPlus::FilterPtr>(ptr)->get();
25 } 25 }
26 26
27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue) 27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue)
28 { 28 {
29 try 29 try
30 { 30 {
31 return JniPtrToLong(new AdblockPlus::FilterPtr(new AdblockPlus::Filter(JniGe tJsValuePtr(jsValue)))); 31 AdblockPlus::JsValue *jsValuePtr = JniGetJsValue(jsValue);
32 return JniPtrToLong(new AdblockPlus::FilterPtr(
33 new AdblockPlus::Filter(std::move(*jsValuePtr))));
sergei 2016/08/30 09:45:57 What about using of return JniPtrToLong(new Adbloc
sergei 2016/08/30 10:07:31 Even better without affecting address arithmetic r
anton 2016/08/30 10:57:29 Done.
32 } 34 }
33 CATCH_THROW_AND_RETURN(env, 0) 35 CATCH_THROW_AND_RETURN(env, 0)
34 } 36 }
35 37
36 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr) 38 static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr)
37 { 39 {
38 AdblockPlus::Filter::Type type; 40 AdblockPlus::Filter::Type type;
39 try 41 try
40 { 42 {
41 type = GetFilterPtr(ptr)->GetType(); 43 type = GetFilterPtr(ptr)->GetType();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed }, 120 { (char*)"isListed", (char*)"(J)Z", (void*)JniIsListed },
119 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList }, 121 { (char*)"addToList", (char*)"(J)V", (void*)JniAddToList },
120 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, 122 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList },
121 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } 123 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals }
122 }; 124 };
123 125
124 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz) 126 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Filter_reg isterNatives(JNIEnv *env, jclass clazz)
125 { 127 {
126 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 128 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
127 } 129 }
OLDNEW
« no previous file with comments | « no previous file | libadblockplus-android/jni/JniSubscription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld