summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStef <stef@ws.local>2004-03-31 22:25:56 +0000
committerStef <stef@ws.local>2004-03-31 22:25:56 +0000
commit5c2430e6896de2139bf8e5e467dd3a6ba527f46a (patch)
tree1a34083f59731ddb2201ab2aaa74f65257496acb /src
parent2071258e2c4108ca5bd67a2ffc358a0fddc739b6 (diff)
Changes for FreeBSD compatibility
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am39
-rw-r--r--src/rtfparser.h5
-rw-r--r--src/usuals.h12
-rw-r--r--src/xmlcomposehelpers.h5
-rw-r--r--src/xmlcomposer.cpp15
5 files changed, 23 insertions, 53 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 81120ec..9a7efde 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,47 +1,10 @@
-#
-# Copyright (c) 2004, Nate Nielsen
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the
-# following disclaimer.
-# * Redistributions in binary form must reproduce the
-# above copyright notice, this list of conditions and
-# the following disclaimer in the documentation and/or
-# other materials provided with the distribution.
-# * The names of contributors to this software may not be
-# used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-# DAMAGE.
-#
-#
-# CONTRIBUTORS
-# Nate Nielsen <nielsen@memberwebs.com>
-#
-#
bin_PROGRAMS = rtfm
rtfm_SOURCES = rtfm.cpp basehandler.cpp basehandler.h levelhandler.cpp levelhandler.h \
reference.h rtfanalyser.cpp rtfanalyser.h rtfparsehelpers.cpp rtfformatting.h \
rtfparsehelpers.h rtfreader.cpp rtfreader.h sablo.h sablotr.cpp usuals.h
-rtfm_LDADD = -lsablot
+rtfm_LDADD = -lsablot -lexpat $(LIB_ICONV)
rtfm_CFLAGS = -O0 -I${top_srcdir} -I/usr/local/include
rtfm_LDFLAGS = -L/usr/local/lib
man_MANS = rtfm.1
diff --git a/src/rtfparser.h b/src/rtfparser.h
index f5983e5..bfa2e59 100644
--- a/src/rtfparser.h
+++ b/src/rtfparser.h
@@ -39,10 +39,9 @@
#ifndef __RTFREADER_H__
#define __RTFREADER_H__
-#include <string>
+#include "usuals.h"
#include <stack>
-using std::string;
-using std::wstring;
+#include <stdio.h>
class RtfReader;
diff --git a/src/usuals.h b/src/usuals.h
index fcc696d..8a58660 100644
--- a/src/usuals.h
+++ b/src/usuals.h
@@ -42,7 +42,19 @@
#define NULL 0
#endif
+#include "config.h"
+
#include <stdlib.h>
#include <assert.h>
+#include <wchar.h>
+#include <string>
+using std::string;
+
+#if HAVE_WSTRING
+using std::wstring;
+#else
+typedef std::basic_string<wchar_t> wstring;
+#endif
+
#endif // __USUALS_H__
diff --git a/src/xmlcomposehelpers.h b/src/xmlcomposehelpers.h
index 7769d91..b901039 100644
--- a/src/xmlcomposehelpers.h
+++ b/src/xmlcomposehelpers.h
@@ -39,14 +39,11 @@
#ifndef __RTFPARSEHELPERS_H__
#define __RTFPARSEHELPERS_H__
+#include "usuals.h"
#include "reference.h"
#include "sablo.h"
#include "rtfformatting.h"
-#include <string>
-using std::wstring;
-using std::string;
-
class RtfParser;
class Destination :
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index b0643e2..80d45af 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -1044,16 +1044,15 @@ bool RtfParser::isEqualElement(const DOM::Element& el1, const DOM::Element& el2)
wstring RtfParser::formatInt(int num)
{
- wchar_t buff[12];
+ char buff[16];
- // The Win32 version isn't secure
-#ifdef _WIN32
- swprintf(buff, L"%d", num);
-#else
- swprintf(buff, 12, L"%d", num);
-#endif
+ // Certain OSs don't support swprintf :(
+ sprintf(buff, "%d", num);
+
+ wstring n;
+ for(char* s = buff; *s; s++)
+ n.append(1, *s);
- wstring n(buff);
return n;
}