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

Side by Side Diff: compiled/storage/FilterStorage.cpp

Issue 29549903: Issue 5664 - assert now accept one parameter. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Leave assert() alone now. Created Sept. 21, 2017, 12:48 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 | « compiled/intrusive_ptr.h ('k') | compiled/subscription/UserDefinedSubscription.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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 FilterNotifier::Topic::SUBSCRIPTION_REMOVED, 105 FilterNotifier::Topic::SUBSCRIPTION_REMOVED,
106 subscription 106 subscription
107 ); 107 );
108 return true; 108 return true;
109 } 109 }
110 110
111 bool FilterStorage::MoveSubscription(Subscription& subscription, 111 bool FilterStorage::MoveSubscription(Subscription& subscription,
112 const Subscription* insertBefore) 112 const Subscription* insertBefore)
113 { 113 {
114 int oldPos = IndexOfSubscription(subscription); 114 int oldPos = IndexOfSubscription(subscription);
115 assert(oldPos >= 0, u"Attempt to move a subscription that is not in the list"_ str); 115 assert2(oldPos >= 0, u"Attempt to move a subscription that is not in the list" _str);
116 if (oldPos == -1) 116 if (oldPos == -1)
117 return false; 117 return false;
118 118
119 int newPos = -1; 119 int newPos = -1;
120 if (insertBefore) 120 if (insertBefore)
121 newPos = IndexOfSubscription(*insertBefore); 121 newPos = IndexOfSubscription(*insertBefore);
122 if (newPos == -1) 122 if (newPos == -1)
123 newPos = mSubscriptions.size(); 123 newPos = mSubscriptions.size();
124 124
125 if (newPos > oldPos) 125 if (newPos > oldPos)
126 newPos--; 126 newPos--;
127 127
128 if (newPos == oldPos) 128 if (newPos == oldPos)
129 return false; 129 return false;
130 130
131 mSubscriptions.erase(mSubscriptions.begin() + oldPos); 131 mSubscriptions.erase(mSubscriptions.begin() + oldPos);
132 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription); 132 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription);
133 133
134 FilterNotifier::SubscriptionChange( 134 FilterNotifier::SubscriptionChange(
135 FilterNotifier::Topic::SUBSCRIPTION_MOVED, 135 FilterNotifier::Topic::SUBSCRIPTION_MOVED,
136 subscription 136 subscription
137 ); 137 );
138 return true; 138 return true;
139 } 139 }
OLDNEW
« no previous file with comments | « compiled/intrusive_ptr.h ('k') | compiled/subscription/UserDefinedSubscription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld