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

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: 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..33caf899fb6e4f623561582b156fa8658c1ecd99 100644
--- a/include/utils/SkRTConf.h
+++ b/include/utils/SkRTConf.h
@@ -111,10 +111,19 @@ 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 {
hal.canary 2013/10/14 14:32:08 "} else {" should be all on one line.
reed1 2013/10/14 15:07:18 agreed
+ sprintf(outline, "%-30.30s", getName());
+ outptr = &(outline[30]);
+ }
+
+ doPrint(outptr);
+ sprintf(outptr+30, " %.128s", fDescription.c_str());
hal.canary 2013/10/14 14:32:08 Is there a style inconsistency between outptr+30 a
reed1 2013/10/14 15:07:18 very minor, but I think I agree with the reviewer,
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