more cleanup from stuff sitting in my tree: remove xp_core.h dependancy from mime by switching to new nsString routines

r=rhp
This commit is contained in:
alecf%netscape.com 1999-12-03 00:12:49 +00:00
Родитель 2f000d254c
Коммит 5b68d2b9a2
14 изменённых файлов: 60 добавлений и 1801 удалений

Просмотреть файл

@ -662,18 +662,18 @@ mime_insert_all_headers(char **body,
/* Back up over whitespace before the colon. */
ocolon = colon;
for (; colon > head && IS_SPACE(colon[-1]); colon--)
for (; colon > head && nsString::IsSpace(colon[-1]); colon--)
;
contents = ocolon + 1;
}
/* Skip over whitespace after colon. */
while (contents <= end && IS_SPACE(*contents))
while (contents <= end && nsString::IsSpace(*contents))
contents++;
/* Take off trailing whitespace... */
while (end > contents && IS_SPACE(end[-1]))
while (end > contents && nsString::IsSpace(end[-1]))
end--;
name = (char *)PR_MALLOC(colon - head + 1);

Просмотреть файл

@ -25,6 +25,7 @@
#include "prmem.h"
#include "nsCRT.h"
#include "plstr.h"
#include "prlog.h"
#include "prio.h"
#include "nsFileSpec.h"
#include "nsEscape.h"
@ -348,7 +349,7 @@ MimeExternalBody_parse_eof (MimeObject *obj, PRBool abort_p)
{
char *in, *out;
for (in = url, out = url; *in; in++)
if (!IS_SPACE(*in))
if (!nsString::IsSpace(*in))
*out++ = *in;
*out = 0;
}
@ -403,14 +404,14 @@ MimeExternalBody_parse_eof (MimeObject *obj, PRBool abort_p)
if (bod->body && all_headers_p)
{
char *s = bod->body;
while (IS_SPACE(*s)) s++;
while (nsString::IsSpace(*s)) s++;
if (*s)
{
char *s2;
const char *pre = "<P><PRE>";
const char *suf = "</PRE>";
PRInt32 i;
for(i = nsCRT::strlen(s)-1; i >= 0 && IS_SPACE(s[i]); i--)
for(i = nsCRT::strlen(s)-1; i >= 0 && nsString::IsSpace(s[i]); i--)
s[i] = 0;
s2 = nsEscapeHTML(s);
if (!s2) goto FAIL;

Просмотреть файл

@ -365,7 +365,7 @@ MimeHeaders_get (MimeHeaders *hdrs, const char *header_name,
/* Back up over whitespace before the colon. */
ocolon = colon;
for (; colon > head && IS_SPACE(colon[-1]); colon--)
for (; colon > head && nsString::IsSpace(colon[-1]); colon--)
;
/* If the strings aren't the same length, it doesn't match. */
@ -382,7 +382,7 @@ MimeHeaders_get (MimeHeaders *hdrs, const char *header_name,
char *s;
/* Skip over whitespace after colon. */
while (contents <= end && IS_SPACE(*contents))
while (contents <= end && nsString::IsSpace(*contents))
contents++;
/* If we're supposed to strip at the frist token, pull `end' back to
@ -391,7 +391,7 @@ MimeHeaders_get (MimeHeaders *hdrs, const char *header_name,
if (strip_p)
{
for (s = contents;
s <= end && *s != ';' && *s != ',' && !IS_SPACE(*s);
s <= end && *s != ';' && *s != ',' && !nsString::IsSpace(*s);
s++)
;
end = s;
@ -434,7 +434,7 @@ MimeHeaders_get (MimeHeaders *hdrs, const char *header_name,
}
/* Take off trailing whitespace... */
while (end > contents && IS_SPACE(end[-1]))
while (end > contents && nsString::IsSpace(end[-1]))
end--;
if (end > contents)
@ -489,7 +489,7 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name,
if (*str)
str++;
/* Skip over following whitespace */
for (; *str && IS_SPACE(*str); str++)
for (; *str && nsString::IsSpace(*str); str++)
;
if (!*str)
return 0;
@ -501,24 +501,24 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name,
const char *value_start = str;
const char *value_end = 0;
PR_ASSERT(!IS_SPACE(*str)); /* should be after whitespace already */
PR_ASSERT(!nsString::IsSpace(*str)); /* should be after whitespace already */
/* Skip forward to the end of this token. */
for (; *str && !IS_SPACE(*str) && *str != '=' && *str != ';'; str++)
for (; *str && !nsString::IsSpace(*str) && *str != '=' && *str != ';'; str++)
;
token_end = str;
/* Skip over whitespace, '=', and whitespace */
while (IS_SPACE (*str)) str++;
while (nsString::IsSpace (*str)) str++;
if (*str == '=') str++;
while (IS_SPACE (*str)) str++;
while (nsString::IsSpace (*str)) str++;
if (*str != '"')
{
/* The value is a token, not a quoted string. */
value_start = str;
for (value_end = str;
*value_end && !IS_SPACE (*value_end) && *value_end != ';';
*value_end && !nsString::IsSpace (*value_end) && *value_end != ';';
value_end++)
;
str = value_end;
@ -644,9 +644,9 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name,
/* str now points after the end of the value.
skip over whitespace, ';', whitespace. */
while (IS_SPACE (*str)) str++;
while (nsString::IsSpace (*str)) str++;
if (*str == ';') str++;
while (IS_SPACE (*str)) str++;
while (nsString::IsSpace (*str)) str++;
}
return s;
}
@ -747,18 +747,18 @@ MimeHeaders_write_all_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt, PRBoo
/* Back up over whitespace before the colon. */
ocolon = colon;
for (; colon > head && IS_SPACE(colon[-1]); colon--)
for (; colon > head && nsString::IsSpace(colon[-1]); colon--)
;
contents = ocolon + 1;
}
/* Skip over whitespace after colon. */
while (contents <= end && IS_SPACE(*contents))
while (contents <= end && nsString::IsSpace(*contents))
contents++;
/* Take off trailing whitespace... */
while (end > contents && IS_SPACE(end[-1]))
while (end > contents && nsString::IsSpace(end[-1]))
end--;
name = (char *)PR_MALLOC(colon - head + 1);
@ -822,7 +822,7 @@ MIME_StripContinuations(char *original)
{
p2++;
}
while((*p2 == CR) || (*p2 == LF) || IS_SPACE(*p2));
while((*p2 == CR) || (*p2 == LF) || nsString::IsSpace(*p2));
if (*p2 == '\0') continue; /* drop out of loop at end of string*/
}

Просмотреть файл

@ -146,7 +146,7 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data)
if (! id)
{
PR_FREEIF(*data);
return MIME_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
if (obj->options && obj->options->url)
@ -170,7 +170,7 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data)
{
PR_FREEIF(*data);
PR_FREEIF(id);
return MIME_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
}

