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'; |
} |