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

Unified Diff: src/FilterEngine.cpp

Issue 10259051: Fixed: Compiler error due to string length limit in Visual C++ (Closed)
Patch Set: Created April 27, 2013, 11:33 p.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
« convert_js.py ('K') | « convert_js.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« convert_js.py ('K') | « convert_js.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld