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

Side by Side Diff: third_party/ots/test/ot-sanitise.cc

Issue 1064913002: Revert of Update OTS to revision 6d2e08b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « third_party/ots/src/woff2.cc ('k') | third_party/ots/test/side-by-side.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) 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 // A very simple driver program while sanitises the file given as argv[1] and 5 // A very simple driver program while sanitises the file given as argv[1] and
6 // writes the sanitised version to stdout. 6 // writes the sanitised version to stdout.
7 7
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #if defined(_WIN32) 10 #if defined(_WIN32)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 std::fprintf(stderr, "ERROR: "); 42 std::fprintf(stderr, "ERROR: ");
43 else 43 else
44 std::fprintf(stderr, "WARNING: "); 44 std::fprintf(stderr, "WARNING: ");
45 va_start(va, format); 45 va_start(va, format);
46 std::vfprintf(stderr, format, va); 46 std::vfprintf(stderr, format, va);
47 std::fprintf(stderr, "\n"); 47 std::fprintf(stderr, "\n");
48 va_end(va); 48 va_end(va);
49 } 49 }
50 50
51 virtual ots::TableAction GetTableAction(uint32_t tag) { 51 virtual ots::TableAction GetTableAction(uint32_t tag) {
52 #define TAG(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
52 switch (tag) { 53 switch (tag) {
53 case OTS_TAG('S','i','l','f'): 54 case TAG('S','i','l','f'):
54 case OTS_TAG('S','i','l','l'): 55 case TAG('S','i','l','l'):
55 case OTS_TAG('G','l','o','c'): 56 case TAG('G','l','o','c'):
56 case OTS_TAG('G','l','a','t'): 57 case TAG('G','l','a','t'):
57 case OTS_TAG('F','e','a','t'): 58 case TAG('F','e','a','t'):
58 case OTS_TAG('C','B','D','T'):
59 case OTS_TAG('C','B','L','C'):
60 return ots::TABLE_ACTION_PASSTHRU; 59 return ots::TABLE_ACTION_PASSTHRU;
61 default: 60 default:
62 return ots::TABLE_ACTION_DEFAULT; 61 return ots::TABLE_ACTION_DEFAULT;
63 } 62 }
63 #undef TAG
64 } 64 }
65 }; 65 };
66 66
67 } // namespace 67 } // namespace
68 68
69 int main(int argc, char **argv) { 69 int main(int argc, char **argv) {
70 if (argc < 2 || argc > 3) return Usage(argv[0]); 70 if (argc < 2 || argc > 3) return Usage(argv[0]);
71 71
72 const int fd = ::open(argv[1], O_RDONLY | ADDITIONAL_OPEN_FLAGS); 72 const int fd = ::open(argv[1], O_RDONLY | ADDITIONAL_OPEN_FLAGS);
73 if (fd < 0) { 73 if (fd < 0) {
(...skipping 18 matching lines...) Expand all
92 out = fopen(argv[2], "wb"); 92 out = fopen(argv[2], "wb");
93 93
94 ots::FILEStream output(out); 94 ots::FILEStream output(out);
95 const bool result = context.Process(&output, data, st.st_size); 95 const bool result = context.Process(&output, data, st.st_size);
96 96
97 if (!result) { 97 if (!result) {
98 std::fprintf(stderr, "Failed to sanitise file!\n"); 98 std::fprintf(stderr, "Failed to sanitise file!\n");
99 } 99 }
100 return !result; 100 return !result;
101 } 101 }
OLDNEW
« no previous file with comments | « third_party/ots/src/woff2.cc ('k') | third_party/ots/test/side-by-side.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698