Skip to content
Browse files

Cleanup win32

  • Loading branch information...
1 parent c7536b9 commit 776ad6cf4d6d632a8ff3559e7946108d632a6633 @sajty sajty committed Jan 2, 2014
Showing with 8 additions and 21 deletions.
  1. +4 −6 varconf/config.cpp
  2. +1 −2 varconf/parse_error.cpp
  3. +3 −13 varconf/variable.cpp
View
10 varconf/config.cpp
@@ -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;
@@ -48,7 +46,7 @@ extern char** environ;
char **environ = NULL;
#endif
-#endif // __WIN32__
+#endif // _WIN32
namespace {
enum state_t {
@@ -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));
}
View
3 varconf/parse_error.cpp
@@ -29,8 +29,7 @@
#include <cstdio>
#include <iostream>
-#ifdef __WIN32__
-#include <tchar.h>
+#ifdef _WIN32
#define snprintf _snprintf
#endif
View
16 varconf/variable.cpp
@@ -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 {
@@ -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();
}

0 comments on commit 776ad6c

Please sign in to comment.
Something went wrong with that request. Please try again.