Developing...

This commit is contained in:
Oleg Korshul
2021-07-04 22:10:17 +03:00
parent 0fb91dc2f8
commit 04b9c9ae1d
21 changed files with 3702 additions and 9 deletions

View File

@ -78,8 +78,10 @@
#include "DjVuMessage.h"
#include <fcntl.h>
#if defined(WIN32) || defined(__CYGWIN32__)
#ifndef WASM_MODE
# include <io.h>
#endif
#endif
#ifdef UNIX
# ifndef HAS_MEMMAP
@ -125,6 +127,7 @@ namespace DJVU {
const char *ByteStream::EndOfFile=ERR_MSG("EOF");
#ifndef WASM_MODE
/** ByteStream interface for stdio files.
The virtual member functions #read#, #write#, #tell# and #seek# are mapped
to the well known stdio functions #fread#, #fwrite#, #ftell# and #fseek#.
@ -181,6 +184,7 @@ ByteStream::Stdio::init(FILE * const f,const char mode[],const bool closeme)
must_close=closeme;
return init(mode);
}
#endif
/** ByteStream interface managing a memory buffer.
@ -580,7 +584,7 @@ ByteStream::read32()
}
#ifndef WASM_MODE
//// CLASS ByteStream::Stdio
ByteStream::Stdio::Stdio(void)
@ -782,7 +786,7 @@ ByteStream::Stdio::seek(long offset, int whence, bool nothrow)
}
return tell();
}
#endif
@ -1001,6 +1005,7 @@ ByteStream::create(void const * const buffer, const size_t size)
return retval;
}
#ifndef WASM_MODE
GP<ByteStream>
ByteStream::create(const GURL &url,char const * const xmode)
{
@ -1161,6 +1166,31 @@ ByteStream::create(FILE * const f,char const * const mode,const bool closeme)
}
return retval;
}
#else
GP<ByteStream>
ByteStream::create(const GURL &url,char const * const xmode)
{
return NULL;
}
GP<ByteStream>
ByteStream::create(char const * const mode)
{
return NULL;
}
GP<ByteStream>
ByteStream::create(const int fd,char const * const mode,const bool closeme)
{
return NULL;
}
GP<ByteStream>
ByteStream::create(FILE * const f,char const * const mode,const bool closeme)
{
return NULL;
}
#endif
GP<ByteStream>
ByteStream::create_static(const void * buffer, size_t sz)

View File

@ -75,9 +75,11 @@ inline void * operator new(size_t, void * ptr) { return ptr; }
# include <new>
#endif
#ifndef WASM_MODE
#ifdef WIN32
#include <new.h>
#endif
#endif
//#ifdef WIN32
//# ifdef DLL_EXPORT

View File

@ -78,11 +78,6 @@
#include <string.h>
#include <stdlib.h>
// #include <stdio.h>
#ifdef WIN32
#include <tchar.h>
#include <windows.h>
#include <winreg.h>
#endif
#ifdef UNIX
#include <unistd.h>
#include <pwd.h>

View File

@ -259,7 +259,7 @@ GExceptionHandler::rethrow(void)
// This is not activated when C++ memory management
// is overidden. The overriding functions handle
// memory exceptions by themselves.
# if defined(_MSC_VER)
# if defined(_MSC_VER) && !defined(WASM_MODE)
// Microsoft is different!
static int throw_memory_error(size_t) { G_THROW(GException::outofmemory); return 0; }
static int (*old_handler)(size_t) = _set_new_handler(throw_memory_error);

View File

@ -1608,6 +1608,7 @@ GStringRep::setat(int n, char ch) const
return retval;
}
#ifndef WASM_MODE
#if defined(AUTOCONF) && defined(HAVE_VSNPRINTF)
# define USE_VSNPRINTF vsnprintf
#elif defined(WIN32) && !defined(__CYGWIN32__)
@ -1615,6 +1616,7 @@ GStringRep::setat(int n, char ch) const
#elif defined(linux)
# define USE_VSNPRINTF vsnprintf
#endif
#endif
GUTF8String &
GUTF8String::format(const char fmt[], ... )

View File

@ -115,7 +115,6 @@
#include <stdlib.h>
#include <stdarg.h>
#ifdef WIN32
# include <windows.h>
# define HAS_WCHAR 1
# define HAS_MBSTATE 1
#endif