Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Cleanup win32
Browse files Browse the repository at this point in the history
  • Loading branch information
sajty committed Jan 2, 2014
1 parent c7536b9 commit 776ad6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
10 changes: 4 additions & 6 deletions varconf/config.cpp
Expand Up @@ -31,11 +31,9 @@
#include <fstream>
#include <string>

#ifdef __WIN32__
#include <tchar.h>
#ifdef _WIN32
#define snprintf _snprintf
#include <cstdlib>
#else // __WIN32__
#else // _WIN32

extern char** environ;

Expand All @@ -48,7 +46,7 @@ extern char** environ;
char **environ = NULL;
#endif

#endif // __WIN32__
#endif // _WIN32

namespace {
enum state_t {
Expand Down Expand Up @@ -241,7 +239,7 @@ int Config::getCmdline(int argc, char** argv, Scope scope)
}
}

if (!fnd_nam && (arg.size() - mark) > 0) {
if (!fnd_nam && arg.size() != mark) {
name = arg.substr(mark, (arg.size() - mark));
}

Expand Down
3 changes: 1 addition & 2 deletions varconf/parse_error.cpp
Expand Up @@ -29,8 +29,7 @@
#include <cstdio>
#include <iostream>

#ifdef __WIN32__
#include <tchar.h>
#ifdef _WIN32
#define snprintf _snprintf
#endif

Expand Down
16 changes: 3 additions & 13 deletions varconf/variable.cpp
Expand Up @@ -30,19 +30,9 @@
#include <cstdio>
#include <cstdlib>

#ifdef __WIN32__
#include <tchar.h>
#ifdef _WIN32
#define snprintf _snprintf
// apparently, win32 atof() is somewhat broken
static double
win32_atof_substitute(const char* in)
{
double out;
sscanf(in, "%lf", &out);
return out;
}
#define atof win32_atof_substitute
#endif
#endif

namespace varconf {

Expand Down Expand Up @@ -257,7 +247,7 @@ bool VarBase::is_double() const
// strtod() points p to the first character
// in the string that doesn't look like
// part of a double
strtod(m_val.c_str(), &p);
strtod(m_val.c_str(), &p); //-V530

return p == m_val.c_str() + m_val.size();
}
Expand Down

0 comments on commit 776ad6c

Please sign in to comment.