OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBML_XMLParser.h" | 10 #include "SkBML_XMLParser.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 return data; | 35 return data; |
36 } | 36 } |
37 | 37 |
38 static void set(char* array[256], int index, SkStream& s, int data) | 38 static void set(char* array[256], int index, SkStream& s, int data) |
39 { | 39 { |
40 SkASSERT((unsigned)index <= 255); | 40 SkASSERT((unsigned)index <= 255); |
41 | 41 |
42 size_t size = rdata(s, data); | 42 size_t size = rdata(s, data); |
43 | 43 |
44 if (array[index] == NULL) | 44 if (array[index] == nullptr) |
45 array[index] = (char*)sk_malloc_throw(size + 1); | 45 array[index] = (char*)sk_malloc_throw(size + 1); |
46 else | 46 else |
47 { | 47 { |
48 if (strlen(array[index]) < size) | 48 if (strlen(array[index]) < size) |
49 array[index] = (char*)sk_realloc_throw(array[index], size + 1); | 49 array[index] = (char*)sk_realloc_throw(array[index], size + 1); |
50 } | 50 } |
51 | 51 |
52 s.read(array[index], size); | 52 s.read(array[index], size); |
53 array[index][size] = 0; | 53 array[index][size] = 0; |
54 } | 54 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 { | 172 { |
173 SkXMLStreamWriter writer(&output); | 173 SkXMLStreamWriter writer(&output); |
174 Read(s, writer); | 174 Read(s, writer); |
175 } | 175 } |
176 | 176 |
177 void BML_XMLParser::Read(SkStream& s, SkXMLParser& output) | 177 void BML_XMLParser::Read(SkStream& s, SkXMLParser& output) |
178 { | 178 { |
179 SkXMLParserWriter writer(&output); | 179 SkXMLParserWriter writer(&output); |
180 Read(s, writer); | 180 Read(s, writer); |
181 } | 181 } |
OLD | NEW |