| OLD | NEW |
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 return (int64_t)env->GetLongField(jObj, env->GetFieldID(clazz, name, "J")); | 180 return (int64_t)env->GetLongField(jObj, env->GetFieldID(clazz, name, "J")); |
| 181 } | 181 } |
| 182 | 182 |
| 183 inline jobjectArray JniGetStringArrayField(JNIEnv* env, jclass clazz, jobject jO
bj, const char* name) | 183 inline jobjectArray JniGetStringArrayField(JNIEnv* env, jclass clazz, jobject jO
bj, const char* name) |
| 184 { | 184 { |
| 185 return (jobjectArray)env->GetObjectField(jObj, env->GetFieldID(clazz, name, "[
Ljava/lang/String;")); | 185 return (jobjectArray)env->GetObjectField(jObj, env->GetFieldID(clazz, name, "[
Ljava/lang/String;")); |
| 186 } | 186 } |
| 187 | 187 |
| 188 jobject NewJniArrayList(JNIEnv* env); | 188 jobject NewJniArrayList(JNIEnv* env); |
| 189 | 189 |
| 190 jobject NewJniFilter(JNIEnv* env, const AdblockPlus::FilterPtr& filter); | 190 jobject NewJniFilter(JNIEnv* env, AdblockPlus::Filter& filter); |
| 191 | 191 |
| 192 jobject NewJniSubscription(JNIEnv* env, | 192 jobject NewJniSubscription(JNIEnv* env, AdblockPlus::Subscription& subscription)
; |
| 193 const AdblockPlus::SubscriptionPtr& subscription); | |
| 194 | 193 |
| 195 jobject NewJniNotification(JNIEnv* env, | 194 jobject NewJniNotification(JNIEnv* env, AdblockPlus::Notification& notification)
; |
| 196 const AdblockPlus::NotificationPtr& notification); | |
| 197 | 195 |
| 198 #define CATCH_AND_THROW(jEnv) \ | 196 #define CATCH_AND_THROW(jEnv) \ |
| 199 catch (const std::exception& except) \ | 197 catch (const std::exception& except) \ |
| 200 { \ | 198 { \ |
| 201 JniThrowException(jEnv, except); \ | 199 JniThrowException(jEnv, except); \ |
| 202 } \ | 200 } \ |
| 203 catch (...) \ | 201 catch (...) \ |
| 204 { \ | 202 { \ |
| 205 JniThrowException(jEnv); \ | 203 JniThrowException(jEnv); \ |
| 206 } | 204 } |
| 207 | 205 |
| 208 #define CATCH_THROW_AND_RETURN(jEnv, retVal) \ | 206 #define CATCH_THROW_AND_RETURN(jEnv, retVal) \ |
| 209 catch (const std::exception& except) \ | 207 catch (const std::exception& except) \ |
| 210 { \ | 208 { \ |
| 211 JniThrowException(jEnv, except); \ | 209 JniThrowException(jEnv, except); \ |
| 212 return retVal; \ | 210 return retVal; \ |
| 213 } \ | 211 } \ |
| 214 catch (...) \ | 212 catch (...) \ |
| 215 { \ | 213 { \ |
| 216 JniThrowException(jEnv); \ | 214 JniThrowException(jEnv); \ |
| 217 return retVal; \ | 215 return retVal; \ |
| 218 } | 216 } |
| 219 | 217 |
| 220 #endif | 218 #endif |
| OLD | NEW |