Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -1,17 +1,18 @@ |
#include <algorithm> |
#include <cctype> |
#include <functional> |
+#include <string> |
#include <AdblockPlus.h> |
using namespace AdblockPlus; |
-extern const char* jsSources[]; |
+extern std::string jsSources[]; |
Filter::Filter(JsValuePtr value) |
: JsValue(value) |
{ |
if (!IsObject()) |
throw std::runtime_error("JavaScript value is not an object"); |
} |
@@ -111,17 +112,17 @@ bool Subscription::IsUpdating() |
bool Subscription::operator==(const Subscription& subscription) const |
{ |
return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsString(); |
} |
FilterEngine::FilterEngine(JsEnginePtr jsEngine) : jsEngine(jsEngine) |
{ |
- for (int i = 0; jsSources[i] && jsSources[i + 1]; i += 2) |
+ for (int i = 0; !jsSources[i].empty(); i += 2) |
jsEngine->Evaluate(jsSources[i + 1], jsSources[i]); |
} |
FilterPtr FilterEngine::GetFilter(const std::string& text) |
{ |
JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText"); |
JsValueList params; |
params.push_back(jsEngine->NewValue(text)); |