diff --git a/boost/nowide/args.hpp b/boost/nowide/args.hpp index 3ae2f7e..4e97d97 100644 --- a/boost/nowide/args.hpp +++ b/boost/nowide/args.hpp @@ -91,12 +91,14 @@ namespace boost { wchar_t *wstrings_end = 0; int count = 0; for(wstrings_end = wstrings;*wstrings_end;wstrings_end+=wcslen(wstrings_end)+1) - count++; + count++; if(env_.convert(wstrings,wstrings_end)) { envp_.resize(count+1,0); char *p=env_.c_str(); + int pos = 0; for(int i=0;i #include +#include namespace boost { namespace nowide { diff --git a/boost/nowide/filebuf.hpp b/boost/nowide/filebuf.hpp index 894a323..fff2804 100644 --- a/boost/nowide/filebuf.hpp +++ b/boost/nowide/filebuf.hpp @@ -15,6 +15,12 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4996 4244) +#endif + + namespace boost { namespace nowide { #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN) @@ -392,6 +398,11 @@ namespace nowide { } // nowide } // boost +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + + #endif // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/boost/nowide/iostream.hpp b/boost/nowide/iostream.hpp index 7b09fde..e833184 100644 --- a/boost/nowide/iostream.hpp +++ b/boost/nowide/iostream.hpp @@ -14,6 +14,12 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251) +#endif + + namespace boost { namespace nowide { #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) @@ -83,6 +89,11 @@ namespace boost { } // nowide } // boost +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + + #endif /// // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/libs/nowide/build/Jamfile.v2 b/libs/nowide/build/Jamfile.v2 index 1c6097b..6246ffa 100644 --- a/libs/nowide/build/Jamfile.v2 +++ b/libs/nowide/build/Jamfile.v2 @@ -1,4 +1,4 @@ -# Boost System Library Build Jamfile +# Boost Nowide Library Build Jamfile # (C) Copyright Beman Dawes 2002, 2006, Artyom Beilis 2012 # @@ -19,8 +19,8 @@ SOURCES = iostream ; lib boost_nowide : $(SOURCES).cpp - : shared:BOOST_SYSTEM_DYN_LINK=1 - static:BOOST_SYSTEM_STATIC_LINK=1 + : shared:BOOST_NOWIDE_DYN_LINK=1 + static:BOOST_NOWIDE_STATIC_LINK=1 ; -boost-install boost_system ; +boost-install boost_nowide ; diff --git a/libs/nowide/src/iostream.cpp b/libs/nowide/src/iostream.cpp index 1456540..3882143 100644 --- a/libs/nowide/src/iostream.cpp +++ b/libs/nowide/src/iostream.cpp @@ -31,7 +31,7 @@ namespace details { { if(handle_) { DWORD dummy; - isatty_ = GetConsoleMode(handle_,&dummy); + isatty_ = GetConsoleMode(handle_,&dummy) == TRUE; } } protected: @@ -65,7 +65,8 @@ namespace details { char const *b = p; char const *e = p+n; if(!isatty_) { - if(!WriteFile(handle_,p,n,0,0)) + DWORD size=0; + if(!WriteFile(handle_,p,n,&size,0) || static_cast(size) != n) return -1; return n; } @@ -101,7 +102,7 @@ namespace details { { if(handle_) { DWORD dummy; - isatty_ = GetConsoleMode(handle_,&dummy); + isatty_ = GetConsoleMode(handle_,&dummy) == TRUE; } } diff --git a/libs/nowide/test/Jamfile.v2 b/libs/nowide/test/Jamfile.v2 index 58cc6b5..ccac9dd 100644 --- a/libs/nowide/test/Jamfile.v2 +++ b/libs/nowide/test/Jamfile.v2 @@ -8,14 +8,29 @@ # See library home page at http://www.boost.org/libs/system project + #: requirements /boost/nowide//boost_nowide ; test-suite "nowide" - : [ run test_convert.cpp ] - [ run test_env.cpp ] - [ run test_fstream.cpp ] - [ run test_iostream.cpp : : : /boost/nowide//boost_nowide ] - [ run test_stdio.cpp ] - [ run test_system.cpp : "-w" : : : test_system_w ] - [ run test_system.cpp : "-n" : : : test_system_n ] + : [ run test_convert.cpp ] + [ run test_fstream.cpp ] + [ run test_stdio.cpp ] + [ run test_env.cpp : : + : msvc:shell32.lib ] + + [ run test_system.cpp : "-w" : + : msvc:shell32.lib : test_system_w ] + + [ run test_system.cpp : "-n" : + : msvc:shell32.lib : test_system_n ] + + [ run test_iostream.cpp : : + : /boost/nowide//boost_nowide + static + : test_iostream_static ] + + [ run test_iostream.cpp : : + : /boost/nowide//boost_nowide + shared + : test_iostream_shared ] ; diff --git a/libs/nowide/test/test_env.cpp b/libs/nowide/test/test_env.cpp index 6ae4218..6a3e91d 100644 --- a/libs/nowide/test/test_env.cpp +++ b/libs/nowide/test/test_env.cpp @@ -10,6 +10,11 @@ #include #include "test.hpp" +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif + + int main() { try { diff --git a/libs/nowide/test/test_fstream.cpp b/libs/nowide/test/test_fstream.cpp index e7fb8c9..57d24e5 100644 --- a/libs/nowide/test/test_fstream.cpp +++ b/libs/nowide/test/test_fstream.cpp @@ -5,6 +5,10 @@ #include #include "test.hpp" +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif + int main() { diff --git a/libs/nowide/test/test_stdio.cpp b/libs/nowide/test/test_stdio.cpp index 888e3cc..eed4d47 100644 --- a/libs/nowide/test/test_stdio.cpp +++ b/libs/nowide/test/test_stdio.cpp @@ -11,6 +11,11 @@ #include #include "test.hpp" +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif + + int main() { try { diff --git a/libs/nowide/test/test_system.cpp b/libs/nowide/test/test_system.cpp index 1e85926..0e9b7a5 100644 --- a/libs/nowide/test/test_system.cpp +++ b/libs/nowide/test/test_system.cpp @@ -11,6 +11,7 @@ #include #include #include "test.hpp" +#include int main(int argc,char **argv,char **env) { @@ -27,11 +28,13 @@ int main(int argc,char **argv,char **env) std::string sample = "BOOST_NOWIDE_TEST=" + example; bool found = false; for(char **e=env;*e!=0;e++) { - char *key_end = strchr(*e,'='); + char *eptr = *e; + //printf("%s\n",eptr); + char *key_end = strchr(eptr,'='); TEST(key_end); - std::string key = std::string(*e,key_end); + std::string key = std::string(eptr,key_end); std::string value = key_end + 1; - TEST(getenv(key.c_str())); + TEST(boost::nowide::getenv(key.c_str())); TEST(boost::nowide::getenv(key.c_str()) == value); if(*e == sample) found = true;