refactoring

This commit is contained in:
Kulikova Svetlana
2021-11-08 18:00:30 +03:00
parent 1c5a0bd0f4
commit fc91e7b9ce
24 changed files with 70 additions and 99 deletions

View File

@ -78,7 +78,7 @@
#include "DjVuMessage.h"
#include <fcntl.h>
#if defined(WIN32) || defined(__CYGWIN32__)
#ifndef WASM_MODE
#ifndef BUILDING_WASM_MODULE
# include <io.h>
#endif
#endif
@ -127,7 +127,7 @@ namespace DJVU {
const char *ByteStream::EndOfFile=ERR_MSG("EOF");
#ifndef WASM_MODE
#ifndef BUILDING_WASM_MODULE
/** 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#.
@ -184,7 +184,7 @@ ByteStream::Stdio::init(FILE * const f,const char mode[],const bool closeme)
must_close=closeme;
return init(mode);
}
#endif
#endif // BUILDING_WASM_MODULE
/** ByteStream interface managing a memory buffer.
@ -584,7 +584,7 @@ ByteStream::read32()
}
#ifndef WASM_MODE
#ifndef BUILDING_WASM_MODULE
//// CLASS ByteStream::Stdio
ByteStream::Stdio::Stdio(void)
@ -786,7 +786,7 @@ ByteStream::Stdio::seek(long offset, int whence, bool nothrow)
}
return tell();
}
#endif
#endif // BUILDING_WASM_MODULE
@ -1005,7 +1005,7 @@ ByteStream::create(void const * const buffer, const size_t size)
return retval;
}
#ifndef WASM_MODE
#ifndef BUILDING_WASM_MODULE
GP<ByteStream>
ByteStream::create(const GURL &url,char const * const xmode)
{
@ -1190,7 +1190,7 @@ ByteStream::create(FILE * const f,char const * const mode,const bool closeme)
{
return NULL;
}
#endif
#endif // BUILDING_WASM_MODULE
GP<ByteStream>
ByteStream::create_static(const void * buffer, size_t sz)

View File

@ -406,11 +406,11 @@ GLParser::skip_white_space(const char * & start)
{
while(*start && isspace(*start)) start++;
if (!*start)
#ifdef WASM_MODE
#ifdef BUILDING_WASM_MODULE
return;
#else
#else
G_THROW( ByteStream::EndOfFile );
#endif
#endif
}
GLToken
@ -505,11 +505,11 @@ GLParser::get_token(const char * & start)
{
char ch=*start++;
if (!ch)
#ifdef WASM_MODE
#ifdef BUILDING_WASM_MODULE
return GLToken(GLToken::CLOSE_PAR, 0);
#else
#else
G_THROW( ByteStream::EndOfFile );
#endif
#endif
if (ch==')') { start--; break; }
if (isspace(ch)) break;
str+=ch;

View File

@ -78,7 +78,7 @@
#include "debug.h"
#if defined(__linux__) || defined(LINUX) || defined(WASM_MODE)
#if defined(__linux__) || defined(LINUX) || defined(BUILDING_WASM_MODULE)
typedef unsigned int UINT;
#endif

View File

@ -1608,7 +1608,7 @@ GStringRep::setat(int n, char ch) const
return retval;
}
#ifndef WASM_MODE
#ifndef BUILDING_WASM_MODULE
#if defined(AUTOCONF) && defined(HAVE_VSNPRINTF)
# define USE_VSNPRINTF vsnprintf
#elif defined(WIN32) && !defined(__CYGWIN32__)

View File

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

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) && !defined(WASM_MODE)
# if defined(_MSC_VER) && !defined(BUILDING_WASM_MODULE)
// 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

@ -70,7 +70,6 @@
#include "GThreads.h"
#include "GContainer.h"
#include "DjVuGString.h"
#include "DjVuGString.h"
#include "ByteStream.h"
#include "GURL.h"