bump simplecpp

This commit is contained in:
Daniel Marjamäki 2017-06-23 20:09:26 +02:00
parent 947ace6194
commit c75b90487e
1 changed files with 72 additions and 81 deletions

View File

@ -1675,18 +1675,9 @@ namespace simplecpp {
};
}
namespace simplecpp {
#ifdef SIMPLECPP_WINDOWS
bool realFileName(const std::string &f, std::string *result)
{
// If path is a drive letter, uppercase it
if (f.size() == 2 && std::isalpha((unsigned char)f[0]) && f[1] == ':') {
*result = (char)std::toupper((unsigned char)f[0]) + std::string(":");
return true;
}
static bool realFileName(const std::string &f, std::string *result)
{
// are there alpha characters in last subpath?
bool alpha = false;
for (std::string::size_type pos = 1; pos < f.size(); ++pos) {
@ -1716,11 +1707,11 @@ namespace simplecpp {
*result = FindFileData.cFileName;
FindClose(hFind);
return true;
}
}
/** Change case in given path to match filesystem */
std::string realFilename(const std::string &f)
{
/** Change case in given path to match filesystem */
static std::string realFilename(const std::string &f)
{
std::string ret;
ret.reserve(f.size()); // this will be the final size
@ -1763,24 +1754,24 @@ namespace simplecpp {
}
return ret;
}
}
bool isAbsolutePath(const std::string &path)
{
static bool isAbsolutePath(const std::string &path)
{
if (path.length() >= 3 && path[0] > 0 && std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
return true;
return path.length() > 1U && (path[0] == '/' || path[0] == '/');
}
}
#else
#define realFilename(f) f
bool isAbsolutePath(const std::string &path)
{
static bool isAbsolutePath(const std::string &path)
{
return path.length() > 1U && path[0] == '/';
}
}
#endif
namespace simplecpp {
/**
* perform path simplifications for . and ..
*/
@ -1944,7 +1935,7 @@ static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok)
static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader)
{
if (simplecpp::isAbsolutePath(header)) {
if (isAbsolutePath(header)) {
f.open(header.c_str());
return f.is_open() ? simplecpp::simplifyPath(header) : "";
}
@ -1977,7 +1968,7 @@ static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const
static std::string getFileName(const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)
{
if (simplecpp::isAbsolutePath(header)) {
if (isAbsolutePath(header)) {
return (filedata.find(header) != filedata.end()) ? simplecpp::simplifyPath(header) : "";
}