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

Side by Side Diff: src/engine/Main.cpp

Issue 11449051: Fix 64-bit conversion errors (Closed)
Patch Set: Created Aug. 16, 2013, 2:56 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 | src/engine/UpdateInstallDialog.cpp » ('j') | src/plugin/PluginClass.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <functional> 2 #include <functional>
3 #include <vector> 3 #include <vector>
4 #include <Windows.h> 4 #include <Windows.h>
5 5
6 #include "../shared/AutoHandle.h" 6 #include "../shared/AutoHandle.h"
7 #include "../shared/Communication.h" 7 #include "../shared/Communication.h"
8 #include "../shared/Dictionary.h" 8 #include "../shared/Dictionary.h"
9 #include "../shared/Utils.h" 9 #include "../shared/Utils.h"
10 #include "../shared/Version.h" 10 #include "../shared/Version.h"
11 #include "../shared/CriticalSection.h" 11 #include "../shared/CriticalSection.h"
12 #include "Debug.h" 12 #include "Debug.h"
13 #include "Updater.h" 13 #include "Updater.h"
14 14
15 namespace 15 namespace
16 { 16 {
17 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine; 17 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine;
18 std::auto_ptr<Updater> updater; 18 std::auto_ptr<Updater> updater;
19 int activeConnections = 0; 19 int activeConnections = 0;
20 CriticalSection activeConnectionsLock; 20 CriticalSection activeConnectionsLock;
21 21
22 void WriteStrings(Communication::OutputBuffer& response, 22 void WriteStrings(Communication::OutputBuffer& response,
23 const std::vector<std::string>& strings) 23 const std::vector<std::string>& strings)
24 { 24 {
25 int32_t count = strings.size(); 25 int32_t count = static_cast<int32_t>(strings.size());
26 response << count; 26 response << count;
27 for (int32_t i = 0; i < count; i++) 27 for (int32_t i = 0; i < count; i++)
28 response << strings[i]; 28 response << strings[i];
29 } 29 }
30 30
31 void WriteSubscriptions(Communication::OutputBuffer& response, 31 void WriteSubscriptions(Communication::OutputBuffer& response,
32 const std::vector<AdblockPlus::SubscriptionPtr>& subscriptions) 32 const std::vector<AdblockPlus::SubscriptionPtr>& subscriptions)
33 { 33 {
34 int32_t count = subscriptions.size(); 34 int32_t count = static_cast<int32_t>(subscriptions.size());
35 response << count; 35 response << count;
36 for (int32_t i = 0; i < count; i++) 36 for (int32_t i = 0; i < count; i++)
37 { 37 {
38 AdblockPlus::SubscriptionPtr subscription = subscriptions[i]; 38 AdblockPlus::SubscriptionPtr subscription = subscriptions[i];
39 response << subscription->GetProperty("url")->AsString() 39 response << subscription->GetProperty("url")->AsString()
40 << subscription->GetProperty("title")->AsString() 40 << subscription->GetProperty("title")->AsString()
41 << subscription->GetProperty("specialization")->AsString() 41 << subscription->GetProperty("specialization")->AsString()
42 << subscription->IsListed(); 42 << subscription->IsListed();
43 } 43 }
44 } 44 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 for (size_t i = 0, count = filters.size(); i < count; i++) 129 for (size_t i = 0, count = filters.size(); i < count; i++)
130 { 130 {
131 AdblockPlus::FilterPtr filter = filters[i]; 131 AdblockPlus::FilterPtr filter = filters[i];
132 if (filter->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) 132 if (filter->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION)
133 { 133 {
134 std::string text = filter->GetProperty("text")->AsString(); 134 std::string text = filter->GetProperty("text")->AsString();
135 135
136 //@@||example.com^$document 136 //@@||example.com^$document
137 const char prefix[] = "@@||"; 137 const char prefix[] = "@@||";
138 const char suffix[] = "^$document"; 138 const char suffix[] = "^$document";
139 const int prefixLen = strlen(prefix); 139 const size_t prefixLen = strlen(prefix);
140 const int suffixLen = strlen(suffix); 140 const size_t suffixLen = strlen(suffix);
141 if (!text.compare(0, prefixLen, prefix) && 141 if (!text.compare(0, prefixLen, prefix) &&
142 !text.compare(text.size() - suffixLen, suffixLen, suffix)) 142 !text.compare(text.size() - suffixLen, suffixLen, suffix))
143 { 143 {
144 domains.push_back(text.substr(prefixLen, text.size() - prefixLen - suffixLen)); 144 domains.push_back(text.substr(prefixLen, text.size() - prefixLen - suffixLen));
145 } 145 }
146 } 146 }
147 } 147 }
148 148
149 WriteStrings(response, domains); 149 WriteStrings(response, domains);
150 break; 150 break;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 catch (std::runtime_error e) 402 catch (std::runtime_error e)
403 { 403 {
404 DebugException(e); 404 DebugException(e);
405 return 1; 405 return 1;
406 } 406 }
407 } 407 }
408 408
409 return 0; 409 return 0;
410 } 410 }
OLDNEW
« no previous file with comments | « no previous file | src/engine/UpdateInstallDialog.cpp » ('j') | src/plugin/PluginClass.cpp » ('J')

Powered by Google App Engine
This is Rietveld