Merge pull request #3498 from ncpenke/gcc-4.4.3-support

Gcc 4.4.3 support
This commit is contained in:
Wouter van Oortmerssen
2016-01-19 10:27:57 -08:00
12 changed files with 166 additions and 90 deletions

View File

@@ -38,6 +38,8 @@
#include <limits.h>
#endif
#include "flatbuffers/flatbuffers.h"
namespace flatbuffers {
// Convert an integer or floating point value to a string.
@@ -68,7 +70,7 @@ template<> inline std::string NumToString<double>(double t) {
auto p = s.find_last_not_of('0');
if (p != std::string::npos) {
s.resize(p + 1); // Strip trailing zeroes.
if (s.back() == '.')
if (s[s.size() - 1] == '.')
s.erase(s.size() - 1, 1); // Strip '.' if a whole number.
}
return s;
@@ -197,8 +199,8 @@ inline std::string StripFileName(const std::string &filepath) {
inline std::string ConCatPathFileName(const std::string &path,
const std::string &filename) {
std::string filepath = path;
if (path.length() && path.back() != kPathSeparator &&
path.back() != kPosixPathSeparator)
if (path.length() && path[path.size() - 1] != kPathSeparator &&
path[path.size() - 1] != kPosixPathSeparator)
filepath += kPathSeparator;
filepath += filename;
return filepath;