| OLD | NEW | 
|---|
| 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  Loading... | 
| 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  Loading... | 
| 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 | 
| OLD | NEW | 
|---|