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

Side by Side Diff: src/ots.cc

Issue 427014: Fix a test tool for OTS, ot-sanitise.... (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years 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 | « no previous file | test/file-stream.h » ('j') | test/file-stream.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "ots.h" 5 #include "ots.h"
6 6
7 #include <sys/types.h> 7 #include <sys/types.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cstdlib> 10 #include <cstdlib>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 output->ResetChecksum(); 352 output->ResetChecksum();
353 if (table_parsers[i].tag == Tag("head")) { 353 if (table_parsers[i].tag == Tag("head")) {
354 head_table_offset = out.offset; 354 head_table_offset = out.offset;
355 } 355 }
356 if (!table_parsers[i].serialise(output, header)) { 356 if (!table_parsers[i].serialise(output, header)) {
357 return OTS_FAILURE(); 357 return OTS_FAILURE();
358 } 358 }
359 359
360 const size_t end_offset = output->Tell(); 360 const size_t end_offset = output->Tell();
361 if (end_offset <= out.offset) {
362 // paranoid check. |end_offset| is supposed to be greater than the offset,
363 // as long as the Tell() interface is implemented correctly.
364 return OTS_FAILURE();
365 }
361 out.length = end_offset - out.offset; 366 out.length = end_offset - out.offset;
362 367
363 // align tables to four bytes 368 // align tables to four bytes
364 if (!output->Pad((4 - (end_offset & 3)) % 4)) { 369 if (!output->Pad((4 - (end_offset & 3)) % 4)) {
365 return OTS_FAILURE(); 370 return OTS_FAILURE();
366 } 371 }
367 out.chksum = output->chksum(); 372 out.chksum = output->chksum();
368 out_tables.push_back(out); 373 out_tables.push_back(out);
369 } 374 }
370 375
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 va_start(va, format); 452 va_start(va, format);
448 std::vfprintf(stderr, format, va); 453 std::vfprintf(stderr, format, va);
449 va_end(va); 454 va_end(va);
450 std::fprintf(stderr, "\n"); 455 std::fprintf(stderr, "\n");
451 std::fflush(stderr); 456 std::fflush(stderr);
452 } 457 }
453 } 458 }
454 #endif 459 #endif
455 460
456 } // namespace ots 461 } // namespace ots
OLDNEW
« no previous file with comments | « no previous file | test/file-stream.h » ('j') | test/file-stream.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698