mirror of
https://github.com/boostorg/nowide.git
synced 2026-02-22 15:32:35 +00:00
Updated after windows fixes
This commit is contained in:
@@ -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<count;i++) {
|
||||
envp_[i] = p;
|
||||
if(*p!='=')
|
||||
envp_[pos++] = p;
|
||||
p+=strlen(p)+1;
|
||||
}
|
||||
en = &envp_[0];
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef BOOST_NOWIDE_CONVERT_H_INCLUDED
|
||||
#define BOOST_NOWIDE_CONVERT_H_INCLUDED
|
||||
|
||||
#include <boost/locale/encoding_utf.hpp>
|
||||
#include <string>
|
||||
#include <boost/locale/encoding_utf.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace nowide {
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
#include <streambuf>
|
||||
#include <stdio.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
: <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
|
||||
<link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
|
||||
: <link>shared:<define>BOOST_NOWIDE_DYN_LINK=1
|
||||
<link>static:<define>BOOST_NOWIDE_STATIC_LINK=1
|
||||
;
|
||||
|
||||
boost-install boost_system ;
|
||||
boost-install boost_nowide ;
|
||||
|
||||
@@ -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<int>(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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,29 @@
|
||||
# See library home page at http://www.boost.org/libs/system
|
||||
|
||||
project
|
||||
#: requirements <library>/boost/nowide//boost_nowide
|
||||
;
|
||||
|
||||
test-suite "nowide"
|
||||
: [ run test_convert.cpp ]
|
||||
[ run test_env.cpp ]
|
||||
[ run test_fstream.cpp ]
|
||||
[ run test_iostream.cpp : : : <library>/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 : :
|
||||
: <toolset>msvc:<linkflags>shell32.lib ]
|
||||
|
||||
[ run test_system.cpp : "-w" :
|
||||
: <toolset>msvc:<linkflags>shell32.lib : test_system_w ]
|
||||
|
||||
[ run test_system.cpp : "-n" :
|
||||
: <toolset>msvc:<linkflags>shell32.lib : test_system_n ]
|
||||
|
||||
[ run test_iostream.cpp : :
|
||||
: <library>/boost/nowide//boost_nowide
|
||||
<link>static
|
||||
: test_iostream_static ]
|
||||
|
||||
[ run test_iostream.cpp : :
|
||||
: <library>/boost/nowide//boost_nowide
|
||||
<link>shared
|
||||
: test_iostream_shared ]
|
||||
;
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
#include <iostream>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <iostream>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
#include <string.h>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/nowide/cenv.hpp>
|
||||
#include <iostream>
|
||||
#include "test.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user