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

Unified Diff: trunk/src/mojo/public/cpp/bindings/lib/scratch_buffer.cc

Issue 265823012: Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | trunk/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/mojo/public/cpp/bindings/lib/scratch_buffer.cc
===================================================================
--- trunk/src/mojo/public/cpp/bindings/lib/scratch_buffer.cc (revision 268433)
+++ trunk/src/mojo/public/cpp/bindings/lib/scratch_buffer.cc (working copy)
@@ -80,12 +80,11 @@
return false;
// Ensure segment buffer is aligned.
- size_t padded_segment_size = internal::Align(sizeof(Segment));
- Segment* segment = static_cast<Segment*>(
- malloc(padded_segment_size + delta));
+ size_t segment_size = internal::Align(sizeof(Segment)) + delta;
+ Segment* segment = static_cast<Segment*>(malloc(segment_size));
if (segment) {
segment->next = overflow_;
- segment->cursor = reinterpret_cast<char*>(segment) + padded_segment_size;
+ segment->cursor = reinterpret_cast<char*>(segment + 1);
segment->end = segment->cursor + delta;
overflow_ = segment;
return true;
« no previous file with comments | « no previous file | trunk/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698