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

Unified Diff: include/utils/SkRTConf.h

Issue 26206003: handle configuration variables longer than 30 characters long (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Nits from Hal Created 7 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkRTConf.h
diff --git a/include/utils/SkRTConf.h b/include/utils/SkRTConf.h
index 1dc41c9799ffdcc67bc3106f7f473a86b041ef1e..91993d83be05cba7bd65993805f271011dba60d1 100644
--- a/include/utils/SkRTConf.h
+++ b/include/utils/SkRTConf.h
@@ -111,10 +111,18 @@ SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *descr
template<typename T>
void SkRTConf<T>::print(SkWStream *o) const {
char outline[200]; // should be ok because we specify a max. width for everything here.
-
- sprintf(outline, "%-30.30s", getName());
- doPrint(&(outline[30]));
- sprintf(&(outline[60]), " %.128s", fDescription.c_str());
+ char *outptr;
+ if (strlen(getName()) >= 30) {
+ o->writeText(getName());
+ o->writeText(" ");
+ outptr = &(outline[0]);
+ } else {
+ sprintf(outline, "%-30.30s", getName());
+ outptr = &(outline[30]);
+ }
+
+ doPrint(outptr);
+ sprintf(outptr+30, " %.128s", fDescription.c_str());
for (size_t i = strlen(outline); i --> 0 && ' ' == outline[i];) {
outline[i] = '\0';
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698