Просмотреть файл

@ -108,6 +108,7 @@
#include "mimemrel.h"
#include "prmem.h"
#include "prprf.h"
#include "prlog.h"
#include "plstr.h"
#include "mimemoz2.h"
#include "nsMimeTransition.h"
@ -368,7 +369,7 @@ MimeThisIsStartPart(MimeObject *obj, MimeObject* child)
}
/* rhp - gotta support the "start" parameter */
PUBLIC char *
char *
MakeAbsoluteURL(char * absolute_url, char * relative_url)
{
nsMimeURLUtils myUtil;
@ -714,7 +715,7 @@ flush_tag(MimeMultipartRelated* relobj)
isquote = PR_TRUE;
/* Take up the double quote and leading space here as well. */
/* Safe because there's a '>' at the end */
do {ptr++;} while (IS_SPACE(*ptr));
do {ptr++;} while (nsString::IsSpace(*ptr));
}
}
status = real_write(relobj, buf, ptr - buf);
@ -726,7 +727,7 @@ flush_tag(MimeMultipartRelated* relobj)
ptr = mime_strnchr(buf, '"', length - (buf - relobj->curtag));
} else {
for (ptr = buf; *ptr ; ptr++) {
if (*ptr == '>' || IS_SPACE(*ptr)) break;
if (*ptr == '>' || nsString::IsSpace(*ptr)) break;
}
PR_ASSERT(*ptr);
}
@ -739,7 +740,7 @@ flush_tag(MimeMultipartRelated* relobj)
substitute the appropriate mailbox part URL in
its place. */
ptr2=buf; /* walk from the left end rightward */
while((ptr2<ptr) && (!IS_SPACE(*ptr2)))
while((ptr2<ptr) && (!nsString::IsSpace(*ptr2)))
ptr2++;
/* Compare the beginning of the word with "cid:". Yuck. */
if (((ptr2 - buf) > 4) &&
@ -805,7 +806,7 @@ flush_tag(MimeMultipartRelated* relobj)
/* Advance to the beginning of the next word, or to
the end of the value string. */
while((ptr2<ptr) && (IS_SPACE(*ptr2)))
while((ptr2<ptr) && (nsString::IsSpace(*ptr2)))
ptr2++;
/* Write whatever original text remains after

Просмотреть файл

@ -582,7 +582,7 @@ MimeMessage_write_headers_html (MimeObject *obj)
HG00919
#endif /* MOZ_SECURITY */
status = MimeHeaders_write_all_headers (msg->hdrs, obj->options, FALSE);
status = MimeHeaders_write_all_headers (msg->hdrs, obj->options, PR_FALSE);
if (status < 0)
{
mimeEmitterEndHeader(obj->options);

Просмотреть файл

@ -247,7 +247,7 @@ MimeMultipart_check_boundary(MimeObject *obj, const char *line, PRInt32 length)
term_p = PR_FALSE;
/* strip trailing whitespace (including the newline.) */
while(length > 2 && XP_IS_SPACE(line[length-1]))
while(length > 2 && nsString::IsSpace(line[length-1]))
length--;
/* Could this be a terminating boundary? */

Просмотреть файл

@ -244,7 +244,7 @@ MimeSunAttachment_create_child(MimeObject *obj)
if (sun_enc_info && !nsCRT::strncasecmp (sun_enc_info, "adpcm-compress", 14))
{
sun_enc_info += 14;
while (IS_SPACE(*sun_enc_info) || *sun_enc_info == ',')
while (nsString::IsSpace(*sun_enc_info) || *sun_enc_info == ',')
sun_enc_info++;
}
@ -259,7 +259,7 @@ MimeSunAttachment_create_child(MimeObject *obj)
{
const char *start = sun_enc_info;
sun_enc_info = end + 1;
while (IS_SPACE(*sun_enc_info))
while (nsString::IsSpace(*sun_enc_info))
sun_enc_info++;
for (prev = end-1; prev > start && *prev != ','; prev--)
;

Просмотреть файл

@ -106,7 +106,7 @@ MimeInlineTextHTML_parse_begin (MimeObject *obj)
for (in = base_hdr; *in; in++)
/* ignore whitespace and quotes */
if (!IS_SPACE(*in) && *in != '"')
if (!nsString::IsSpace(*in) && *in != '"')
*out++ = *in;
/* Close the tag and argument. */

Просмотреть файл

@ -97,7 +97,7 @@ MimeRichtextConvert (char *line, PRInt32 length,
if (enriched_p)
{
for (this_start = line; this_start < line + length; this_start++)
if (!IS_SPACE (*this_start)) break;
if (!nsString::IsSpace (*this_start)) break;
if (this_start >= line + length) /* blank line */
{
PL_strcpy (*obufferP, "<BR>");
@ -127,7 +127,7 @@ MimeRichtextConvert (char *line, PRInt32 length,
{
this_end++;
while (this_end < data_end &&
!IS_SPACE (*this_end) &&
!nsString::IsSpace (*this_end) &&
*this_end != '<' && *this_end != '>' &&
*this_end != '&')
this_end++;

Просмотреть файл

@ -396,7 +396,7 @@ MimeUntypedText_uu_begin_line_p(const char *line, PRInt32 length,
if (*s != ' ') return PR_FALSE;
}
while (IS_SPACE(*s))
while (nsString::IsSpace(*s))
s++;
name = (char *) PR_MALLOC(((line+length)-s) + 1);
@ -436,7 +436,7 @@ MimeUntypedText_uu_end_line_p(const char *line, PRInt32 length)
return (line[0] == 'e' &&
line[1] == 'n' &&
line[2] == 'd' &&
(line[3] == 0 || IS_SPACE(line[3])));
(line[3] == 0 || nsString::IsSpace(line[3])));
#else
/* ...but, why don't we accept any line that begins with the three
letters "END" in any case: I've seen lots of partial messages
@ -471,7 +471,7 @@ MimeUntypedText_binhex_begin_line_p(const char *line, PRInt32 length,
if (length <= BINHEX_MAGIC_LEN)
return PR_FALSE;
while(length > 0 && IS_SPACE(line[length-1]))
while(length > 0 && nsString::IsSpace(line[length-1]))
length--;
if (length != BINHEX_MAGIC_LEN)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -39,7 +39,7 @@
nsCRT::memcpy(_D,_S,_LEN); _D += _LEN; } } while (0)
//#define NEXT_CHAR(_STR) (_STR = (* (char *) _STR < 128) ? (char *) _STR + 1 : NextChar_UTF8((char *)_STR))
#define NEXT_CHAR(_STR) (_STR = NextChar_UTF8((char *)_STR))
#define TRIM_WHITESPACE(_S,_E,_T) do { while (_E > _S && IS_SPACE(_E[-1])) _E--;\
#define TRIM_WHITESPACE(_S,_E,_T) do { while (_E > _S && nsString::IsSpace(_E[-1])) _E--;\
*_E++ = _T; } while (0)
/*
@ -437,7 +437,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Skip over extra whitespace or commas before addresses.
*/
while (*line_end && (IS_SPACE(*line_end) || *line_end == ','))
while (*line_end && (nsString::IsSpace(*line_end) || *line_end == ','))
NEXT_CHAR(line_end);
while (*line_end)
@ -528,12 +528,12 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Push out some whitespace before the paren, if
* there is non-whitespace there already.
*/
if (name_out > name_start && !IS_SPACE(name_out [-1]))
if (name_out > name_start && !nsString::IsSpace(name_out [-1]))
*name_out++ = ' ';
/* Skip leading whitespace.
*/
while (IS_SPACE(*s) && s < line_end)
while (nsString::IsSpace(*s) && s < line_end)
s++;
while (s < line_end)
@ -549,7 +549,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
if (*s == '\\') /* remove one \ */
s++;
if (IS_SPACE(*s) && name_out > name_start && IS_SPACE(name_out[-1]))
if (nsString::IsSpace(*s) && name_out > name_start && nsString::IsSpace(name_out[-1]))
/* collapse consecutive whitespace */;
else
COPY_CHAR(name_out, s);
@ -569,8 +569,8 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Eat whitespace at the beginning of the line,
* and eat consecutive whitespace within the line.
*/
if ( IS_SPACE(*line_end)
&& (addr_out == addr_start || IS_SPACE(addr_out[-1])))
if ( nsString::IsSpace(*line_end)
&& (addr_out == addr_start || nsString::IsSpace(addr_out[-1])))
/* skip it */;
else
COPY_CHAR(addr_out, line_end);
@ -609,7 +609,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Skip leading whitespace.
*/
while (IS_SPACE(*s) && s < mailbox_start)
while (nsString::IsSpace(*s) && s < mailbox_start)
s++;
/* Copy up to (not including) the <
@ -628,7 +628,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
else
s++;
}
if (IS_SPACE(*s) && name_out > name_start && IS_SPACE(name_out[-1]))
if (nsString::IsSpace(*s) && name_out > name_start && nsString::IsSpace(name_out[-1]))
/* collapse consecutive whitespace */;
else
COPY_CHAR(name_out, s);
@ -643,7 +643,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Skip whitespace after >
*/
while (IS_SPACE(*s) && s < line_end)
while (nsString::IsSpace(*s) && s < line_end)
s++;
/* Copy from just after > to the end.
@ -662,7 +662,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
else
s++;
}
if (IS_SPACE (*s) && name_out > name_start && IS_SPACE (name_out[-1]))
if (nsString::IsSpace (*s) && name_out > name_start && nsString::IsSpace (name_out[-1]))
/* collapse consecutive whitespace */;
else
COPY_CHAR(name_out, s);
@ -680,7 +680,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
/* Skip leading whitespace.
*/
while (IS_SPACE(*s) && s < mailbox_end)
while (nsString::IsSpace(*s) && s < mailbox_end)
s++;
/* Copy up to (not including) the >
@ -726,7 +726,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
{
if (*s == '\\')
s++;
else if (!space && IS_SPACE(*s))
else if (!space && nsString::IsSpace(*s))
space = s;
else if (*s == '\"')
{
@ -740,7 +740,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
{
if (*s == '\\')
s++;
else if (IS_SPACE(*s))
else if (nsString::IsSpace(*s))
{
*s = 0;
*name_out++ = 0;
@ -782,7 +782,7 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
NEXT_CHAR(line_end);
/* Skip over extra whitespace or commas between addresses. */
while (*line_end && (IS_SPACE(*line_end) || *line_end == ','))
while (*line_end && (nsString::IsSpace(*line_end) || *line_end == ','))
line_end++;
this_start = line_end;
@ -796,10 +796,10 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
{
char *s;
for (s = name_buf; s < name_out; NEXT_CHAR(s))
if (IS_SPACE(*s) && *s != ' ')
if (nsString::IsSpace(*s) && *s != ' ')
*s = ' ';
for (s = addr_buf; s < addr_out; NEXT_CHAR(s))
if (IS_SPACE(*s) && *s != ' ')
if (nsString::IsSpace(*s) && *s != ' ')
*s = ' ';
}
@ -850,7 +850,7 @@ msg_quote_phrase_or_addr(char *address, PRInt32 length, PRBool addr_p)
address = in;
break;
}
else if (!IS_DIGIT(*in) && !IS_ALPHA(*in) && *in != '@' && *in != '.')
else if (!nsString::IsDigit(*in) && !nsString::IsAlpha(*in) && *in != '@' && *in != '.')
break;
}
}

Просмотреть файл

@ -28,6 +28,7 @@
#include "comi18n.h"
#include "prmem.h"
#include "prprf.h"
#include "prlog.h"
#include "plstr.h"
#include "mimemoz2.h"
#include "nsMimeTypes.h"