Fix various warnings, remove silly useless NO_INLINE system, remove the need for -fkeep-inline-functions

This commit is contained in:
mniip 2013-10-26 21:50:40 +04:00
parent f7f24a9804
commit bf908bbfbf
21 changed files with 152 additions and 161 deletions

View File

@ -253,7 +253,7 @@ if GetOption("toolprefix"):
# make sure the compiler can find the source data and generated files. enable warnings, set C++ flavor, and keep inline functions
env.Append(CPPPATH=['src/', 'data/', 'generated/'])
env.Append(CCFLAGS=['-w', '-std=c++98', '-fkeep-inline-functions'])
env.Append(CXXFLAGS=['-std=c++98'])
env.Append(LIBS=['pthread', 'm'])
env.Append(CPPDEFINES=["_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"])

View File

@ -181,13 +181,10 @@ extern unsigned char ZSIZE;
#if defined(_MSC_VER)
#define TPT_INLINE _inline
#define TPT_NO_INLINE
#elif defined(__llvm__)
#define TPT_INLINE
#define TPT_NO_INLINE
#else
#define TPT_INLINE inline
#define TPT_NO_INLINE inline
#endif
#define SDEUT

View File

@ -73,7 +73,7 @@ std::string format::UnixtimeToDateMini(time_t unixtime)
std::string format::CleanString(std::string dirtyString, int maxStringLength)
{
return CleanString(dirtyString, std::string::npos, maxStringLength);
return CleanString(dirtyString, (int)std::string::npos, maxStringLength);
}
std::string format::CleanString(std::string dirtyString, int maxVisualSize, int maxStringLength)
@ -97,7 +97,7 @@ std::string format::CleanString(std::string dirtyString, int maxVisualSize, int
std::string format::CleanString(char * dirtyData, int maxStringLength)
{
return CleanString(dirtyData, std::string::npos, maxStringLength);
return CleanString(dirtyData, (int)std::string::npos, maxStringLength);
}
std::string format::CleanString(char * dirtyData, int maxVisualSize, int maxStringLength)

View File

@ -101,7 +101,7 @@ int isign(float i) //TODO: INline or macro
return 0;
}
TPT_NO_INLINE unsigned clamp_flt(float f, float min, float max) //TODO: Also inline/macro
unsigned clamp_flt(float f, float min, float max) //TODO: Also inline/macro
{
if (f<min)
return 0;
@ -110,7 +110,7 @@ TPT_NO_INLINE unsigned clamp_flt(float f, float min, float max) //TODO: Also inl
return (int)(255.0f*(f-min)/(max-min));
}
TPT_NO_INLINE float restrict_flt(float f, float min, float max) //TODO Inline or macro or something
float restrict_flt(float f, float min, float max) //TODO Inline or macro or something
{
if (f<min)
return min;

View File

@ -44,7 +44,7 @@ namespace json
{
TPT_NO_INLINE Exception::Exception(const std::string& sMessage) :
Exception::Exception(const std::string& sMessage) :
std::runtime_error(sMessage) {}
@ -129,32 +129,32 @@ public:
TPT_NO_INLINE UnknownElement::UnknownElement() : m_pImp( new Imp_T<Null>( Null() ) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const UnknownElement& unknown) : m_pImp( unknown.m_pImp->Clone()) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T<Object>(object) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T<Array>(array) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T<Number>(number) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T<Boolean>(boolean) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T<String>(string) ) {}
TPT_NO_INLINE UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T<Null>(null) ) {}
UnknownElement::UnknownElement() : m_pImp( new Imp_T<Null>( Null() ) ) {}
UnknownElement::UnknownElement(const UnknownElement& unknown) : m_pImp( unknown.m_pImp->Clone()) {}
UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T<Object>(object) ) {}
UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T<Array>(array) ) {}
UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T<Number>(number) ) {}
UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T<Boolean>(boolean) ) {}
UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T<String>(string) ) {}
UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T<Null>(null) ) {}
TPT_NO_INLINE UnknownElement::~UnknownElement() { delete m_pImp; }
UnknownElement::~UnknownElement() { delete m_pImp; }
TPT_NO_INLINE UnknownElement::operator const Object& () const { return CastTo<Object>(); }
TPT_NO_INLINE UnknownElement::operator const Array& () const { return CastTo<Array>(); }
TPT_NO_INLINE UnknownElement::operator const Number& () const { return CastTo<Number>(); }
TPT_NO_INLINE UnknownElement::operator const Boolean& () const { return CastTo<Boolean>(); }
TPT_NO_INLINE UnknownElement::operator const String& () const { return CastTo<String>(); }
TPT_NO_INLINE UnknownElement::operator const Null& () const { return CastTo<Null>(); }
UnknownElement::operator const Object& () const { return CastTo<Object>(); }
UnknownElement::operator const Array& () const { return CastTo<Array>(); }
UnknownElement::operator const Number& () const { return CastTo<Number>(); }
UnknownElement::operator const Boolean& () const { return CastTo<Boolean>(); }
UnknownElement::operator const String& () const { return CastTo<String>(); }
UnknownElement::operator const Null& () const { return CastTo<Null>(); }
TPT_NO_INLINE UnknownElement::operator Object& () { return ConvertTo<Object>(); }
TPT_NO_INLINE UnknownElement::operator Array& () { return ConvertTo<Array>(); }
TPT_NO_INLINE UnknownElement::operator Number& () { return ConvertTo<Number>(); }
TPT_NO_INLINE UnknownElement::operator Boolean& () { return ConvertTo<Boolean>(); }
TPT_NO_INLINE UnknownElement::operator String& () { return ConvertTo<String>(); }
TPT_NO_INLINE UnknownElement::operator Null& () { return ConvertTo<Null>(); }
UnknownElement::operator Object& () { return ConvertTo<Object>(); }
UnknownElement::operator Array& () { return ConvertTo<Array>(); }
UnknownElement::operator Number& () { return ConvertTo<Number>(); }
UnknownElement::operator Boolean& () { return ConvertTo<Boolean>(); }
UnknownElement::operator String& () { return ConvertTo<String>(); }
UnknownElement::operator Null& () { return ConvertTo<Null>(); }
TPT_NO_INLINE UnknownElement& UnknownElement::operator = (const UnknownElement& unknown)
UnknownElement& UnknownElement::operator = (const UnknownElement& unknown)
{
// always check for this
if (&unknown != this)
@ -170,28 +170,28 @@ TPT_NO_INLINE UnknownElement& UnknownElement::operator = (const UnknownElement&
return *this;
}
TPT_NO_INLINE UnknownElement& UnknownElement::operator[] (const std::string& key)
UnknownElement& UnknownElement::operator[] (const std::string& key)
{
// the people want an object. make us one if we aren't already
Object& object = ConvertTo<Object>();
return object[key];
}
TPT_NO_INLINE const UnknownElement& UnknownElement::operator[] (const std::string& key) const
const UnknownElement& UnknownElement::operator[] (const std::string& key) const
{
// throws if we aren't an object
const Object& object = CastTo<Object>();
return object[key];
}
TPT_NO_INLINE UnknownElement& UnknownElement::operator[] (size_t index)
UnknownElement& UnknownElement::operator[] (size_t index)
{
// the people want an array. make us one if we aren't already
Array& array = ConvertTo<Array>();
return array[index];
}
TPT_NO_INLINE const UnknownElement& UnknownElement::operator[] (size_t index) const
const UnknownElement& UnknownElement::operator[] (size_t index) const
{
// throws if we aren't an array
const Array& array = CastTo<Array>();
@ -227,11 +227,11 @@ ElementTypeT& UnknownElement::ConvertTo()
}
TPT_NO_INLINE void UnknownElement::Accept(ConstVisitor& visitor) const { m_pImp->Accept(visitor); }
TPT_NO_INLINE void UnknownElement::Accept(Visitor& visitor) { m_pImp->Accept(visitor); }
void UnknownElement::Accept(ConstVisitor& visitor) const { m_pImp->Accept(visitor); }
void UnknownElement::Accept(Visitor& visitor) { m_pImp->Accept(visitor); }
TPT_NO_INLINE bool UnknownElement::operator == (const UnknownElement& element) const
bool UnknownElement::operator == (const UnknownElement& element) const
{
return m_pImp->Compare(*element.m_pImp);
}
@ -242,10 +242,10 @@ TPT_NO_INLINE bool UnknownElement::operator == (const UnknownElement& element) c
// Object members
TPT_NO_INLINE Object::Member::Member(const std::string& nameIn, const UnknownElement& elementIn) :
Object::Member::Member(const std::string& nameIn, const UnknownElement& elementIn) :
name(nameIn), element(elementIn) {}
TPT_NO_INLINE bool Object::Member::operator == (const Member& member) const
bool Object::Member::operator == (const Member& member) const
{
return name == member.name &&
element == member.element;
@ -265,30 +265,30 @@ private:
TPT_NO_INLINE Object::iterator Object::Begin() { return m_Members.begin(); }
TPT_NO_INLINE Object::iterator Object::End() { return m_Members.end(); }
TPT_NO_INLINE Object::const_iterator Object::Begin() const { return m_Members.begin(); }
TPT_NO_INLINE Object::const_iterator Object::End() const { return m_Members.end(); }
Object::iterator Object::Begin() { return m_Members.begin(); }
Object::iterator Object::End() { return m_Members.end(); }
Object::const_iterator Object::Begin() const { return m_Members.begin(); }
Object::const_iterator Object::End() const { return m_Members.end(); }
TPT_NO_INLINE size_t Object::Size() const { return m_Members.size(); }
TPT_NO_INLINE bool Object::Empty() const { return m_Members.empty(); }
size_t Object::Size() const { return m_Members.size(); }
bool Object::Empty() const { return m_Members.empty(); }
TPT_NO_INLINE Object::iterator Object::Find(const std::string& name)
Object::iterator Object::Find(const std::string& name)
{
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
}
TPT_NO_INLINE Object::const_iterator Object::Find(const std::string& name) const
Object::const_iterator Object::Find(const std::string& name) const
{
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
}
TPT_NO_INLINE Object::iterator Object::Insert(const Member& member)
Object::iterator Object::Insert(const Member& member)
{
return Insert(member, End());
}
TPT_NO_INLINE Object::iterator Object::Insert(const Member& member, iterator itWhere)
Object::iterator Object::Insert(const Member& member, iterator itWhere)
{
iterator it = Find(member.name);
if (it != m_Members.end())
@ -298,12 +298,12 @@ TPT_NO_INLINE Object::iterator Object::Insert(const Member& member, iterator itW
return it;
}
TPT_NO_INLINE Object::iterator Object::Erase(iterator itWhere)
Object::iterator Object::Erase(iterator itWhere)
{
return m_Members.erase(itWhere);
}
TPT_NO_INLINE UnknownElement& Object::operator [](const std::string& name)
UnknownElement& Object::operator [](const std::string& name)
{
iterator it = Find(name);
@ -315,7 +315,7 @@ TPT_NO_INLINE UnknownElement& Object::operator [](const std::string& name)
return it->element;
}
TPT_NO_INLINE const UnknownElement& Object::operator [](const std::string& name) const
const UnknownElement& Object::operator [](const std::string& name) const
{
const_iterator it = Find(name);
if (it == End())
@ -323,12 +323,12 @@ TPT_NO_INLINE const UnknownElement& Object::operator [](const std::string& name)
return it->element;
}
TPT_NO_INLINE void Object::Clear()
void Object::Clear()
{
m_Members.clear();
}
TPT_NO_INLINE bool Object::operator == (const Object& object) const
bool Object::operator == (const Object& object) const
{
return m_Members == object.m_Members;
}
@ -337,35 +337,35 @@ TPT_NO_INLINE bool Object::operator == (const Object& object) const
/////////////////
// Array members
TPT_NO_INLINE Array::iterator Array::Begin() { return m_Elements.begin(); }
TPT_NO_INLINE Array::iterator Array::End() { return m_Elements.end(); }
TPT_NO_INLINE Array::const_iterator Array::Begin() const { return m_Elements.begin(); }
TPT_NO_INLINE Array::const_iterator Array::End() const { return m_Elements.end(); }
Array::iterator Array::Begin() { return m_Elements.begin(); }
Array::iterator Array::End() { return m_Elements.end(); }
Array::const_iterator Array::Begin() const { return m_Elements.begin(); }
Array::const_iterator Array::End() const { return m_Elements.end(); }
TPT_NO_INLINE Array::iterator Array::Insert(const UnknownElement& element, iterator itWhere)
Array::iterator Array::Insert(const UnknownElement& element, iterator itWhere)
{
return m_Elements.insert(itWhere, element);
}
TPT_NO_INLINE Array::iterator Array::Insert(const UnknownElement& element)
Array::iterator Array::Insert(const UnknownElement& element)
{
return Insert(element, End());
}
TPT_NO_INLINE Array::iterator Array::Erase(iterator itWhere)
Array::iterator Array::Erase(iterator itWhere)
{
return m_Elements.erase(itWhere);
}
TPT_NO_INLINE void Array::Resize(size_t newSize)
void Array::Resize(size_t newSize)
{
m_Elements.resize(newSize);
}
TPT_NO_INLINE size_t Array::Size() const { return m_Elements.size(); }
TPT_NO_INLINE bool Array::Empty() const { return m_Elements.empty(); }
size_t Array::Size() const { return m_Elements.size(); }
bool Array::Empty() const { return m_Elements.empty(); }
TPT_NO_INLINE UnknownElement& Array::operator[] (size_t index)
UnknownElement& Array::operator[] (size_t index)
{
size_t nMinSize = index + 1; // zero indexed
if (m_Elements.size() < nMinSize)
@ -373,18 +373,18 @@ TPT_NO_INLINE UnknownElement& Array::operator[] (size_t index)
return m_Elements[index];
}
TPT_NO_INLINE const UnknownElement& Array::operator[] (size_t index) const
const UnknownElement& Array::operator[] (size_t index) const
{
if (index >= m_Elements.size())
throw Exception("Array out of bounds");
return m_Elements[index];
}
TPT_NO_INLINE void Array::Clear() {
void Array::Clear() {
m_Elements.clear();
}
TPT_NO_INLINE bool Array::operator == (const Array& array) const
bool Array::operator == (const Array& array) const
{
return m_Elements == array.m_Elements;
}
@ -393,7 +393,7 @@ TPT_NO_INLINE bool Array::operator == (const Array& array) const
//////////////////
// Null members
TPT_NO_INLINE bool Null::operator == (const Null& trivial) const
bool Null::operator == (const Null& trivial) const
{
return true;
}

View File

@ -43,12 +43,12 @@ TODO:
namespace json
{
TPT_NO_INLINE std::istream& operator >> (std::istream& istr, UnknownElement& elementRoot) {
std::istream& operator >> (std::istream& istr, UnknownElement& elementRoot) {
Reader::Read(elementRoot, istr);
return istr;
}
TPT_NO_INLINE Reader::Location::Location() :
Reader::Location::Location() :
m_nLine(0),
m_nLineOffset(0),
m_nDocOffset(0)
@ -84,7 +84,7 @@ private:
};
TPT_NO_INLINE char Reader::InputStream::Get()
char Reader::InputStream::Get()
{
assert(m_iStr.eof() == false); // enforce reading of only valid stream data
char c = m_iStr.get();
@ -122,12 +122,12 @@ private:
};
TPT_NO_INLINE Reader::TokenStream::TokenStream(const Tokens& tokens) :
Reader::TokenStream::TokenStream(const Tokens& tokens) :
m_Tokens(tokens),
m_itCurrent(tokens.begin())
{}
TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Peek() {
const Reader::Token& Reader::TokenStream::Peek() {
if (EOS())
{
const Token& lastToken = *m_Tokens.rbegin();
@ -137,13 +137,13 @@ TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Peek() {
return *(m_itCurrent);
}
TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Get() {
const Reader::Token& Reader::TokenStream::Get() {
const Token& token = Peek();
++m_itCurrent;
return token;
}
TPT_NO_INLINE bool Reader::TokenStream::EOS() const {
bool Reader::TokenStream::EOS() const {
return m_itCurrent == m_Tokens.end();
}
@ -151,13 +151,13 @@ TPT_NO_INLINE bool Reader::TokenStream::EOS() const {
// Reader (finally)
TPT_NO_INLINE void Reader::Read(Object& object, std::istream& istr) { Read_i(object, istr); }
TPT_NO_INLINE void Reader::Read(Array& array, std::istream& istr) { Read_i(array, istr); }
TPT_NO_INLINE void Reader::Read(String& string, std::istream& istr) { Read_i(string, istr); }
TPT_NO_INLINE void Reader::Read(Number& number, std::istream& istr) { Read_i(number, istr); }
TPT_NO_INLINE void Reader::Read(Boolean& boolean, std::istream& istr) { Read_i(boolean, istr); }
TPT_NO_INLINE void Reader::Read(Null& null, std::istream& istr) { Read_i(null, istr); }
TPT_NO_INLINE void Reader::Read(UnknownElement& unknown, std::istream& istr) { Read_i(unknown, istr); }
void Reader::Read(Object& object, std::istream& istr) { Read_i(object, istr); }
void Reader::Read(Array& array, std::istream& istr) { Read_i(array, istr); }
void Reader::Read(String& string, std::istream& istr) { Read_i(string, istr); }
void Reader::Read(Number& number, std::istream& istr) { Read_i(number, istr); }
void Reader::Read(Boolean& boolean, std::istream& istr) { Read_i(boolean, istr); }
void Reader::Read(Null& null, std::istream& istr) { Read_i(null, istr); }
void Reader::Read(UnknownElement& unknown, std::istream& istr) { Read_i(unknown, istr); }
template <typename ElementTypeT>
@ -181,7 +181,7 @@ void Reader::Read_i(ElementTypeT& element, std::istream& istr)
}
TPT_NO_INLINE void Reader::Scan(Tokens& tokens, InputStream& inputStream)
void Reader::Scan(Tokens& tokens, InputStream& inputStream)
{
while (EatWhiteSpace(inputStream), // ignore any leading white space...
inputStream.EOS() == false) // ...before checking for EOS
@ -272,14 +272,14 @@ TPT_NO_INLINE void Reader::Scan(Tokens& tokens, InputStream& inputStream)
}
TPT_NO_INLINE void Reader::EatWhiteSpace(InputStream& inputStream)
void Reader::EatWhiteSpace(InputStream& inputStream)
{
while (inputStream.EOS() == false &&
::isspace(inputStream.Peek()))
inputStream.Get();
}
TPT_NO_INLINE std::string Reader::MatchExpectedString(InputStream& inputStream, const std::string& sExpected)
std::string Reader::MatchExpectedString(InputStream& inputStream, const std::string& sExpected)
{
std::string::const_iterator it(sExpected.begin()),
itEnd(sExpected.end());
@ -297,7 +297,7 @@ TPT_NO_INLINE std::string Reader::MatchExpectedString(InputStream& inputStream,
}
TPT_NO_INLINE std::string Reader::MatchString(InputStream& inputStream)
std::string Reader::MatchString(InputStream& inputStream)
{
MatchExpectedString(inputStream, "\"");
@ -341,7 +341,7 @@ TPT_NO_INLINE std::string Reader::MatchString(InputStream& inputStream)
}
TPT_NO_INLINE std::string Reader::MatchNumber(InputStream& inputStream)
std::string Reader::MatchNumber(InputStream& inputStream)
{
const char sNumericChars[] = "0123456789.eE-+";
std::set<char> numericChars;
@ -358,7 +358,7 @@ TPT_NO_INLINE std::string Reader::MatchNumber(InputStream& inputStream)
}
TPT_NO_INLINE void Reader::Parse(UnknownElement& element, Reader::TokenStream& tokenStream)
void Reader::Parse(UnknownElement& element, Reader::TokenStream& tokenStream)
{
const Token& token = tokenStream.Peek();
switch (token.nType) {
@ -414,7 +414,7 @@ TPT_NO_INLINE void Reader::Parse(UnknownElement& element, Reader::TokenStream& t
}
TPT_NO_INLINE void Reader::Parse(Object& object, Reader::TokenStream& tokenStream)
void Reader::Parse(Object& object, Reader::TokenStream& tokenStream)
{
MatchExpectedToken(Token::TOKEN_OBJECT_BEGIN, tokenStream);
@ -456,7 +456,7 @@ TPT_NO_INLINE void Reader::Parse(Object& object, Reader::TokenStream& tokenStrea
}
TPT_NO_INLINE void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
{
MatchExpectedToken(Token::TOKEN_ARRAY_BEGIN, tokenStream);
@ -479,13 +479,13 @@ TPT_NO_INLINE void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
}
TPT_NO_INLINE void Reader::Parse(String& string, Reader::TokenStream& tokenStream)
void Reader::Parse(String& string, Reader::TokenStream& tokenStream)
{
string = MatchExpectedToken(Token::TOKEN_STRING, tokenStream);
}
TPT_NO_INLINE void Reader::Parse(Number& number, Reader::TokenStream& tokenStream)
void Reader::Parse(Number& number, Reader::TokenStream& tokenStream)
{
const Token& currentToken = tokenStream.Peek(); // might need this later for throwing exception
const std::string& sValue = MatchExpectedToken(Token::TOKEN_NUMBER, tokenStream);
@ -506,20 +506,20 @@ TPT_NO_INLINE void Reader::Parse(Number& number, Reader::TokenStream& tokenStrea
}
TPT_NO_INLINE void Reader::Parse(Boolean& boolean, Reader::TokenStream& tokenStream)
void Reader::Parse(Boolean& boolean, Reader::TokenStream& tokenStream)
{
const std::string& sValue = MatchExpectedToken(Token::TOKEN_BOOLEAN, tokenStream);
boolean = (sValue == "true" ? true : false);
}
TPT_NO_INLINE void Reader::Parse(Null&, Reader::TokenStream& tokenStream)
void Reader::Parse(Null&, Reader::TokenStream& tokenStream)
{
MatchExpectedToken(Token::TOKEN_NULL, tokenStream);
}
TPT_NO_INLINE const std::string& Reader::MatchExpectedToken(Token::Type nExpected, Reader::TokenStream& tokenStream)
const std::string& Reader::MatchExpectedToken(Token::Type nExpected, Reader::TokenStream& tokenStream)
{
const Token& token = tokenStream.Get();
if (token.nType != nExpected)

View File

@ -43,16 +43,16 @@ namespace json
{
TPT_NO_INLINE void Writer::Write(const UnknownElement& elementRoot, std::ostream& ostr) { Write_i(elementRoot, ostr); }
TPT_NO_INLINE void Writer::Write(const Object& object, std::ostream& ostr) { Write_i(object, ostr); }
TPT_NO_INLINE void Writer::Write(const Array& array, std::ostream& ostr) { Write_i(array, ostr); }
TPT_NO_INLINE void Writer::Write(const Number& number, std::ostream& ostr) { Write_i(number, ostr); }
TPT_NO_INLINE void Writer::Write(const String& string, std::ostream& ostr) { Write_i(string, ostr); }
TPT_NO_INLINE void Writer::Write(const Boolean& boolean, std::ostream& ostr) { Write_i(boolean, ostr); }
TPT_NO_INLINE void Writer::Write(const Null& null, std::ostream& ostr) { Write_i(null, ostr); }
void Writer::Write(const UnknownElement& elementRoot, std::ostream& ostr) { Write_i(elementRoot, ostr); }
void Writer::Write(const Object& object, std::ostream& ostr) { Write_i(object, ostr); }
void Writer::Write(const Array& array, std::ostream& ostr) { Write_i(array, ostr); }
void Writer::Write(const Number& number, std::ostream& ostr) { Write_i(number, ostr); }
void Writer::Write(const String& string, std::ostream& ostr) { Write_i(string, ostr); }
void Writer::Write(const Boolean& boolean, std::ostream& ostr) { Write_i(boolean, ostr); }
void Writer::Write(const Null& null, std::ostream& ostr) { Write_i(null, ostr); }
TPT_NO_INLINE Writer::Writer(std::ostream& ostr) :
Writer::Writer(std::ostream& ostr) :
m_ostr(ostr),
m_nTabDepth(0)
{}
@ -65,7 +65,7 @@ void Writer::Write_i(const ElementTypeT& element, std::ostream& ostr)
ostr.flush(); // all done
}
TPT_NO_INLINE void Writer::Write_i(const Array& array)
void Writer::Write_i(const Array& array)
{
if (array.Empty())
m_ostr << "[]";
@ -91,7 +91,7 @@ TPT_NO_INLINE void Writer::Write_i(const Array& array)
}
}
TPT_NO_INLINE void Writer::Write_i(const Object& object)
void Writer::Write_i(const Object& object)
{
if (object.Empty())
m_ostr << "{}";
@ -120,17 +120,17 @@ TPT_NO_INLINE void Writer::Write_i(const Object& object)
}
}
TPT_NO_INLINE void Writer::Write_i(const Number& numberElement)
void Writer::Write_i(const Number& numberElement)
{
m_ostr << std::setprecision(20) << numberElement.Value();
}
TPT_NO_INLINE void Writer::Write_i(const Boolean& booleanElement)
void Writer::Write_i(const Boolean& booleanElement)
{
m_ostr << (booleanElement.Value() ? "true" : "false");
}
TPT_NO_INLINE void Writer::Write_i(const String& stringElement)
void Writer::Write_i(const String& stringElement)
{
m_ostr << '"';
@ -156,22 +156,22 @@ TPT_NO_INLINE void Writer::Write_i(const String& stringElement)
m_ostr << '"';
}
TPT_NO_INLINE void Writer::Write_i(const Null& )
void Writer::Write_i(const Null& )
{
m_ostr << "null";
}
TPT_NO_INLINE void Writer::Write_i(const UnknownElement& unknown)
void Writer::Write_i(const UnknownElement& unknown)
{
unknown.Accept(*this);
}
TPT_NO_INLINE void Writer::Visit(const Array& array) { Write_i(array); }
TPT_NO_INLINE void Writer::Visit(const Object& object) { Write_i(object); }
TPT_NO_INLINE void Writer::Visit(const Number& number) { Write_i(number); }
TPT_NO_INLINE void Writer::Visit(const String& string) { Write_i(string); }
TPT_NO_INLINE void Writer::Visit(const Boolean& boolean) { Write_i(boolean); }
TPT_NO_INLINE void Writer::Visit(const Null& null) { Write_i(null); }
void Writer::Visit(const Array& array) { Write_i(array); }
void Writer::Visit(const Object& object) { Write_i(object); }
void Writer::Visit(const Number& number) { Write_i(number); }
void Writer::Visit(const String& string) { Write_i(string); }
void Writer::Visit(const Boolean& boolean) { Write_i(boolean); }
void Writer::Visit(const Null& null) { Write_i(null); }

View File

@ -1221,9 +1221,7 @@ RequestBroker::Request * Client::SaveUserInfoAsync(UserInfo info)
json::Reader::Read(objDocument, dataStream);
json::Number tempStatus = objDocument["Status"];
bool returnValue = tempStatus.Value() == 1;
return (void*)(returnValue ? 1 : 0);
return (void*)(tempStatus.Value() == 1);
}
catch (json::Exception &e)
{

View File

@ -1,5 +1,3 @@
#pragma once
#include "ElementPopulation.h"
#include "gui/interface/Engine.h"
#include "simulation/Simulation.h"

View File

@ -163,7 +163,7 @@ TPT_INLINE int PIXELMETHODS_CLASS::drawchar(int x, int y, int c, int r, int g, i
return x + w;
}
TPT_NO_INLINE int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
{
int i, j, w, bn = 0, ba = 0;
char *rp = font_data + font_ptrs[c];

View File

@ -128,7 +128,7 @@ TPT_INLINE int PIXELMETHODS_CLASS::drawchar(int x, int y, int c, int r, int g, i
return x + w;
}
TPT_NO_INLINE int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
{
int i, j, w, bn = 0, ba = 0;
char *rp = font_data + font_ptrs[c];

View File

@ -13,8 +13,8 @@
#include "client/Client.h"
#include "client/GameSave.h"
#include "gui/game/DecorationTool.h"
#include "GameModelException.h"
#include "QuickOptions.h"
#include "GameModelException.h"
#include "Format.h"
GameModel::GameModel():

View File

@ -12,7 +12,7 @@
#include "Brush.h"
#include "client/User.h"
#include "Notification.h"
#include "QuickOption.h"
#include "Tool.h"
#include "Menu.h"
@ -23,7 +23,6 @@ class GameController;
class Simulation;
class Renderer;
class QuickOption;
class ToolSelection
{
public:

View File

@ -15,7 +15,7 @@
#include "simulation/SimulationData.h"
#include "gui/dialogues/ConfirmPrompt.h"
#include "Format.h"
#include "QuickOption.h"
#include "QuickOptions.h"
#include "IntroText.h"
#include "DecorationTool.h"

View File

@ -59,12 +59,12 @@ bool Button::GetTogglable()
return isTogglable;
}
TPT_NO_INLINE bool Button::GetToggleState()
bool Button::GetToggleState()
{
return toggle;
}
TPT_NO_INLINE void Button::SetToggleState(bool state)
void Button::SetToggleState(bool state)
{
toggle = state;
}

View File

@ -43,8 +43,8 @@ public:
virtual void DoAltAction(); //action of button what ever it may be
void SetTogglable(bool isTogglable);
bool GetTogglable();
TPT_NO_INLINE bool GetToggleState();
TPT_NO_INLINE void SetToggleState(bool state);
bool GetToggleState();
void SetToggleState(bool state);
void SetActionCallback(ButtonAction * action);
ButtonAction * GetActionCallback() { return actionCallback; }
void SetText(std::string buttonText);

View File

@ -63,7 +63,7 @@ namespace ui
inline int GetMaxWidth() { return maxWidth; }
inline int GetMaxHeight() { return maxHeight; }
TPT_NO_INLINE void SetMaxSize(int width, int height);
void SetMaxSize(int width, int height);
inline void SetSize(int width, int height);

View File

@ -1,4 +1,3 @@
#pragma once
#include <vector>
//#include "Platform.h"

View File

@ -1,7 +1,7 @@
#include <cmath>
#include "PreviewModel.h"
#include "client/Client.h"
#include "client/GameSave.h";
#include "client/GameSave.h"
#include "PreviewModelException.h"
PreviewModel::PreviewModel():

View File

@ -1658,7 +1658,7 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
return ndata;
}
TPT_NO_INLINE void Simulation::orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[])
void Simulation::orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[])
{
resblock1[0] = (block1&0x000000FF);
resblock1[1] = (block1&0x0000FF00)>>8;
@ -1671,7 +1671,7 @@ TPT_NO_INLINE void Simulation::orbitalparts_get(int block1, int block2, int resb
resblock2[3] = (block2&0xFF000000)>>24;
}
TPT_NO_INLINE void Simulation::orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[])
void Simulation::orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[])
{
int block1tmp = 0;
int block2tmp = 0;

View File

@ -123,36 +123,36 @@ public:
Snapshot * CreateSnapshot();
void Restore(const Snapshot & snap);
TPT_NO_INLINE int is_blocking(int t, int x, int y);
TPT_NO_INLINE int is_boundary(int pt, int x, int y);
TPT_NO_INLINE int find_next_boundary(int pt, int *x, int *y, int dm, int *em);
TPT_NO_INLINE int pn_junction_sprk(int x, int y, int pt);
TPT_NO_INLINE void photoelectric_effect(int nx, int ny);
TPT_NO_INLINE unsigned direction_to_map(float dx, float dy, int t);
TPT_NO_INLINE int do_move(int i, int x, int y, float nxf, float nyf);
TPT_NO_INLINE int try_move(int i, int x, int y, int nx, int ny);
TPT_NO_INLINE int eval_move(int pt, int nx, int ny, unsigned *rr);
int is_blocking(int t, int x, int y);
int is_boundary(int pt, int x, int y);
int find_next_boundary(int pt, int *x, int *y, int dm, int *em);
int pn_junction_sprk(int x, int y, int pt);
void photoelectric_effect(int nx, int ny);
unsigned direction_to_map(float dx, float dy, int t);
int do_move(int i, int x, int y, float nxf, float nyf);
int try_move(int i, int x, int y, int nx, int ny);
int eval_move(int pt, int nx, int ny, unsigned *rr);
void init_can_move();
bool IsWallBlocking(int x, int y, int type);
void create_cherenkov_photon(int pp);
void create_gain_photon(int pp);
TPT_NO_INLINE void kill_part(int i);
void kill_part(int i);
bool FloodFillPmapCheck(int x, int y, int type);
int flood_prop(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype);
int flood_prop_2(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype, int parttype, char * bitmap);
int flood_water(int x, int y, int i, int originaly, int check);
int FloodINST(int x, int y, int fullc, int cm);
TPT_NO_INLINE void detach(int i);
TPT_NO_INLINE void part_change_type(int i, int x, int y, int t);
void detach(int i);
void part_change_type(int i, int x, int y, int t);
//int InCurrentBrush(int i, int j, int rx, int ry);
//int get_brush_flags();
TPT_NO_INLINE int create_part(int p, int x, int y, int t);
TPT_NO_INLINE void delete_part(int x, int y);
int create_part(int p, int x, int y, int t);
void delete_part(int x, int y);
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
TPT_NO_INLINE int is_wire(int x, int y);
TPT_NO_INLINE int is_wire_off(int x, int y);
TPT_NO_INLINE void set_emap(int x, int y);
TPT_NO_INLINE int parts_avg(int ci, int ni, int t);
int is_wire(int x, int y);
int is_wire_off(int x, int y);
void set_emap(int x, int y);
int parts_avg(int ci, int ni, int t);
void create_arc(int sx, int sy, int dx, int dy, int midpoints, int variance, int type, int flags);
int nearest_part(int ci, int t, int max_d);
void update_particles_i(int start, int inc);
@ -195,11 +195,11 @@ public:
int GetParticleType(std::string type);
void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate);
TPT_NO_INLINE void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
TPT_NO_INLINE void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
TPT_NO_INLINE int get_wavelength_bin(int *wm);
TPT_NO_INLINE int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny);
TPT_NO_INLINE int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, float *ny);
void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
int get_wavelength_bin(int *wm);
int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny);
int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, float *ny);
void clear_sim();
void UpdateParticles();
Simulation();