Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: base/pickle.cc

Issue 7528010: Remove Purify and Quantify (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | base/third_party/purify/LICENSE » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/pickle.h" 5 #include "base/pickle.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> // for max() 9 #include <algorithm> // for max()
10 #include <limits> 10 #include <limits>
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 #ifdef ARCH_CPU_64_BITS 388 #ifdef ARCH_CPU_64_BITS
389 DCHECK_LE(length, std::numeric_limits<uint32>::max()); 389 DCHECK_LE(length, std::numeric_limits<uint32>::max());
390 #endif 390 #endif
391 391
392 header_->payload_size = static_cast<uint32>(new_size); 392 header_->payload_size = static_cast<uint32>(new_size);
393 return payload() + offset; 393 return payload() + offset;
394 } 394 }
395 395
396 void Pickle::EndWrite(char* dest, int length) { 396 void Pickle::EndWrite(char* dest, int length) {
397 // Zero-pad to keep tools like purify from complaining about uninitialized 397 // Zero-pad to keep tools like valgrind from complaining about uninitialized
398 // memory. 398 // memory.
399 if (length % sizeof(uint32)) 399 if (length % sizeof(uint32))
400 memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32))); 400 memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32)));
401 } 401 }
402 402
403 bool Pickle::Resize(size_t new_capacity) { 403 bool Pickle::Resize(size_t new_capacity) {
404 new_capacity = AlignInt(new_capacity, kPayloadUnit); 404 new_capacity = AlignInt(new_capacity, kPayloadUnit);
405 405
406 CHECK_NE(capacity_, kCapacityReadOnly); 406 CHECK_NE(capacity_, kCapacityReadOnly);
407 void* p = realloc(header_, new_capacity); 407 void* p = realloc(header_, new_capacity);
(...skipping 16 matching lines...) Expand all
424 return NULL; 424 return NULL;
425 425
426 const Header* hdr = reinterpret_cast<const Header*>(start); 426 const Header* hdr = reinterpret_cast<const Header*>(start);
427 const char* payload_base = start + header_size; 427 const char* payload_base = start + header_size;
428 const char* payload_end = payload_base + hdr->payload_size; 428 const char* payload_end = payload_base + hdr->payload_size;
429 if (payload_end < payload_base) 429 if (payload_end < payload_base)
430 return NULL; 430 return NULL;
431 431
432 return (payload_end > end) ? NULL : payload_end; 432 return (payload_end > end) ? NULL : payload_end;
433 } 433 }
OLDNEW
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | base/third_party/purify/LICENSE » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698