From 0b1ff18c35db0a6391385e04d77907d2b19789c7 Mon Sep 17 00:00:00 2001 From: scullin Date: Fri, 29 May 1998 22:06:10 +0000 Subject: [PATCH] Changed XP_TO_ macros to NET_TO_ macros. Lame, but it doesn't really warrent a grander solution. git-svn-id: svn://10.0.0.236/trunk@2647 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/network/main/mkautocf.c | 8 ++++---- mozilla/network/main/mkconect.c | 6 +++--- mozilla/network/main/mkformat.c | 19 ++++++++++--------- mozilla/network/main/mkgeturl.c | 7 ++++--- mozilla/network/main/mkhelp.c | 6 +++--- mozilla/network/main/mkinit.c | 6 +++--- mozilla/network/main/mkparse.c | 6 +++--- mozilla/network/main/mkutils.c | 18 ++++++------------ mozilla/network/main/netutils.h | 8 ++++++++ 9 files changed, 44 insertions(+), 40 deletions(-) diff --git a/mozilla/network/main/mkautocf.c b/mozilla/network/main/mkautocf.c index 841cd32ab75..79ffd67436e 100644 --- a/mozilla/network/main/mkautocf.c +++ b/mozilla/network/main/mkautocf.c @@ -510,15 +510,15 @@ pacf_get_proxy_addr(MWContext *context, char *list, char **ret_proxy_addr, if (p) { do { *p++ = '\0'; - } while (*p && XP_IS_SPACE(*p)); + } while (*p && NET_IS_SPACE(*p)); } - for (addr=cur; *addr && !XP_IS_SPACE(*addr); addr++) + for (addr=cur; *addr && !NET_IS_SPACE(*addr); addr++) ; if (*addr) { do { *addr++ = '\0'; - } while (*addr && XP_IS_SPACE(*addr)); + } while (*addr && NET_IS_SPACE(*addr)); } type = ((!PL_strcasecmp(cur, "DIRECT")) ? PACF_TYPE_DIRECT : @@ -1423,7 +1423,7 @@ PRIVATE char *proxy_dns_resolve(const char *host) { XP_Bool is_numeric_ip = TRUE; for(p=host; *p; p++) { - if (!XP_IS_DIGIT(*p) && *p != '.') { + if (!NET_IS_DIGIT(*p) && *p != '.') { is_numeric_ip = FALSE; break; } diff --git a/mozilla/network/main/mkconect.c b/mozilla/network/main/mkconect.c index ebdd0c6b552..774895b2da9 100644 --- a/mozilla/network/main/mkconect.c +++ b/mozilla/network/main/mkconect.c @@ -220,7 +220,7 @@ int NET_SetSocksHost(char * host) is_numeric_ip = TRUE; /* init positive */ for(host_cp = host; *host_cp; host_cp++) - if(!XP_IS_DIGIT(*host_cp) && *host_cp != '.') + if(!NET_IS_DIGIT(*host_cp) && *host_cp != '.') { is_numeric_ip = FALSE; break; @@ -632,7 +632,7 @@ net_FindAddress (const char *host_ptr, port = PL_strchr(host_port, ':'); if (port) { *port++ = 0; - if (XP_IS_DIGIT(*port)) { + if (NET_IS_DIGIT(*port)) { unsigned short port_num = (unsigned short) atol(port); int i; @@ -683,7 +683,7 @@ net_FindAddress (const char *host_ptr, /* Determine whether or not we're dealing with an ip address as the host */ is_numeric_ip = TRUE; /* init positive */ for(host_cp = host_port; *host_cp; host_cp++) - if(!XP_IS_DIGIT(*host_cp) && *host_cp != '.') { + if(!NET_IS_DIGIT(*host_cp) && *host_cp != '.') { is_numeric_ip = FALSE; break; } diff --git a/mozilla/network/main/mkformat.c b/mozilla/network/main/mkformat.c index cc3f04631d7..f044d5b62d1 100644 --- a/mozilla/network/main/mkformat.c +++ b/mozilla/network/main/mkformat.c @@ -25,6 +25,7 @@ #include "mkutils.h" #include "mkgeturl.h" #include "mkformat.h" +#include "netutils.h" static char *net_default_types [] = { # include "mktypes.h" @@ -570,19 +571,19 @@ _cinfo_parse_mimetypes(XP_File fp, char *t, Bool is_local) StrAllocCopy(src_string, t); } - while((*t) && (XP_IS_SPACE(*t))) + while((*t) && (NET_IS_SPACE(*t))) ++t; if(*t && (*t != '#')) { ext = t; - while((*ext) && (!XP_IS_SPACE(*ext))) ++ext; + while((*ext) && (!NET_IS_SPACE(*ext))) ++ext; if((*ext)) *ext++ = '\0'; cd = NULL; while((*ext)) { - while((*ext) && (XP_IS_SPACE(*ext))) ++ext; + while((*ext) && (NET_IS_SPACE(*ext))) ++ext; if((*ext)) { if(!cd) { @@ -596,7 +597,7 @@ _cinfo_parse_mimetypes(XP_File fp, char *t, Bool is_local) cd->is_modified = FALSE; /* default is not modified in any way */ end = ext+1; - while((*end) && (!XP_IS_SPACE(*end))) ++end; + while((*end) && (!NET_IS_SPACE(*end))) ++end; if(*end) *end++ = '\0'; net_cdata_new_ext(ext, cd); @@ -659,7 +660,7 @@ cinfo_parse_mcc_line(char *line, Bool is_external, Bool is_local, if((*t) && (*t != '#')) { while(1) { - while(*t && XP_IS_SPACE(*t)) ++t; + while(*t && NET_IS_SPACE(*t)) ++t; if(!(*t)) break; name = t; @@ -671,11 +672,11 @@ cinfo_parse_mcc_line(char *line, Bool is_external, Bool is_local, NET_cdataFree(cd); return (-1); } - for(u = t - 1; XP_IS_SPACE(*u); --u) + for(u = t - 1; NET_IS_SPACE(*u); --u) ; *(u+1) = '\0'; /* terminate name */ ++t; - while(*t && (*t != '\"') && (XP_IS_SPACE(*t))) ++t; + while(*t && (*t != '\"') && (NET_IS_SPACE(*t))) ++t; if(!(*t)) { TRACEMSG(("line %d: empty value", ln)); if(cd) @@ -694,7 +695,7 @@ cinfo_parse_mcc_line(char *line, Bool is_external, Bool is_local, } else { value = t; - while(*t && (!XP_IS_SPACE(*t))) ++t; + while(*t && (!NET_IS_SPACE(*t))) ++t; /* null t is okay */ } if(*t) *t++ = '\0'; @@ -947,7 +948,7 @@ NET_cdataCommit(char * mimeType, char * cdataString) return; while (*citer != 0) /* Parse the string. Skip all non-c*/ { - if (isalnum(*citer) && (newExIndex < 29)) /* XP_IS_ALPHA(*citer) */ + if (isalnum(*citer) && (newExIndex < 29)) /* NET_IS_ALPHA(*citer) */ newExtension[newExIndex++] = *citer; else if (PL_strlen(newExtension) > 0) { diff --git a/mozilla/network/main/mkgeturl.c b/mozilla/network/main/mkgeturl.c index 84976908694..c1445c425e0 100644 --- a/mozilla/network/main/mkgeturl.c +++ b/mozilla/network/main/mkgeturl.c @@ -77,6 +77,7 @@ #include "jspubtd.h" #endif +/* nglayout should render the prefered image load hack obsolete */ #ifndef MODULAR_NETLIB #include "libimg.h" /* Image Lib public API. */ #include "il_strm.h" /* Image Lib public API. */ @@ -1236,7 +1237,7 @@ net_release_urls_for_processing(XP_Bool release_prefered, XP_Bool release_prefet if(!release_prefered || ( (wus->format_out != FO_INTERNAL_IMAGE && wus->format_out != FO_CACHE_AND_INTERNAL_IMAGE) -#ifdef MOZILLA_CLIENT +#if defined(MOZILLA_CLIENT) && !defined(MODULAR_NETLIB) || IL_PreferredStream(wus->URL_s) ) ) #else ) ) @@ -2746,11 +2747,11 @@ redo_load_switch: /* come here on file/ftp retry */ ) && ((this_entry->proxy_conf = pacf_find_proxies_for_url(window_id, URL_s)) != NULL) - && ((pacf_status = pacf_get_proxy_addr(window_id, + && (pacf_status = pacf_get_proxy_addr(window_id, this_entry->proxy_conf, &this_entry->proxy_addr, &this_entry->socks_host, - &this_entry->socks_port)) != NULL) + &this_entry->socks_port)) && this_entry->proxy_addr ) { diff --git a/mozilla/network/main/mkhelp.c b/mozilla/network/main/mkhelp.c index d1c478e5c7d..e5d1d9a50ea 100644 --- a/mozilla/network/main/mkhelp.c +++ b/mozilla/network/main/mkhelp.c @@ -452,14 +452,14 @@ net_get_html_help_token(char *line_data, char**next_word) if(next_word) *next_word = NULL; - while(XP_IS_SPACE(*line)) line++; + while(NET_IS_SPACE(*line)) line++; if(*line != '=') return(NULL); line++; /* go past '=' */ - while(XP_IS_SPACE(*line)) line++; + while(NET_IS_SPACE(*line)) line++; if(*line != '"') return(NULL); @@ -473,7 +473,7 @@ net_get_html_help_token(char *line_data, char**next_word) if(next_word) { *next_word = cp+1; - while(XP_IS_SPACE(*(*next_word))) (*next_word)++; + while(NET_IS_SPACE(*(*next_word))) (*next_word)++; } break; } diff --git a/mozilla/network/main/mkinit.c b/mozilla/network/main/mkinit.c index c2b0898cc8d..effa5285ef7 100644 --- a/mozilla/network/main/mkinit.c +++ b/mozilla/network/main/mkinit.c @@ -297,14 +297,14 @@ PRIVATE char *Cleanse (char *s) news = s; /* strip leading white space */ - while (*s && XP_IS_SPACE(*s)) ++s; + while (*s && NET_IS_SPACE(*s)) ++s; /* put in lower case */ for (tmpnews=news, tmp=s; *tmp; tmpnews++, ++tmp) { *tmpnews = tolower ((unsigned char)*tmp); } *tmpnews = '\0'; /* strip trailing white space */ - while (*--tmpnews && XP_IS_SPACE(*tmpnews)) *tmpnews = 0; + while (*--tmpnews && NET_IS_SPACE(*tmpnews)) *tmpnews = 0; return(news); } @@ -524,7 +524,7 @@ PRIVATE int ProcessMailcapEntry (FILE *fp, struct MailcapEntry *mc, } } - for (s=unprocessed_entry; *s && XP_IS_SPACE(*s); ++s) + for (s=unprocessed_entry; *s && NET_IS_SPACE(*s); ++s) ; /* NULL BODY */ if (!*s) { diff --git a/mozilla/network/main/mkparse.c b/mozilla/network/main/mkparse.c index 0de10af0dc5..e69e5187331 100644 --- a/mozilla/network/main/mkparse.c +++ b/mozilla/network/main/mkparse.c @@ -412,7 +412,7 @@ NET_MakeAbsoluteURL(char * absolute_url, char * relative_url) #if defined(XP_WIN) || defined(XP_OS2) /* this will allow drive letters to work right on windows */ - if(XP_IS_ALPHA(*cat_point) && *(cat_point+1) == ':') + if(NET_IS_ALPHA(*cat_point) && *(cat_point+1) == ':') cat_point += 2; #endif /* XP_WIN */ @@ -593,7 +593,7 @@ NET_ParseDate(char *date_string) if(!(ip = PL_strchr(date_string,' '))) return 0; else - while(XP_IS_SPACE(*ip)) + while(NET_IS_SPACE(*ip)) ++ip; /* make sure that the date is less than 256 @@ -1535,7 +1535,7 @@ net_get_next_http_index_token(char * line) if(start == NULL) return(NULL); - while(XP_IS_SPACE(*start)) start++; + while(NET_IS_SPACE(*start)) start++; if(*start == '"') { diff --git a/mozilla/network/main/mkutils.c b/mozilla/network/main/mkutils.c index e550063b34f..9b35b3c5c18 100644 --- a/mozilla/network/main/mkutils.c +++ b/mozilla/network/main/mkutils.c @@ -1646,8 +1646,8 @@ NET_ParseMimeHeader(FO_Present_Types outputFormat, if (URL_s->window_target == NULL) { - if ((XP_IS_ALPHA(value[0]) != FALSE)|| - (XP_IS_DIGIT(value[0]) != FALSE)|| + if ((NET_IS_ALPHA(value[0]) != FALSE)|| + (NET_IS_DIGIT(value[0]) != FALSE)|| (value[0] == '_')) { StrAllocCopy(URL_s->window_target, value); @@ -1811,7 +1811,7 @@ NET_ScanForURLs(MSG_Pane* pane, const char *input, int32 input_size, LOSER] blah blah blah */ const char *s = input; - while (s < end && XP_IS_SPACE (*s)) s++; + while (s < end && NET_IS_SPACE (*s)) s++; while (s < end && *s >= 'A' && *s <= 'Z') s++; if (s >= end) @@ -1850,8 +1850,8 @@ NET_ScanForURLs(MSG_Pane* pane, const char *input, int32 input_size, things like "NotHTTP://xxx" */ int type = 0; - if(!XP_IS_SPACE(*cp) && - (cp == input || (!XP_IS_ALPHA(cp[-1]) && !XP_IS_DIGIT(cp[-1]))) && + if(!NET_IS_SPACE(*cp) && + (cp == input || (!NET_IS_ALPHA(cp[-1]) && !NET_IS_DIGIT(cp[-1]))) && (type = NET_URL_Type(cp)) != 0) { const char *cp2; @@ -1859,7 +1859,7 @@ NET_ScanForURLs(MSG_Pane* pane, const char *input, int32 input_size, for(cp2=cp; cp2 < end; cp2++) { /* These characters always mark the end of the URL. */ - if (XP_IS_SPACE(*cp2) || + if (NET_IS_SPACE(*cp2) || *cp2 == '<' || *cp2 == '>' || *cp2 == '`' || *cp2 == ')' || *cp2 == '\'' || *cp2 == '"' || @@ -2416,15 +2416,9 @@ NET_AddLOSubmitDataToURLStruct(LO_FormSubmitData * sub_data, /* write all the post data to a file first * so that we can send really big stuff */ -#ifdef XP_MAC /* This should really be for all platforms but I am fixing a bug for final release */ tmpfilename = WH_TempName (xpFileToPost, "nsform"); if (!tmpfilename) return 0; fp = XP_FileOpen (tmpfilename, xpFileToPost, XP_FILE_WRITE_BIN); -#else - tmpfilename = WH_TempName (xpTemporary, "nsform"); - if (!tmpfilename) return 0; - fp = XP_FileOpen (tmpfilename, xpTemporary, XP_FILE_WRITE_BIN); -#endif if (!fp) { PR_Free(tmpfilename); return 0; diff --git a/mozilla/network/main/netutils.h b/mozilla/network/main/netutils.h index a601baec504..cab8aeb258b 100644 --- a/mozilla/network/main/netutils.h +++ b/mozilla/network/main/netutils.h @@ -73,9 +73,17 @@ NET_WritePostData(MWContext *context, extern int NET_UUEncode(unsigned char *src, unsigned char *dst, int srclen); +/* + * Various character macros + */ + #define NET_TO_UPPER(x) ((((unsigned int) (x)) > 0x7f) ? x : toupper(x)) #define NET_TO_LOWER(x) ((((unsigned int) (x)) > 0x7f) ? x : tolower(x)) +#define NET_IS_ALPHA(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isalpha(x)) +#define NET_IS_DIGIT(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isdigit(x)) +#define NET_IS_SPACE(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isspace(x)) + PR_END_EXTERN_C #endif /* NETUTILS_H */