| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkXMLWriter.h" | 8 #include "SkXMLWriter.h" |
| 9 #include "SkStream.h" | 9 #include "SkStream.h" |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 return extra; | 140 return extra; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void SkXMLWriter::addAttributeLen(const char name[], const char value[], size_t
length) | 143 void SkXMLWriter::addAttributeLen(const char name[], const char value[], size_t
length) |
| 144 { | 144 { |
| 145 SkString valueStr; | 145 SkString valueStr; |
| 146 | 146 |
| 147 if (fDoEscapeMarkup) | 147 if (fDoEscapeMarkup) |
| 148 { | 148 { |
| 149 size_t extra = escape_markup(NULL, value, length); | 149 size_t extra = escape_markup(nullptr, value, length); |
| 150 if (extra) | 150 if (extra) |
| 151 { | 151 { |
| 152 valueStr.resize(length + extra); | 152 valueStr.resize(length + extra); |
| 153 (void)escape_markup(valueStr.writable_str(), value, length); | 153 (void)escape_markup(valueStr.writable_str(), value, length); |
| 154 value = valueStr.c_str(); | 154 value = valueStr.c_str(); |
| 155 length += extra; | 155 length += extra; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 this->onAddAttributeLen(name, value, length); | 158 this->onAddAttributeLen(name, value, length); |
| 159 } | 159 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 174 SkASSERT(dom.countChildren(node) == 0); | 174 SkASSERT(dom.countChildren(node) == 0); |
| 175 w->addText(elem, strlen(elem)); | 175 w->addText(elem, strlen(elem)); |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 | 178 |
| 179 w->startElement(elem); | 179 w->startElement(elem); |
| 180 | 180 |
| 181 SkDOM::AttrIter iter(dom, node); | 181 SkDOM::AttrIter iter(dom, node); |
| 182 const char* name; | 182 const char* name; |
| 183 const char* value; | 183 const char* value; |
| 184 while ((name = iter.next(&value)) != NULL) | 184 while ((name = iter.next(&value)) != nullptr) |
| 185 w->addAttribute(name, value); | 185 w->addAttribute(name, value); |
| 186 } | 186 } |
| 187 | 187 |
| 188 node = dom.getFirstChild(node, NULL); | 188 node = dom.getFirstChild(node, nullptr); |
| 189 while (node) | 189 while (node) |
| 190 { | 190 { |
| 191 write_dom(dom, node, w, false); | 191 write_dom(dom, node, w, false); |
| 192 node = dom.getNextSibling(node, NULL); | 192 node = dom.getNextSibling(node, nullptr); |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (!skipRoot) | 195 if (!skipRoot) |
| 196 w->endElement(); | 196 w->endElement(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void SkXMLWriter::writeDOM(const SkDOM& dom, const SkDOM::Node* node, bool skipR
oot) | 199 void SkXMLWriter::writeDOM(const SkDOM& dom, const SkDOM::Node* node, bool skipR
oot) |
| 200 { | 200 { |
| 201 if (node) | 201 if (node) |
| 202 write_dom(dom, node, this, skipRoot); | 202 write_dom(dom, node, this, skipRoot); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 w.endElement(); | 352 w.endElement(); |
| 353 w.endElement(); | 353 w.endElement(); |
| 354 w.startElement("elem2"); | 354 w.startElement("elem2"); |
| 355 w.endElement(); | 355 w.endElement(); |
| 356 w.endElement(); | 356 w.endElement(); |
| 357 w.endElement(); | 357 w.endElement(); |
| 358 #endif | 358 #endif |
| 359 } | 359 } |
| 360 | 360 |
| 361 #endif | 361 #endif |
| OLD | NEW |