| 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-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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // This should be more efficient with a lookup table but I couldn't measur
e | 184 // This should be more efficient with a lookup table but I couldn't measur
e |
| 185 // any performance difference. | 185 // any performance difference. |
| 186 if (currChar >= u'A' && currChar <= u'Z') | 186 if (currChar >= u'A' && currChar <= u'Z') |
| 187 mBuf[i] = currChar + u'a' - u'A'; | 187 mBuf[i] = currChar + u'a' - u'A'; |
| 188 else if (currChar >= 128) | 188 else if (currChar >= 128) |
| 189 { | 189 { |
| 190 mBuf[i] = CharToLower(currChar); | 190 mBuf[i] = CharToLower(currChar); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 |
| 195 int toInt() const |
| 196 { |
| 197 size_type count = 0; |
| 198 int value = 0; |
| 199 for (size_type i = 0; i < length(); i++) |
| 200 { |
| 201 if (mBuf[i] < u'0' || mBuf[i] > u'9') |
| 202 return 0; |
| 203 value *= 10; |
| 204 value += mBuf[i] - u'0'; |
| 205 count++; |
| 206 if (count > 8) |
| 207 return 0; |
| 208 } |
| 209 return value; |
| 210 } |
| 194 }; | 211 }; |
| 195 | 212 |
| 196 class DependentString : public String | 213 class DependentString : public String |
| 197 { | 214 { |
| 198 public: | 215 public: |
| 199 explicit DependentString() | 216 explicit DependentString() |
| 200 : String(nullptr, 0, INVALID) | 217 : String(nullptr, 0, INVALID) |
| 201 { | 218 { |
| 202 } | 219 } |
| 203 | 220 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (negative) | 415 if (negative) |
| 399 mBuf[pos++] = '-'; | 416 mBuf[pos++] = '-'; |
| 400 | 417 |
| 401 for (int i = size - 1; i >= 0; i--) | 418 for (int i = size - 1; i >= 0; i--) |
| 402 { | 419 { |
| 403 mBuf[pos + i] = '0' + (num % 10); | 420 mBuf[pos + i] = '0' + (num % 10); |
| 404 num /= 10; | 421 num /= 10; |
| 405 } | 422 } |
| 406 } | 423 } |
| 407 }; | 424 }; |
| OLD | NEW |