aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-30 14:39:52 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-30 14:39:52 +0000
commit3a1f6a06cc706b35d9d6086ffbf5135cbf42bf8a (patch)
tree2c7f1949a5da7f2ff0adfa4caf716ab7207ddb3a /src
parentb371ed1784fcc594131abb7fc2f76b0abd20ca9e (diff)
SkStringPrintf helper fucntion + a new unit test for it.
git-svn-id: http://skia.googlecode.com/svn/trunk@1766 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkString.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index f461a7a44a..0d7defec8a 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -542,8 +542,6 @@ void SkString::prependf(const char format[], ...) {
this->prepend(buffer, strlen(buffer));
}
-#undef VSNPRINTF
-
///////////////////////////////////////////////////////////////////////////////
void SkString::remove(size_t offset, size_t length) {
@@ -605,3 +603,16 @@ SkAutoUCS2::SkAutoUCS2(const char utf8[]) {
SkAutoUCS2::~SkAutoUCS2() {
sk_free(fUCS2);
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkString SkStringPrintf(const char* format, ...) {
+ SkString formattedOutput;
+ char buffer[kBufferSize];
+ ARGS_TO_BUFFER(format, buffer, kBufferSize);
+ formattedOutput.set(buffer);
+ return formattedOutput;
+}
+
+#undef VSNPRINTF
+