From 0c0069f77c0b79fc68535a8c1ba4e3de88c54e41 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 26 Sep 2012 12:47:28 -0700 Subject: [PATCH] Small bugfixes. --- src/FieldNames.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FieldNames.cpp b/src/FieldNames.cpp index 57f823de3e..483694c2d2 100644 --- a/src/FieldNames.cpp +++ b/src/FieldNames.cpp @@ -9,34 +9,34 @@ SField sfInvalid(-1), sfGeneric(0); -#define FIELD(name, type, index) SField sf##name(FIELD_CODE(STI_##type, index), STI_##type, index, naem); +#define FIELD(name, type, index) SField sf##name(FIELD_CODE(STI_##type, index), STI_##type, index, #name); #define TYPE(name, type, index) #include "SerializeProto.h" #undef FIELD #undef TYPE -static std::map SField::codeToField; -static boost::mutex SField::mapMutex; +std::map SField::codeToField; +boost::mutex SField::mapMutex; -SField::ref SField::getField(int code); +SField::ref SField::getField(int code) { int type = code >> 16; int field = code % 0xffff; - if ((type <= 0) || (type >= 256) || (field <= 0) || (field >= 256 + if ((type <= 0) || (type >= 256) || (field <= 0) || (field >= 256)) return sfInvalid; boost::mutex::scoped_lock sl(mapMutex); - std::map it = unknownFieldMap.Find(code); + std::map it = codeToField.find(code); if (it != codeToField.end()) return *(it->second); switch(type) { // types we are willing to dynamically extend -#define FIELD(name, type, index) -#define TYPE(name, type, index) case sf##name: +#define FIELD(name, type, index) case sf##name: +#define TYPE(name, type, index) #include "SerializeProto.h" #undef FIELD #undef TYPE