Fixed compilation problems on Solaris 9.
This commit is contained in:
parent
27715ddef8
commit
2ca56a209f
@ -2,6 +2,10 @@
|
|||||||
VERSION 0.6.4cvs
|
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>
|
2005-03-15 Vincent Richard <vincent@vincent-richard.net>
|
||||||
|
|
||||||
* tests/parser/textTest.cpp: added more unit tests for 'text' class.
|
* tests/parser/textTest.cpp: added more unit tests for 'text' class.
|
||||||
|
@ -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('AC_TRY_COMPILE(,,echo yes,echo no; EXTRA_CFLAGS="$OLD_EXTRA_CFLAGS")\n\n')
|
||||||
|
|
||||||
configure_in.write("""
|
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'`
|
EXTRA_LIBS=`echo $EXTRA_LIBS | sed -e 's|^ ||g' | sed -e 's| | |g'`
|
||||||
|
|
||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
|
@ -74,7 +74,7 @@ address* address::parseNext(const string& buffer, const string::size_type positi
|
|||||||
|
|
||||||
string::size_type pos = position;
|
string::size_type pos = position;
|
||||||
|
|
||||||
while (pos < end && parserHelpers::isspace(buffer[pos]))
|
while (pos < end && parserHelpers::isSpace(buffer[pos]))
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
const string::size_type start = pos;
|
const string::size_type start = pos;
|
||||||
|
@ -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
|
// characters from a set of characters known to be very
|
||||||
// robust through email gateways, and NOT ending with
|
// robust through email gateways, and NOT ending with
|
||||||
// white space..."
|
// white space..."
|
||||||
while (pos != start && parserHelpers::isspace(buffer[pos - 1]))
|
while (pos != start && parserHelpers::isSpace(buffer[pos - 1]))
|
||||||
--pos;
|
--pos;
|
||||||
|
|
||||||
boundary = string(buffer.begin() + start,
|
boundary = string(buffer.begin() + start,
|
||||||
|
@ -70,22 +70,22 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
const string::value_type* p = buffer.data() + position;
|
const string::value_type* p = buffer.data() + position;
|
||||||
|
|
||||||
// Parse the date and time value
|
// Parse the date and time value
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
if (p < pend)
|
if (p < pend)
|
||||||
{
|
{
|
||||||
if (parserHelpers::isalpha(*p))
|
if (parserHelpers::isAlpha(*p))
|
||||||
{
|
{
|
||||||
// Ignore week day
|
// Ignore week day
|
||||||
while (p < pend && parserHelpers::isalpha(*p)) ++p;
|
while (p < pend && parserHelpers::isAlpha(*p)) ++p;
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
if (p < pend && *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
|
// Month day
|
||||||
int day = 0;
|
int day = 0;
|
||||||
@ -95,23 +95,23 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
day = day * 10 + (*p - '0');
|
day = day * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
m_day = (day >= 1 && day <= 31) ? day : 1;
|
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
|
else
|
||||||
{
|
{
|
||||||
m_day = 1;
|
m_day = 1;
|
||||||
|
|
||||||
// Skip everything to the next field
|
// 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
|
// Month
|
||||||
char_t month[4] = { 0 };
|
char_t month[4] = { 0 };
|
||||||
@ -122,9 +122,9 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
month[monthLength++] = *p;
|
month[monthLength++] = *p;
|
||||||
++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])
|
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
|
else
|
||||||
{
|
{
|
||||||
m_month = JANUARY;
|
m_month = JANUARY;
|
||||||
|
|
||||||
// Skip everything to the next field
|
// 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
|
// Year
|
||||||
int year = 0;
|
int year = 0;
|
||||||
@ -230,25 +230,25 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
year = year * 10 + (*p - '0');
|
year = year * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
if (year < 70) m_year = year + 2000;
|
if (year < 70) m_year = year + 2000;
|
||||||
else if (year < 1000) m_year = year + 1900;
|
else if (year < 1000) m_year = year + 1900;
|
||||||
else m_year = year;
|
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
|
else
|
||||||
{
|
{
|
||||||
m_year = 1970;
|
m_year = 1970;
|
||||||
|
|
||||||
// Skip everything to the next field
|
// 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
|
// Hour
|
||||||
int hour = 0;
|
int hour = 0;
|
||||||
@ -258,19 +258,19 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
hour = hour * 10 + (*p - '0');
|
hour = hour * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
m_hour = (hour >= 0 && hour <= 23) ? hour : 0;
|
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 == ':')
|
if (p < pend && *p == ':')
|
||||||
{
|
{
|
||||||
++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
|
// Minute
|
||||||
int minute = 0;
|
int minute = 0;
|
||||||
@ -280,19 +280,19 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
minute = minute * 10 + (*p - '0');
|
minute = minute * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
m_minute = (minute >= 0 && minute <= 59) ? minute : 0;
|
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 == ':')
|
if (p < pend && *p == ':')
|
||||||
{
|
{
|
||||||
++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
|
// Second
|
||||||
int second = 0;
|
int second = 0;
|
||||||
@ -302,12 +302,12 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
second = second * 10 + (*p - '0');
|
second = second * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
m_second = (second >= 0 && second <= 59) ? second : 0;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -334,11 +334,11 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
m_hour = 0;
|
m_hour = 0;
|
||||||
|
|
||||||
// Skip everything to the next field
|
// 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;
|
const char_t sign = *p;
|
||||||
++p;
|
++p;
|
||||||
@ -351,7 +351,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
offset = offset * 10 + (*p - '0');
|
offset = offset * 10 + (*p - '0');
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (p < pend && parserHelpers::isdigit(*p));
|
while (p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
const int hourOff = offset / 100;
|
const int hourOff = offset / 100;
|
||||||
const int minOff = 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;
|
zone[zoneLength++] = *p;
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
while (zoneLength < 3 && p < pend && parserHelpers::isdigit(*p));
|
while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
|
||||||
|
|
||||||
switch (zone[0])
|
switch (zone[0])
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
|
|||||||
::vmime::end(offsetMapInit));
|
::vmime::end(offsetMapInit));
|
||||||
|
|
||||||
Map::const_iterator pos =
|
Map::const_iterator pos =
|
||||||
offsetMap.find(parserHelpers::tolower(z));
|
offsetMap.find(parserHelpers::toLower(z));
|
||||||
|
|
||||||
if (pos != offsetMap.end())
|
if (pos != offsetMap.end())
|
||||||
m_zone = (*pos).second;
|
m_zone = (*pos).second;
|
||||||
|
@ -205,7 +205,7 @@ const utility::stream::size_type encoderB64::decode(utility::inputStream& in, ut
|
|||||||
{
|
{
|
||||||
const unsigned char c = buffer[bufferPos++];
|
const unsigned char c = buffer[bufferPos++];
|
||||||
|
|
||||||
if (!parserHelpers::isspace(c))
|
if (!parserHelpers::isSpace(c))
|
||||||
bytes[count++] = 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++];
|
const unsigned char c = buffer[bufferPos++];
|
||||||
|
|
||||||
if (!parserHelpers::isspace(c))
|
if (!parserHelpers::isSpace(c))
|
||||||
bytes[count++] = c;
|
bytes[count++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ const utility::stream::size_type encoderUUE::decode(utility::inputStream& in, ut
|
|||||||
inBuffer[1] == 'g' &&
|
inBuffer[1] == 'g' &&
|
||||||
inBuffer[2] == 'i' &&
|
inBuffer[2] == 'i' &&
|
||||||
inBuffer[3] == 'n' &&
|
inBuffer[3] == 'n' &&
|
||||||
parserHelpers::isspace(inBuffer[4]))
|
parserHelpers::isSpace(inBuffer[4]))
|
||||||
{
|
{
|
||||||
utility::stream::value_type c = 0;
|
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;
|
utility::stream::value_type* p = buffer;
|
||||||
|
|
||||||
while (*p && parserHelpers::isspace(*p)) ++p;
|
while (*p && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
utility::stream::value_type* modeStart = buffer;
|
utility::stream::value_type* modeStart = buffer;
|
||||||
|
|
||||||
while (*p && !parserHelpers::isspace(*p)) ++p;
|
while (*p && !parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
getResults()["mode"] = string(modeStart, p);
|
getResults()["mode"] = string(modeStart, p);
|
||||||
|
|
||||||
while (*p && parserHelpers::isspace(*p)) ++p;
|
while (*p && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
utility::stream::value_type* filenameStart = buffer;
|
utility::stream::value_type* filenameStart = buffer;
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ headerField* headerField::parseNext(const string& buffer, const string::size_typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This line may be a field description
|
// 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
|
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;
|
++pos;
|
||||||
|
|
||||||
const string::size_type nameEnd = pos;
|
const string::size_type nameEnd = pos;
|
||||||
|
@ -69,7 +69,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
|
|||||||
const string::value_type* p = pstart;
|
const string::value_type* p = pstart;
|
||||||
|
|
||||||
// Ignore blank spaces at the beginning
|
// 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
|
// Current state for parsing machine
|
||||||
enum States
|
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>
|
// Erase any space between display name and <address>
|
||||||
string::iterator q = name.end();
|
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());
|
name.erase(q, name.end());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (/* parserHelpers::isspace(*p) || */ *p == '@')
|
else if (/* parserHelpers::isSpace(*p) || */ *p == '@')
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
|
|||||||
{
|
{
|
||||||
++comment;
|
++comment;
|
||||||
}
|
}
|
||||||
else if (parserHelpers::isspace(*p))
|
else if (parserHelpers::isSpace(*p))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
state = State_None;
|
state = State_None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!parserHelpers::isspace(*p))
|
else if (!parserHelpers::isSpace(*p))
|
||||||
{
|
{
|
||||||
address += *p;
|
address += *p;
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
if (p < pend)
|
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)
|
for (string::size_type i = 0 ; i < name.size() ; ++i)
|
||||||
{
|
{
|
||||||
if (!parserHelpers::isspace(name[i]))
|
if (!parserHelpers::isSpace(name[i]))
|
||||||
m_email += 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)
|
for (string::size_type i = 0 ; i < address.size() ; ++i)
|
||||||
{
|
{
|
||||||
if (!parserHelpers::isspace(address[i]))
|
if (!parserHelpers::isSpace(address[i]))
|
||||||
m_email += address[i];
|
m_email += address[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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* const pstart = buffer.data() + position;
|
||||||
const string::value_type* p = pstart;
|
const string::value_type* p = pstart;
|
||||||
|
|
||||||
while (p < pend && parserHelpers::isspace(*p))
|
while (p < pend && parserHelpers::isSpace(*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
|
@ -206,7 +206,7 @@ void url::parse(const string& str)
|
|||||||
for (string::const_iterator it = port.begin() ;
|
for (string::const_iterator it = port.begin() ;
|
||||||
onlyDigit && it != port.end() ; ++it)
|
onlyDigit && it != port.end() ; ++it)
|
||||||
{
|
{
|
||||||
onlyDigit = parserHelpers::isdigit(*it);
|
onlyDigit = parserHelpers::isDigit(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!onlyDigit)
|
if (!onlyDigit)
|
||||||
|
@ -34,7 +34,7 @@ const string urlUtils::encode(const string& s)
|
|||||||
{
|
{
|
||||||
const char_t c = *it;
|
const char_t c = *it;
|
||||||
|
|
||||||
if (parserHelpers::isprint(c) && c != '%')
|
if (parserHelpers::isPrint(c) && c != '%')
|
||||||
{
|
{
|
||||||
result += c;
|
result += c;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
|
|||||||
// Skip ';'
|
// Skip ';'
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
const string::size_type attrStart = position + (p - pstart);
|
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
|
// Extract the attribute name
|
||||||
string::size_type attrEnd = position + (p - pstart);
|
string::size_type attrEnd = position + (p - pstart);
|
||||||
|
|
||||||
while (attrEnd != attrStart && parserHelpers::isspace(buffer[attrEnd - 1]))
|
while (attrEnd != attrStart && parserHelpers::isSpace(buffer[attrEnd - 1]))
|
||||||
--attrEnd;
|
--attrEnd;
|
||||||
|
|
||||||
// Skip '='
|
// Skip '='
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
// Skip white-spaces between '=' and the value
|
// Skip white-spaces between '=' and the value
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
|
|
||||||
// Extract the value
|
// Extract the value
|
||||||
string value;
|
string value;
|
||||||
@ -173,7 +173,7 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
|
|||||||
|
|
||||||
string::size_type valEnd = position + (p - pstart);
|
string::size_type valEnd = position + (p - pstart);
|
||||||
|
|
||||||
while (valEnd != valStart && parserHelpers::isspace(buffer[valEnd - 1]))
|
while (valEnd != valStart && parserHelpers::isSpace(buffer[valEnd - 1]))
|
||||||
--valEnd;
|
--valEnd;
|
||||||
|
|
||||||
value = string(buffer.begin() + valStart,
|
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
|
// Skip white-spaces after this parameter
|
||||||
while (p < pend && parserHelpers::isspace(*p)) ++p;
|
while (p < pend && parserHelpers::isSpace(*p)) ++p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port
|
|||||||
throw vmime::exceptions::connection_error("Cannot resolve address.");
|
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
|
// Get a new socket
|
||||||
|
@ -93,7 +93,7 @@ void propertySet::parse(const string& props)
|
|||||||
for ( ; pos != end ; )
|
for ( ; pos != end ; )
|
||||||
{
|
{
|
||||||
// Skip white-spaces
|
// Skip white-spaces
|
||||||
for ( ; pos != end && parserHelpers::isspace(*pos) ; ++pos);
|
for ( ; pos != end && parserHelpers::isSpace(*pos) ; ++pos);
|
||||||
|
|
||||||
if (pos != end)
|
if (pos != end)
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ void propertySet::parse(const string& props)
|
|||||||
|
|
||||||
string::const_iterator optEnd = pos;
|
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);
|
const string option(optStart, optEnd);
|
||||||
string value = "1";
|
string value = "1";
|
||||||
@ -120,7 +120,7 @@ void propertySet::parse(const string& props)
|
|||||||
++pos; // skip '='
|
++pos; // skip '='
|
||||||
|
|
||||||
// Extract the value
|
// Extract the value
|
||||||
for ( ; pos != end && parserHelpers::isspace(*pos) ; ++pos);
|
for ( ; pos != end && parserHelpers::isSpace(*pos) ; ++pos);
|
||||||
|
|
||||||
if (pos != end)
|
if (pos != end)
|
||||||
{
|
{
|
||||||
@ -159,7 +159,7 @@ void propertySet::parse(const string& props)
|
|||||||
{
|
{
|
||||||
const string::const_iterator valStart = pos;
|
const string::const_iterator valStart = pos;
|
||||||
|
|
||||||
for ( ; pos != end && !parserHelpers::isspace(*pos) ; ++pos);
|
for ( ; pos != end && !parserHelpers::isSpace(*pos) ; ++pos);
|
||||||
|
|
||||||
value = string(valStart, pos);
|
value = string(valStart, pos);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ text* text::newFromString(const string& in, const charset& ch, text* generateInE
|
|||||||
|
|
||||||
for ( ; ; )
|
for ( ; ; )
|
||||||
{
|
{
|
||||||
if (p == end || parserHelpers::isspace(*p))
|
if (p == end || parserHelpers::isSpace(*p))
|
||||||
{
|
{
|
||||||
if (p != end)
|
if (p != end)
|
||||||
++p;
|
++p;
|
||||||
@ -310,7 +310,7 @@ text* text::newFromString(const string& in, const charset& ch, text* generateInE
|
|||||||
is8bit = false;
|
is8bit = false;
|
||||||
start = p;
|
start = p;
|
||||||
}
|
}
|
||||||
else if (!parserHelpers::isascii(*p))
|
else if (!parserHelpers::isAscii(*p))
|
||||||
{
|
{
|
||||||
is8bit = true;
|
is8bit = true;
|
||||||
++p;
|
++p;
|
||||||
|
@ -94,8 +94,8 @@ const string stringUtils::trim(const string& str)
|
|||||||
|
|
||||||
if (b != e)
|
if (b != e)
|
||||||
{
|
{
|
||||||
for ( ; b != e && parserHelpers::isspace(*b) ; ++b);
|
for ( ; b != e && parserHelpers::isSpace(*b) ; ++b);
|
||||||
for ( ; e != b && parserHelpers::isspace(*(e - 1)) ; --e);
|
for ( ; e != b && parserHelpers::isSpace(*(e - 1)) ; --e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string(b, e));
|
return (string(b, e));
|
||||||
@ -109,7 +109,7 @@ const string::size_type stringUtils::countASCIIchars
|
|||||||
|
|
||||||
for (string::const_iterator i = begin ; i != end ; ++i)
|
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...
|
if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
|
||||||
++count;
|
++count;
|
||||||
|
@ -67,7 +67,7 @@ word* word::parseNext(const string& buffer, const string::size_type position,
|
|||||||
// - before the first word
|
// - before the first word
|
||||||
// - between two encoded words
|
// - between two encoded words
|
||||||
// - after the last word
|
// - after the last word
|
||||||
while (pos < end && parserHelpers::isspace(buffer[pos]))
|
while (pos < end && parserHelpers::isSpace(buffer[pos]))
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
string::size_type startPos = 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')
|
if (pos > position && buffer[pos - 1] == '\r')
|
||||||
--endPos;
|
--endPos;
|
||||||
|
|
||||||
while (pos != end && parserHelpers::isspace(buffer[pos]))
|
while (pos != end && parserHelpers::isSpace(buffer[pos]))
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
unencoded += string(buffer.begin() + startPos, buffer.begin() + endPos);
|
unencoded += string(buffer.begin() + startPos, buffer.begin() + endPos);
|
||||||
|
@ -36,25 +36,25 @@ class parserHelpers
|
|||||||
{
|
{
|
||||||
public:
|
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');
|
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');
|
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'));
|
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')
|
if (c >= 'A' && c <= 'Z')
|
||||||
return ('a' + (c - 'A'));
|
return ('a' + (c - 'A'));
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
// Checks whether a character is in the 7-bit US-ASCII charset
|
// 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);
|
const unsigned int x = static_cast <unsigned int>(c);
|
||||||
return (x <= 127);
|
return (x <= 127);
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Checks whether a character has a visual representation
|
// 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);
|
const unsigned int x = static_cast <unsigned int>(c);
|
||||||
return (x >= 0x20 && x <= 0x7E);
|
return (x >= 0x20 && x <= 0x7E);
|
||||||
|
Loading…
Reference in New Issue
Block a user