From 810ae48f82f82d6e7fc4cf78d7a5a69e3cf9f2ed Mon Sep 17 00:00:00 2001 From: "humper@google.com" Date: Mon, 14 Jan 2013 20:11:00 +0000 Subject: [PATCH] move template specializations to inline functions in the header to make windows happy again BUG= Review URL: https://codereview.appspot.com/7099053 git-svn-id: http://skia.googlecode.com/svn/trunk@7164 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/utils/SkRTConf.h | 36 ++++++++++++++++++++++++++++++++++++ src/utils/SkRTConf.cpp | 40 ++-------------------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/include/utils/SkRTConf.h b/include/utils/SkRTConf.h index efbd3c5dd3..a02979fef4 100644 --- a/include/utils/SkRTConf.h +++ b/include/utils/SkRTConf.h @@ -122,6 +122,42 @@ void SkRTConf::doPrint(char *s) const { sprintf(s, "%-30.30s", "How do I print myself??"); } +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%s # [%s]", fValue ? "true" : "false", fDefault ? "true" : "false"); + sprintf(s, "%-30.30s", tmp); +} + +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%d # [%d]", fValue, fDefault); + sprintf(s, "%-30.30s", tmp); +} + +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%u # [%u]", fValue, fDefault); + sprintf(s, "%-30.30s", tmp); +} + +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault); + sprintf(s, "%-30.30s", tmp); +} + +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault); + sprintf(s, "%-30.30s", tmp); +} + +template<> inline void SkRTConf::doPrint(char *s) const { + char tmp[30]; + sprintf(tmp, "%s # [%s]", fValue, fDefault); + sprintf(s, "%-30.30s", tmp); +} + template bool SkRTConf::equals(const SkRTConfBase *conf) const { // static_cast here is okay because there's only one kind of child class. diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp index 38bc64ce76..4e4e57784d 100644 --- a/src/utils/SkRTConf.cpp +++ b/src/utils/SkRTConf.cpp @@ -76,7 +76,7 @@ void SkRTConfRegistry::possiblyDumpFile() const { // declared a correponding configuration object somewhere. void SkRTConfRegistry::validate() const { for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { - if (fConfs.find(fConfigFileKeys[i]->c_str()) == -1) { + if (fConfs.find(fConfigFileKeys[i]->c_str())) { SkDebugf("WARNING: You have config value %s in your configuration file, but I've never heard of that.\n", fConfigFileKeys[i]->c_str()); } } @@ -262,7 +262,7 @@ template void SkRTConfRegistry::set(const char *name, T value) { for (SkRTConfBase **confBase = confArray->begin(); confBase != confArray->end(); confBase++) { // static_cast here is okay because there's only one kind of child class. - SkRTConf *concrete = static_cast *>(*confBase); + SkRTConf *concrete = static_cast *>(*confBase); if (concrete) { concrete->set(value); @@ -277,42 +277,6 @@ template void SkRTConfRegistry::set(const char *name, float value); template void SkRTConfRegistry::set(const char *name, double value); template void SkRTConfRegistry::set(const char *name, char * value); -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%s # [%s]", fValue ? "true" : "false", fDefault ? "true" : "false"); - sprintf(s, "%-30.30s", tmp); -} - -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%d # [%d]", fValue, fDefault); - sprintf(s, "%-30.30s", tmp); -} - -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%u # [%u]", fValue, fDefault); - sprintf(s, "%-30.30s", tmp); -} - -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault); - sprintf(s, "%-30.30s", tmp); -} - -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault); - sprintf(s, "%-30.30s", tmp); -} - -template<> void SkRTConf::doPrint(char *s) const { - char tmp[30]; - sprintf(tmp, "%s # [%s]", fValue, fDefault); - sprintf(s, "%-30.30s", tmp); -} - SkRTConfRegistry &skRTConfRegistry() { static SkRTConfRegistry r; return r;