1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

fix build on CYGWIN

This commit is contained in:
Lu Wang 2012-09-11 00:45:00 +08:00
parent 6cb77ab57f
commit a8d0fd83d0
2 changed files with 17 additions and 15 deletions

View File

@ -50,10 +50,16 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-function")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
# CYGWIN bug
if(CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=gnu++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
endif()
configure_file (${CMAKE_SOURCE_DIR}/src/include/pdf2htmlEX-config.h.in ${CMAKE_SOURCE_DIR}/src/include/pdf2htmlEX-config.h)
add_executable(pdf2htmlEX

View File

@ -10,6 +10,7 @@
#ifndef UTIL_H__
#define UTIL_H__
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
@ -19,11 +20,6 @@
#include <UTF8.h>
using std::istream;
using std::ostream;
using std::max;
using std::abs;
#ifndef nullptr
#define nullptr (NULL)
#endif
@ -133,10 +129,10 @@ class base64stream
{
public:
base64stream(istream & in) : in(&in) { }
base64stream(istream && in) : in(&in) { }
base64stream(std::istream & in) : in(&in) { }
base64stream(std::istream && in) : in(&in) { }
ostream & dumpto(ostream & out)
std::ostream & dumpto(std::ostream & out)
{
unsigned char buf[3];
while(in->read((char*)buf, 3))
@ -170,12 +166,12 @@ public:
}
private:
istream * in;
std::istream * in;
static const char * base64_encoding;
};
static inline ostream & operator << (ostream & out, base64stream & bf) { return bf.dumpto(out); }
static inline ostream & operator << (ostream & out, base64stream && bf) { return bf.dumpto(out); }
static inline std::ostream & operator << (std::ostream & out, base64stream & bf) { return bf.dumpto(out); }
static inline std::ostream & operator << (std::ostream & out, base64stream && bf) { return bf.dumpto(out); }
class string_formatter
{
@ -200,13 +196,13 @@ public:
va_list vlist;
va_start(vlist, format);
int l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
int l = std::vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
if(l >= (int)buf.capacity())
{
buf.reserve(max((long)(l+1), (long)buf.capacity() * 2));
buf.reserve(std::max((long)(l+1), (long)buf.capacity() * 2));
va_start(vlist, format);
l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
l = std::vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
}
assert(l >= 0); // we should fail when vsnprintf fail