prepare zipios++ for unicode support

This commit is contained in:
wmayer
2017-10-25 20:43:02 +02:00
parent c2fa8d02b4
commit 6a3e552657
2 changed files with 12 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include "zipios_defs.h"
#include "backbuffer.h"
#include <Base/FileInfo.h>
namespace zipios {
@@ -33,7 +34,12 @@ ZipFile::ZipFile( const string &name , int s_off, int e_off
_filename = name ;
#if _WIN32
std::wstring wsname = Base::FileInfo(name).toStdWString();
ifstream _zipfile( wsname.c_str(), ios::in | ios::binary ) ;
#else
ifstream _zipfile( name.c_str(), ios::in | ios::binary ) ;
#endif
init( _zipfile ) ;
}

View File

@@ -5,6 +5,7 @@
#include "zipinputstreambuf.h"
#include "zipinputstream.h"
#include <Base/FileInfo.h>
using std::istream;
@@ -24,7 +25,12 @@ ZipInputStream::ZipInputStream( const std::string &filename, std::streampos pos
: std::istream( 0 ),
ifs( 0 )
{
#if _WIN32
std::wstring wsname = Base::FileInfo(filename).toStdWString();
ifs = new std::ifstream( wsname.c_str(), std::ios::in |std:: ios::binary ) ;
#else
ifs = new std::ifstream( filename.c_str(), std::ios::in |std:: ios::binary ) ;
#endif
izf = new ZipInputStreambuf( ifs->rdbuf(), pos ) ;
// this->rdbuf( izf ) ; is replaced by:
this->init( izf ) ;