...
 
Commits (4)
......@@ -21,11 +21,11 @@
# INCLUDES=-I/tmp/zlib-win32/include LIBS=/tmp/zlib-win32/lib/libz.a
# to put binaries into separate directory (good for cross-compile), go
# there and try: make -f ..srcdir../Makefile SRCDIR=..srcdir.. where
# ..srcdir.. is the path to the source directory
# there and try: make -f ..srcdir../Makefile where ..srcdir.. is the
# path to the source directory
DESTDIR =
SRCDIR=
SRCDIR := $(dir $(lastword $(MAKEFILE_LIST)))
TARGET1 = fig2sxd$(EXE)
HEADERS1 = colors.h misc.h styles.h xfigobjects.h xmlwrite.h vector2.h \
......
......@@ -291,21 +291,29 @@ static void read_file( istream& figfile )
}
// read justification
#ifdef UNUSED_VARIABLES
enum { Center, FlushLeft } justification = Center;
#endif
skip_comment( figfile );
getline( figfile, linebuf );
if( linebuf == "Flush left" ) {
#ifdef UNUSED_VARIABLES
justification = FlushLeft;
#endif
} else if( linebuf != "Center" ) {
fail( "Bad justification." );
}
// read units
#ifdef UNUSED_VARIABLES
enum { Metric, Inches } units = Metric;
#endif
skip_comment( figfile );
getline( figfile, linebuf );
if( linebuf == "Inches" ) {
#ifdef UNUSED_VARIABLES
units = Inches;
#endif
} else if( linebuf != "Metric" ) {
fail( "Bad units." );
}
......@@ -329,10 +337,14 @@ static void read_file( istream& figfile )
// read multipageness
skip_comment( figfile );
#ifdef UNUSED_VARIABLES
enum { Single, Multiple } multipage = Single;
#endif
getline( figfile, linebuf );
if( linebuf == "Multiple" ) {
#ifdef UNUSED_VARIABLES
multipage = Multiple;
#endif
} else if( linebuf != "Single" ) {
fail( "Bad multipageness." );
}
......
......@@ -60,7 +60,7 @@ WriterBuf::~WriterBuf()
{
if( buf ) {
sync();
delete buf;
delete[] buf;
}
}
......@@ -89,7 +89,10 @@ int WriterBuf::sync()
ostream& write2( ostream& out, unsigned short s )
{
unsigned char bytes[2] = { (s&0xff), ((s>>8)&0xff) };
unsigned char bytes[2] = {
static_cast<unsigned char>(s&0xff),
static_cast<unsigned char>((s>>8)&0xff)
};
out.write( (const char*)bytes, 2 );
return out;
}
......@@ -97,7 +100,10 @@ ostream& write2( ostream& out, unsigned short s )
ostream& write4( ostream& out, unsigned int i )
{
unsigned char bytes[4] = {
(i&0xff), ((i>>8)&0xff), ((i>>16)&0xff), ((i>>24)&0xff)
static_cast<unsigned char>(i&0xff),
static_cast<unsigned char>((i>>8)&0xff),
static_cast<unsigned char>((i>>16)&0xff),
static_cast<unsigned char>((i>>24)&0xff)
};
out.write( (const char*)bytes, 4 );
return out;
......