lib: fix win32 issues

This commit is contained in:
itsmattkc 2022-07-18 09:49:27 -07:00
parent 5bc8dbfd42
commit 180ead8188
4 changed files with 26 additions and 6 deletions

View file

@ -49,18 +49,18 @@ Interleaf::Error Interleaf::Write(const char *f) const
#ifdef _WIN32
Interleaf::Error Interleaf::Read(const wchar_t *f)
{
std::istream is(f);
std::ifstream is(f);
if (!is.is_open() || !is.good()) {
return false;
return ERROR_IO;
}
return Read(is);
}
Interleaf::Error Interleaf::Write(const wchar_t *f) const
{
std::ostream os(f);
std::ofstream os(f);
if (!os.is_open() || !os.good()) {
return false;
return ERROR_IO;
}
return Write(os);
}

View file

@ -13,6 +13,26 @@ Object::Object()
id_ = 0;
}
#ifdef _WIN32
bool Object::ReplaceWithFile(const wchar_t *f)
{
std::ifstream is(f);
if (!is.is_open() || !is.good()) {
return false;
}
return ReplaceWithFile(is);
}
bool Object::ExtractToFile(const wchar_t *f) const
{
std::ofstream os(f);
if (!os.is_open() || !os.good()) {
return false;
}
return ExtractToFile(os);
}
#endif
bool Object::ReplaceWithFile(const char *f)
{
std::ifstream is(f);

View file

@ -47,7 +47,7 @@ public:
return std::string((const char *) &u, sizeof(u));
}
static const char *GetTypeDescription(Type t);
LIBWEAVER_EXPORT static const char *GetTypeDescription(Type t);
};

View file

@ -120,7 +120,7 @@ public:
};
LIBWEAVER_EXPORT class memorybuf : public std::streambuf
class memorybuf : public std::streambuf
{
public:
memorybuf(){}