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

Delta Between Two Patch Sets: compiled/String.h

Issue 29384812: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 1 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Switched to our own number conversion Created April 6, 2017, 3:25 p.m.
Right Patch Set: Addressed comments Created April 13, 2017, 1:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | compiled/StringMap.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 void append(T num) 376 void append(T num)
377 { 377 {
378 bool negative = false; 378 bool negative = false;
379 if (num < 0) 379 if (num < 0)
380 { 380 {
381 negative = true; 381 negative = true;
382 num = -num; 382 num = -num;
383 } 383 }
384 384
385 size_type size = 0; 385 size_type size = 0;
386 for (int i = num; i; i /= 10) 386 for (T i = num; i; i /= 10)
387 size++; 387 size++;
388 size = (size ? size : 1); 388 size = (size ? size : 1);
389 389
390 size_type pos = length(); 390 size_type pos = length();
391 grow((negative ? 1 : 0) + size); 391 grow((negative ? 1 : 0) + size);
392 392
393 if (negative) 393 if (negative)
394 mBuf[pos++] = '-'; 394 mBuf[pos++] = '-';
395 395
396 for (int i = size - 1; i >= 0; i--) 396 for (int i = size - 1; i >= 0; i--)
397 { 397 {
398 mBuf[pos + i] = '0' + (num % 10); 398 mBuf[pos + i] = '0' + (num % 10);
399 num /= 10; 399 num /= 10;
400 } 400 }
401 } 401 }
402 }; 402 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld