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

Unified Diff: src/xml/SkXMLWriter.cpp

Issue 896363002: add length parameter to addText, to match attr values (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove legacy addText site Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/animator/SkXMLAnimatorWriter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/xml/SkXMLWriter.cpp
diff --git a/src/xml/SkXMLWriter.cpp b/src/xml/SkXMLWriter.cpp
index 56e08893883c67c8a508d583a90691ce9eeb9875..62e96687feb8f2213a405289dad5e25e40976682 100644
--- a/src/xml/SkXMLWriter.cpp
+++ b/src/xml/SkXMLWriter.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#include "SkXMLWriter.h"
#include "SkStream.h"
@@ -51,14 +49,13 @@ void SkXMLWriter::addScalarAttribute(const char name[], SkScalar value)
this->addAttribute(name, tmp.c_str());
}
-void SkXMLWriter::addText(const char text[])
-{
+void SkXMLWriter::addText(const char text[], size_t length) {
if (fElems.isEmpty()) {
return;
}
-
- this->onAddText(text);
-
+
+ this->onAddText(text, length);
+
fElems.top()->fHasText = true;
}
@@ -229,8 +226,7 @@ void SkXMLStreamWriter::onAddAttributeLen(const char name[], const char value[],
fStream.writeText("\"");
}
-void SkXMLStreamWriter::onAddText(const char text[])
-{
+void SkXMLStreamWriter::onAddText(const char text[], size_t length) {
Elem* elem = fElems.top();
if (!elem->fHasChildren && !elem->fHasText) {
@@ -239,7 +235,7 @@ void SkXMLStreamWriter::onAddText(const char text[])
}
tab(fStream, fElems.count() + 1);
- fStream.writeText(text);
+ fStream.write(text, length);
fStream.newline();
}
@@ -302,9 +298,8 @@ void SkXMLParserWriter::onAddAttributeLen(const char name[], const char value[],
fParser.addAttribute(name, str.c_str());
}
-void SkXMLParserWriter::onAddText(const char text[])
-{
- fParser.text(text, SkToInt(strlen(text)));
+void SkXMLParserWriter::onAddText(const char text[], size_t length) {
+ fParser.text(text, SkToInt(length));
}
void SkXMLParserWriter::onEndElement()
« no previous file with comments | « src/animator/SkXMLAnimatorWriter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698