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

Side by Side Diff: base/pickle.cc

Issue 6688056: Updating DCHECK() to DCHECK_GE() in base/ dir (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updating license header Created 9 years, 8 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/path_service.cc ('k') | base/shared_memory_posix.cc » ('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) 2006-2008 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>
11 11
(...skipping 14 matching lines...) Expand all
26 variable_buffer_offset_(0) { 26 variable_buffer_offset_(0) {
27 Resize(kPayloadUnit); 27 Resize(kPayloadUnit);
28 header_->payload_size = 0; 28 header_->payload_size = 0;
29 } 29 }
30 30
31 Pickle::Pickle(int header_size) 31 Pickle::Pickle(int header_size)
32 : header_(NULL), 32 : header_(NULL),
33 header_size_(AlignInt(header_size, sizeof(uint32))), 33 header_size_(AlignInt(header_size, sizeof(uint32))),
34 capacity_(0), 34 capacity_(0),
35 variable_buffer_offset_(0) { 35 variable_buffer_offset_(0) {
36 DCHECK(static_cast<size_t>(header_size) >= sizeof(Header)); 36 DCHECK_GE(static_cast<size_t>(header_size), sizeof(Header));
37 DCHECK(header_size <= kPayloadUnit); 37 DCHECK(header_size <= kPayloadUnit);
38 Resize(kPayloadUnit); 38 Resize(kPayloadUnit);
39 header_->payload_size = 0; 39 header_->payload_size = 0;
40 } 40 }
41 41
42 Pickle::Pickle(const char* data, int data_len) 42 Pickle::Pickle(const char* data, int data_len)
43 : header_(reinterpret_cast<Header*>(const_cast<char*>(data))), 43 : header_(reinterpret_cast<Header*>(const_cast<char*>(data))),
44 header_size_(0), 44 header_size_(0),
45 capacity_(kCapacityReadOnly), 45 capacity_(kCapacityReadOnly),
46 variable_buffer_offset_(0) { 46 variable_buffer_offset_(0) {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/path_service.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698