Fixed compilation problems on Solaris 9.

This commit is contained in:
Vincent Richard 2005-03-16 17:13:08 +00:00
parent 27715ddef8
commit 2ca56a209f
19 changed files with 94 additions and 89 deletions

View File

@ -2,6 +2,10 @@
VERSION 0.6.4cvs
================
2005-03-16 Vincent Richard <vincent@vincent-richard.net>
* Fixed compilation problems on Solaris 9.
2005-03-15 Vincent Richard <vincent@vincent-richard.net>
* tests/parser/textTest.cpp: added more unit tests for 'text' class.

View File

@ -1463,7 +1463,8 @@ fi
configure_in.write('AC_TRY_COMPILE(,,echo yes,echo no; EXTRA_CFLAGS="$OLD_EXTRA_CFLAGS")\n\n')
configure_in.write("""
EXTRA_CFLAGS=`echo $EXTRA_CFLAGS | sed -e 's| |\\n|g' | sort | uniq | tr '\\n' ' '`
#EXTRA_CFLAGS=`echo $EXTRA_CFLAGS | sed -e 's| |\\n|g' | sort | uniq | tr '\\n' ' '`
EXTRA_CFLAGS=`echo $EXTRA_CFLAGS | tr '\\n' ' ' | sort | uniq | tr '\\n' ' '`
EXTRA_LIBS=`echo $EXTRA_LIBS | sed -e 's|^ ||g' | sed -e 's| | |g'`
AC_SUBST(CFLAGS)

View File

@ -74,7 +74,7 @@ address* address::parseNext(const string& buffer, const string::size_type positi
string::size_type pos = position;
while (pos < end && parserHelpers::isspace(buffer[pos]))
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
const string::size_type start = pos;

View File

@ -109,7 +109,7 @@ void body::parse(const string& buffer, const string::size_type position,
// characters from a set of characters known to be very
// robust through email gateways, and NOT ending with
// white space..."
while (pos != start && parserHelpers::isspace(buffer[pos - 1]))
while (pos != start && parserHelpers::isSpace(buffer[pos - 1]))
--pos;
boundary = string(buffer.begin() + start,

View File

@ -70,22 +70,22 @@ void datetime::parse(const string& buffer, const string::size_type position,
const string::value_type* p = buffer.data() + position;
// Parse the date and time value
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend)
{
if (parserHelpers::isalpha(*p))
if (parserHelpers::isAlpha(*p))
{
// Ignore week day
while (p < pend && parserHelpers::isalpha(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isAlpha(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend && *p == ',') ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
while (p < pend && !parserHelpers::isdigit(*p)) ++p;
while (p < pend && !parserHelpers::isDigit(*p)) ++p;
if (p < pend && parserHelpers::isdigit(*p))
if (p < pend && parserHelpers::isDigit(*p))
{
// Month day
int day = 0;
@ -95,23 +95,23 @@ void datetime::parse(const string& buffer, const string::size_type position,
day = day * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
m_day = (day >= 1 && day <= 31) ? day : 1;
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
else
{
m_day = 1;
// Skip everything to the next field
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
if (p < pend && parserHelpers::isalpha(*p))
if (p < pend && parserHelpers::isAlpha(*p))
{
// Month
char_t month[4] = { 0 };
@ -122,9 +122,9 @@ void datetime::parse(const string& buffer, const string::size_type position,
month[monthLength++] = *p;
++p;
}
while (monthLength < 3 && p < pend && parserHelpers::isalpha(*p));
while (monthLength < 3 && p < pend && parserHelpers::isAlpha(*p));
while (p < pend && parserHelpers::isalpha(*p)) ++p;
while (p < pend && parserHelpers::isAlpha(*p)) ++p;
switch (month[0])
{
@ -208,19 +208,19 @@ void datetime::parse(const string& buffer, const string::size_type position,
}
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
else
{
m_month = JANUARY;
// Skip everything to the next field
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
if (p < pend && parserHelpers::isdigit(*p))
if (p < pend && parserHelpers::isDigit(*p))
{
// Year
int year = 0;
@ -230,25 +230,25 @@ void datetime::parse(const string& buffer, const string::size_type position,
year = year * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
if (year < 70) m_year = year + 2000;
else if (year < 1000) m_year = year + 1900;
else m_year = year;
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
else
{
m_year = 1970;
// Skip everything to the next field
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
if (p < pend && parserHelpers::isdigit(*p))
if (p < pend && parserHelpers::isDigit(*p))
{
// Hour
int hour = 0;
@ -258,19 +258,19 @@ void datetime::parse(const string& buffer, const string::size_type position,
hour = hour * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
m_hour = (hour >= 0 && hour <= 23) ? hour : 0;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend && *p == ':')
{
++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend && parserHelpers::isdigit(*p))
if (p < pend && parserHelpers::isDigit(*p))
{
// Minute
int minute = 0;
@ -280,19 +280,19 @@ void datetime::parse(const string& buffer, const string::size_type position,
minute = minute * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
m_minute = (minute >= 0 && minute <= 59) ? minute : 0;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend && *p == ':')
{
++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend && parserHelpers::isdigit(*p))
if (p < pend && parserHelpers::isDigit(*p))
{
// Second
int second = 0;
@ -302,12 +302,12 @@ void datetime::parse(const string& buffer, const string::size_type position,
second = second * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
m_second = (second >= 0 && second <= 59) ? second : 0;
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
else
{
@ -334,11 +334,11 @@ void datetime::parse(const string& buffer, const string::size_type position,
m_hour = 0;
// Skip everything to the next field
while (p < pend && !parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && !parserHelpers::isSpace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
if (p + 1 < pend && (*p == '+' || *p == '-') && parserHelpers::isdigit(*(p + 1)))
if (p + 1 < pend && (*p == '+' || *p == '-') && parserHelpers::isDigit(*(p + 1)))
{
const char_t sign = *p;
++p;
@ -351,7 +351,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
offset = offset * 10 + (*p - '0');
++p;
}
while (p < pend && parserHelpers::isdigit(*p));
while (p < pend && parserHelpers::isDigit(*p));
const int hourOff = offset / 100;
const int minOff = offset % 100;
@ -374,7 +374,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
zone[zoneLength++] = *p;
++p;
}
while (zoneLength < 3 && p < pend && parserHelpers::isdigit(*p));
while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
switch (zone[0])
{
@ -495,7 +495,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
::vmime::end(offsetMapInit));
Map::const_iterator pos =
offsetMap.find(parserHelpers::tolower(z));
offsetMap.find(parserHelpers::toLower(z));
if (pos != offsetMap.end())
m_zone = (*pos).second;

View File

@ -205,7 +205,7 @@ const utility::stream::size_type encoderB64::decode(utility::inputStream& in, ut
{
const unsigned char c = buffer[bufferPos++];
if (!parserHelpers::isspace(c))
if (!parserHelpers::isSpace(c))
bytes[count++] = c;
}
@ -221,7 +221,7 @@ const utility::stream::size_type encoderB64::decode(utility::inputStream& in, ut
{
const unsigned char c = buffer[bufferPos++];
if (!parserHelpers::isspace(c))
if (!parserHelpers::isSpace(c))
bytes[count++] = c;
}
}

View File

@ -173,7 +173,7 @@ const utility::stream::size_type encoderUUE::decode(utility::inputStream& in, ut
inBuffer[1] == 'g' &&
inBuffer[2] == 'i' &&
inBuffer[3] == 'n' &&
parserHelpers::isspace(inBuffer[4]))
parserHelpers::isSpace(inBuffer[4]))
{
utility::stream::value_type c = 0;
@ -201,15 +201,15 @@ const utility::stream::size_type encoderUUE::decode(utility::inputStream& in, ut
utility::stream::value_type* p = buffer;
while (*p && parserHelpers::isspace(*p)) ++p;
while (*p && parserHelpers::isSpace(*p)) ++p;
utility::stream::value_type* modeStart = buffer;
while (*p && !parserHelpers::isspace(*p)) ++p;
while (*p && !parserHelpers::isSpace(*p)) ++p;
getResults()["mode"] = string(modeStart, p);
while (*p && parserHelpers::isspace(*p)) ++p;
while (*p && parserHelpers::isSpace(*p)) ++p;
utility::stream::value_type* filenameStart = buffer;

View File

@ -97,11 +97,11 @@ headerField* headerField::parseNext(const string& buffer, const string::size_typ
}
// This line may be a field description
if (!parserHelpers::isspace(c))
if (!parserHelpers::isSpace(c))
{
const string::size_type nameStart = pos; // remember the start position of the line
while (pos < end && (buffer[pos] != ':' && !parserHelpers::isspace(buffer[pos])))
while (pos < end && (buffer[pos] != ':' && !parserHelpers::isSpace(buffer[pos])))
++pos;
const string::size_type nameEnd = pos;

View File

@ -69,7 +69,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
const string::value_type* p = pstart;
// Ignore blank spaces at the beginning
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
// Current state for parsing machine
enum States
@ -161,12 +161,12 @@ void mailbox::parse(const string& buffer, const string::size_type position,
{
// Erase any space between display name and <address>
string::iterator q = name.end();
for ( ; q != name.begin() && parserHelpers::isspace(*(q - 1)) ; --q);
for ( ; q != name.begin() && parserHelpers::isSpace(*(q - 1)) ; --q);
name.erase(q, name.end());
break;
}
else if (/* parserHelpers::isspace(*p) || */ *p == '@')
else if (/* parserHelpers::isSpace(*p) || */ *p == '@')
{
break;
}
@ -213,7 +213,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
{
++comment;
}
else if (parserHelpers::isspace(*p))
else if (parserHelpers::isSpace(*p))
{
break;
}
@ -229,7 +229,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
}
else
{
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
state = State_None;
}
}
@ -278,7 +278,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
{
break;
}
else if (!parserHelpers::isspace(*p))
else if (!parserHelpers::isSpace(*p))
{
address += *p;
}
@ -290,7 +290,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
}
else
{
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
if (p < pend)
{
@ -310,7 +310,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
for (string::size_type i = 0 ; i < name.size() ; ++i)
{
if (!parserHelpers::isspace(name[i]))
if (!parserHelpers::isSpace(name[i]))
m_email += name[i];
}
}
@ -322,7 +322,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
for (string::size_type i = 0 ; i < address.size() ; ++i)
{
if (!parserHelpers::isspace(address[i]))
if (!parserHelpers::isSpace(address[i]))
m_email += address[i];
}
}

View File

@ -57,7 +57,7 @@ void mailboxGroup::parse(const string& buffer, const string::size_type position,
const string::value_type* const pstart = buffer.data() + position;
const string::value_type* p = pstart;
while (p < pend && parserHelpers::isspace(*p))
while (p < pend && parserHelpers::isSpace(*p))
++p;
string name;

View File

@ -206,7 +206,7 @@ void url::parse(const string& str)
for (string::const_iterator it = port.begin() ;
onlyDigit && it != port.end() ; ++it)
{
onlyDigit = parserHelpers::isdigit(*it);
onlyDigit = parserHelpers::isDigit(*it);
}
if (!onlyDigit)

View File

@ -34,7 +34,7 @@ const string urlUtils::encode(const string& s)
{
const char_t c = *it;
if (parserHelpers::isprint(c) && c != '%')
if (parserHelpers::isPrint(c) && c != '%')
{
result += c;
}

View File

@ -78,7 +78,7 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
// Skip ';'
++p;
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
const string::size_type attrStart = position + (p - pstart);
@ -98,14 +98,14 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
// Extract the attribute name
string::size_type attrEnd = position + (p - pstart);
while (attrEnd != attrStart && parserHelpers::isspace(buffer[attrEnd - 1]))
while (attrEnd != attrStart && parserHelpers::isSpace(buffer[attrEnd - 1]))
--attrEnd;
// Skip '='
++p;
// Skip white-spaces between '=' and the value
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
// Extract the value
string value;
@ -173,7 +173,7 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
string::size_type valEnd = position + (p - pstart);
while (valEnd != valStart && parserHelpers::isspace(buffer[valEnd - 1]))
while (valEnd != valStart && parserHelpers::isSpace(buffer[valEnd - 1]))
--valEnd;
value = string(buffer.begin() + valStart,
@ -194,7 +194,7 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
}
// Skip white-spaces after this parameter
while (p < pend && parserHelpers::isspace(*p)) ++p;
while (p < pend && parserHelpers::isSpace(*p)) ++p;
}
}
}

View File

@ -83,7 +83,7 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port
throw vmime::exceptions::connection_error("Cannot resolve address.");
}
bcopy(hostInfo->h_addr, reinterpret_cast <char*>(&addr.sin_addr), hostInfo->h_length);
::memcpy(reinterpret_cast <char*>(&addr.sin_addr), hostInfo->h_addr, hostInfo->h_length);
}
// Get a new socket

View File

@ -93,7 +93,7 @@ void propertySet::parse(const string& props)
for ( ; pos != end ; )
{
// Skip white-spaces
for ( ; pos != end && parserHelpers::isspace(*pos) ; ++pos);
for ( ; pos != end && parserHelpers::isSpace(*pos) ; ++pos);
if (pos != end)
{
@ -110,7 +110,7 @@ void propertySet::parse(const string& props)
string::const_iterator optEnd = pos;
for ( ; optEnd != optStart && parserHelpers::isspace(*(optEnd - 1)) ; --optEnd);
for ( ; optEnd != optStart && parserHelpers::isSpace(*(optEnd - 1)) ; --optEnd);
const string option(optStart, optEnd);
string value = "1";
@ -120,7 +120,7 @@ void propertySet::parse(const string& props)
++pos; // skip '='
// Extract the value
for ( ; pos != end && parserHelpers::isspace(*pos) ; ++pos);
for ( ; pos != end && parserHelpers::isSpace(*pos) ; ++pos);
if (pos != end)
{
@ -159,7 +159,7 @@ void propertySet::parse(const string& props)
{
const string::const_iterator valStart = pos;
for ( ; pos != end && !parserHelpers::isspace(*pos) ; ++pos);
for ( ; pos != end && !parserHelpers::isSpace(*pos) ; ++pos);
value = string(valStart, pos);
}

View File

@ -265,7 +265,7 @@ text* text::newFromString(const string& in, const charset& ch, text* generateInE
for ( ; ; )
{
if (p == end || parserHelpers::isspace(*p))
if (p == end || parserHelpers::isSpace(*p))
{
if (p != end)
++p;
@ -310,7 +310,7 @@ text* text::newFromString(const string& in, const charset& ch, text* generateInE
is8bit = false;
start = p;
}
else if (!parserHelpers::isascii(*p))
else if (!parserHelpers::isAscii(*p))
{
is8bit = true;
++p;

View File

@ -94,8 +94,8 @@ const string stringUtils::trim(const string& str)
if (b != e)
{
for ( ; b != e && parserHelpers::isspace(*b) ; ++b);
for ( ; e != b && parserHelpers::isspace(*(e - 1)) ; --e);
for ( ; b != e && parserHelpers::isSpace(*b) ; ++b);
for ( ; e != b && parserHelpers::isSpace(*(e - 1)) ; --e);
}
return (string(b, e));
@ -109,7 +109,7 @@ const string::size_type stringUtils::countASCIIchars
for (string::const_iterator i = begin ; i != end ; ++i)
{
if (parserHelpers::isascii(*i))
if (parserHelpers::isAscii(*i))
{
if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
++count;

View File

@ -67,7 +67,7 @@ word* word::parseNext(const string& buffer, const string::size_type position,
// - before the first word
// - between two encoded words
// - after the last word
while (pos < end && parserHelpers::isspace(buffer[pos]))
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
string::size_type startPos = pos;
@ -84,7 +84,7 @@ word* word::parseNext(const string& buffer, const string::size_type position,
if (pos > position && buffer[pos - 1] == '\r')
--endPos;
while (pos != end && parserHelpers::isspace(buffer[pos]))
while (pos != end && parserHelpers::isSpace(buffer[pos]))
++pos;
unencoded += string(buffer.begin() + startPos, buffer.begin() + endPos);

View File

@ -36,25 +36,25 @@ class parserHelpers
{
public:
static const bool isspace(const char_t c)
static const bool isSpace(const char_t c)
{
return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
}
static const bool isdigit(const char_t c)
static const bool isDigit(const char_t c)
{
return (c >= '0' && c <= '9');
}
static const bool isalpha(const char_t c)
static const bool isAlpha(const char_t c)
{
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}
static const char_t tolower(const char_t c)
static const char_t toLower(const char_t c)
{
if (c >= 'A' && c <= 'Z')
return ('a' + (c - 'A'));
@ -65,7 +65,7 @@ public:
// Checks whether a character is in the 7-bit US-ASCII charset
static const bool isascii(const char_t c)
static const bool isAscii(const char_t c)
{
const unsigned int x = static_cast <unsigned int>(c);
return (x <= 127);
@ -74,7 +74,7 @@ public:
// Checks whether a character has a visual representation
static const bool isprint(const char_t c)
static const bool isPrint(const char_t c)
{
const unsigned int x = static_cast <unsigned int>(c);
return (x >= 0x20 && x <= 0x7E);