diff options
Diffstat (limited to 'WWW/Library/Implementation')
23 files changed, 325 insertions, 283 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c index 91bfc880..6348da90 100644 --- a/WWW/Library/Implementation/HTAABrow.c +++ b/WWW/Library/Implementation/HTAABrow.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAABrow.c,v 1.31 2010/04/29 09:31:02 tom Exp $ + * $LynxId: HTAABrow.c,v 1.32 2010/06/17 00:37:22 tom Exp $ * * MODULE HTAABrow.c * BROWSER SIDE ACCESS AUTHORIZATION MODULE @@ -1047,7 +1047,7 @@ char *HTAA_composeAuth(const char *hostname, * NO, otherwise. */ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, - int length, + size_t length, int soc, BOOL IsProxy) { diff --git a/WWW/Library/Implementation/HTAABrow.h b/WWW/Library/Implementation/HTAABrow.h index 774a1f73..353d11f9 100644 --- a/WWW/Library/Implementation/HTAABrow.h +++ b/WWW/Library/Implementation/HTAABrow.h @@ -102,7 +102,7 @@ Routines for Browser Side Recording of AA Info * NO, otherwise. */ extern BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, - int length, + size_t length, int soc, BOOL IsProxy); diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c index 8ebdc837..aa04e349 100644 --- a/WWW/Library/Implementation/HTAAUtil.c +++ b/WWW/Library/Implementation/HTAAUtil.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAAUtil.c,v 1.28 2010/04/29 09:32:49 tom Exp $ + * $LynxId: HTAAUtil.c,v 1.29 2010/06/17 00:36:31 tom Exp $ * * MODULE HTAAUtil.c * COMMON PARTS OF ACCESS AUTHORIZATION MODULE @@ -234,7 +234,7 @@ BOOL HTAA_templateMatch(const char *ctemplate, return YES; /* Equally long equal strings */ else if ('*' == *p) { /* Wildcard */ p++; /* Skip wildcard character */ - m = strlen(q) - strlen(p); /* Amount to match to wildcard */ + m = (int) (strlen(q) - strlen(p)); /* Amount to match to wildcard */ if (m < 0) return NO; /* No match, filename too short */ else { /* Skip the matched characters and compare */ @@ -284,7 +284,7 @@ BOOL HTAA_templateCaseMatch(const char *ctemplate, return YES; /* Equally long equal strings */ else if ('*' == *p) { /* Wildcard */ p++; /* Skip wildcard character */ - m = strlen(q) - strlen(p); /* Amount to match to wildcard */ + m = (int) (strlen(q) - strlen(p)); /* Amount to match to wildcard */ if (m < 0) return NO; /* No match, filename too short */ else { /* Skip the matched characters and compare */ @@ -470,7 +470,7 @@ static void FreeHTAAUtil(void) * proceed to read from socket. */ void HTAA_setupReader(char *start_of_headers, - int length, + size_t length, int soc) { if (!start_of_headers) @@ -480,7 +480,7 @@ void HTAA_setupReader(char *start_of_headers, if (buffer_length < BUFFER_SIZE) /* would fall below BUFFER_SIZE? */ buffer_length = BUFFER_SIZE; buffer = (char *) malloc((size_t) (sizeof(char) * (buffer_length + 1))); - } else if (length > (int) buffer_length) { /* need more space? */ + } else if (length > buffer_length) { /* need more space? */ buffer_length = length; buffer = (char *) realloc((char *) buffer, (size_t) (sizeof(char) * (buffer_length + 1))); diff --git a/WWW/Library/Implementation/HTAAUtil.h b/WWW/Library/Implementation/HTAAUtil.h index e5044498..1fd9ee75 100644 --- a/WWW/Library/Implementation/HTAAUtil.h +++ b/WWW/Library/Implementation/HTAAUtil.h @@ -1,30 +1,33 @@ -/* Utilities for the Authorization parts of libwww - COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER - - This module is the interface to the common parts of Access Authorization (AA) package - for both server and browser. Important to know about memory allocation: - - Routines in this module use dynamic allocation, but free automatically all the memory - reserved by them. - - Therefore the caller never has to (and never should) free() any object returned by - these functions. - - Therefore also all the strings returned by this package are only valid until the next - call to the same function is made. This approach is selected, because of the nature of - access authorization: no string returned by the package needs to be valid longer than - until the next call. - - This also makes it easy to plug the AA package in: you don't have to ponder whether to - free() something here or is it done somewhere else (because it is always done somewhere - else). - - The strings that the package needs to store are copied so the original strings given as - parameters to AA functions may be freed or modified with no side effects. - - Also note: The AA package does not free() anything else than what it has itself - allocated. - +/* + * $LynxId: HTAAUtil.h,v 1.12 2010/06/17 00:36:04 tom Exp $ + * + * Utilities for the Authorization parts of libwww + * COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER + * + * This module is the interface to the common parts of Access Authorization (AA) package + * for both server and browser. Important to know about memory allocation: + * + * Routines in this module use dynamic allocation, but free automatically all the memory + * reserved by them. + * + * Therefore the caller never has to (and never should) free() any object returned by + * these functions. + * + * Therefore also all the strings returned by this package are only valid until the next + * call to the same function is made. This approach is selected, because of the nature of + * access authorization: no string returned by the package needs to be valid longer than + * until the next call. + * + * This also makes it easy to plug the AA package in: you don't have to ponder whether to + * free() something here or is it done somewhere else (because it is always done somewhere + * else). + * + * The strings that the package needs to store are copied so the original strings given as + * parameters to AA functions may be freed or modified with no side effects. + * + * Also note: The AA package does not free() anything else than what it has itself + * allocated. + * */ #ifndef HTAAUTIL_H @@ -282,7 +285,7 @@ Header Line Reader * proceed to read from socket. */ extern void HTAA_setupReader(char *start_of_headers, - int length, + size_t length, int soc); /* PUBLIC HTAA_getUnfoldedLine() diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index 761b69cc..7a444400 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAnchor.c,v 1.65 2010/04/29 22:39:37 tom Exp $ + * $LynxId: HTAnchor.c,v 1.66 2010/06/17 00:17:34 tom Exp $ * * Hypertext "Anchor" Object HTAnchor.c * ========================== @@ -53,7 +53,7 @@ static HASH_TYPE HASH_FUNCTION(const char *cp_address) const unsigned char *p; for (p = (const unsigned char *) cp_address, hash = 0; *p; p++) - hash = (int) (hash * 3 + (*(const unsigned char *) p)) % HASH_SIZE; + hash = (HASH_TYPE) (hash * 3 + (*(const unsigned char *) p)) % HASH_SIZE; return (hash); } @@ -908,9 +908,9 @@ void HTAnchor_setPrompt(HTParentAnchor *me, BOOL HTAnchor_isIndex(HTParentAnchor *me) { - return (me - ? (BOOL) me->isIndex - : NO); + return (BOOL) (me + ? me->isIndex + : NO); } /* Whether Anchor has been designated as an ISMAP link @@ -918,9 +918,9 @@ BOOL HTAnchor_isIndex(HTParentAnchor *me) */ BOOL HTAnchor_isISMAPScript(HTAnchor * me) { - return ((me && me->parent->info) - ? (BOOL) me->parent->info->isISMAPScript - : NO); + return (BOOL) ((me && me->parent->info) + ? me->parent->info->isISMAPScript + : NO); } #if defined(USE_COLOR_STYLE) diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h index 653111b3..43b64b90 100644 --- a/WWW/Library/Implementation/HTAnchor.h +++ b/WWW/Library/Implementation/HTAnchor.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTAnchor.h,v 1.33 2009/01/01 16:47:33 tom Exp $ + * $LynxId: HTAnchor.h,v 1.34 2010/06/17 00:13:37 tom Exp $ * * Hypertext "Anchor" Object HTAnchor.h * ========================== @@ -35,6 +35,8 @@ extern "C" { HTParentAnchor0 *parent; /* Parent of this anchor (self for adults) */ }; +#define HASH_TYPE unsigned short + struct _HTParentAnchor0 { /* One for adult_table, * generally not used outside HTAnchor.c */ /* Common part from the generic anchor structure */ @@ -48,7 +50,7 @@ extern "C" { HTList sources; /* List of anchors pointing to this, if any */ HTList _add_adult; /* - just a memory for list entry:) */ - short adult_hash; /* adult list number */ + HASH_TYPE adult_hash; /* adult list number */ BOOL underway; /* Document about to be attached to it */ }; diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c index f0db72f3..1b5bf4cb 100644 --- a/WWW/Library/Implementation/HTAtom.c +++ b/WWW/Library/Implementation/HTAtom.c @@ -84,6 +84,8 @@ HTAtom *HTAtom_for(const char *string) a->name = (char *) malloc(strlen(string) + 1); if (a->name == NULL) outofmem(__FILE__, "HTAtom_for"); + + assert(a != NULL); strcpy(a->name, string); a->next = hash_table[hash]; /* Put onto the head of list */ hash_table[hash] = a; diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c index 81be0abc..0c172ac4 100644 --- a/WWW/Library/Implementation/HTBTree.c +++ b/WWW/Library/Implementation/HTBTree.c @@ -178,14 +178,16 @@ void HTBTree_add(HTBTree *tree, added_element->right_depth = 0; } } else { /* res >= 0 */ - if (father_of_element->right != NULL) + if (father_of_element->right != NULL) { father_of_element = father_of_element->right; - else { + } else { father_found = NO; father_of_element->right = typeMalloc(HTBTElement); if (father_of_element->right == NULL) outofmem(__FILE__, "HTBTree_add"); + assert(father_of_element->right != NULL); + added_element = father_of_element->right; added_element->up = father_of_element; added_element->object = object; @@ -254,13 +256,15 @@ void HTBTree_add(HTBTree *tree, && (father_of_element->right->left->right == NULL)) corrections = 7; - if ((father_of_element->right == NULL) + if ((father_of_element->left != NULL) + && (father_of_element->right == NULL) && (father_of_element->left->left == NULL) && (father_of_element->left->right->right == NULL) && (father_of_element->left->right->left == NULL)) corrections = 7; - if (father_of_element->left_depth > father_of_element->right_depth) { + if ((father_of_element->left != NULL) + && (father_of_element->left_depth > father_of_element->right_depth)) { added_element = father_of_element->left; father_of_element->left_depth = added_element->right_depth; added_element->right_depth = 1 diff --git a/WWW/Library/Implementation/HTChunk.c b/WWW/Library/Implementation/HTChunk.c index ee6aa299..db8b2c02 100644 --- a/WWW/Library/Implementation/HTChunk.c +++ b/WWW/Library/Implementation/HTChunk.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTChunk.c,v 1.22 2010/04/29 09:37:12 tom Exp $ + * $LynxId: HTChunk.c,v 1.24 2010/06/16 23:32:22 tom Exp $ * * Chunk handling: Flexible arrays * =============================== @@ -68,9 +68,9 @@ HTChunk *HTChunkCreate2(int grow, size_t needed) assert(ch != NULL); HTChunkInit(ch, grow); - if (needed > 0) { + if (needed-- > 0) { /* Round up */ - ch->allocated = (int) (needed - 1 - ((needed - 1) % ch->growby) + ch->allocated = (int) (needed - (needed % (size_t) ch->growby) + (unsigned) ch->growby); CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %u\n", (int) needed, (unsigned) ch->allocated)); @@ -134,13 +134,13 @@ BOOL HTChunkRealloc(HTChunk *ch, int growby) /* Append a character * ------------------ */ -void HTChunkPutc(HTChunk *ch, char c) +void HTChunkPutc(HTChunk *ch, unsigned char c) { if (ch->size >= ch->allocated) { if (!HTChunkRealloc(ch, ch->growby)) return; } - ch->data[ch->size++] = c; + ch->data[ch->size++] = (char) c; } /* like above but no realloc: extend to another chunk if necessary */ @@ -150,7 +150,7 @@ HTChunk *HTChunkPutc2(HTChunk *ch, char c) HTChunk *chunk = HTChunkCreateMayFail(ch->growby, ch->failok); ch->next = chunk; - HTChunkPutc(chunk, c); + HTChunkPutc(chunk, UCH(c)); return chunk; } ch->data[ch->size++] = c; diff --git a/WWW/Library/Implementation/HTChunk.h b/WWW/Library/Implementation/HTChunk.h index 18e2b8f3..7da23f5e 100644 --- a/WWW/Library/Implementation/HTChunk.h +++ b/WWW/Library/Implementation/HTChunk.h @@ -1,4 +1,7 @@ -/* HTChunk: Flexible array handling for libwww +/* + * $LynxId: HTChunk.h,v 1.19 2010/06/16 23:24:56 tom Exp $ + * + * HTChunk: Flexible array handling for libwww * CHUNK HANDLING: * FLEXIBLE ARRAYS * @@ -151,7 +154,7 @@ extern "C" { * *ch Is one character bigger * */ - extern void HTChunkPutc(HTChunk *ch, char c); + extern void HTChunkPutc(HTChunk *ch, unsigned char c); extern void HTChunkPutb(HTChunk *ch, const char *b, int l); diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index e88d1433..c8420ba0 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFTP.c,v 1.93 2010/05/05 09:27:41 tom Exp $ + * $LynxId: HTFTP.c,v 1.94 2010/06/17 00:44:49 tom Exp $ * * File Transfer Protocol (FTP) Client * for a WorldWideWeb browser @@ -3106,7 +3106,7 @@ static int read_directory(HTParentAnchor *parent, } else if (ic == EOF) { break; /* End of file */ } else { - HTChunkPutc(chunk, (char) ic); + HTChunkPutc(chunk, ic); } } HTChunkTerminate(chunk); diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index ea15b247..e9e1543e 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFile.c,v 1.122 2010/04/29 09:38:05 tom Exp $ + * $LynxId: HTFile.c,v 1.123 2010/06/17 00:27:47 tom Exp $ * * File Access HTFile.c * =========== @@ -441,7 +441,7 @@ static void LYListFmtParse(const char *fmtstr, case 'o': /* owner */ #ifndef NOUSERS - name = HTAA_UidToName(data->file_info.st_uid); + name = HTAA_UidToName((int) data->file_info.st_uid); if (*name) { FormatStr(&buf, start, name); } else { @@ -452,7 +452,7 @@ static void LYListFmtParse(const char *fmtstr, case 'g': /* group */ #ifndef NOUSERS - name = HTAA_GidToName(data->file_info.st_gid); + name = HTAA_GidToName((int) data->file_info.st_gid); if (*name) { FormatStr(&buf, start, name); } else { @@ -883,13 +883,13 @@ HTFormat HTFileFormat(const char *filename, if (!HTSuffixes) HTFileInit(); #endif /* !NO_INIT */ - lf = strlen(filename); + lf = (int) strlen(filename); n = HTList_count(HTSuffixes); for (i = 0; i < n; i++) { int ls; suff = (HTSuffix *) HTList_objectAt(HTSuffixes, i); - ls = strlen(suff->suffix); + ls = (int) strlen(suff->suffix); if ((ls <= lf) && 0 == strcasecomp(suff->suffix, filename + lf - ls)) { int j; @@ -904,7 +904,7 @@ HTFormat HTFileFormat(const char *filename, int ls2; suff = (HTSuffix *) HTList_objectAt(HTSuffixes, j); - ls2 = strlen(suff->suffix); + ls2 = (int) strlen(suff->suffix); if ((ls + ls2 <= lf) && !strncasecomp(suff->suffix, filename + lf - ls - ls2, ls2)) { @@ -1191,7 +1191,7 @@ float HTFileValue(const char *filename) HTSuffix *suff; int n; int i; - int lf = strlen(filename); + int lf = (int) strlen(filename); #ifndef NO_INIT if (!HTSuffixes) @@ -1202,7 +1202,7 @@ float HTFileValue(const char *filename) int ls; suff = (HTSuffix *) HTList_objectAt(HTSuffixes, i); - ls = strlen(suff->suffix); + ls = (int) strlen(suff->suffix); if ((ls <= lf) && 0 == strcmp(suff->suffix, filename + lf - ls)) { CTRACE((tfp, "File: Value of %s is %.3f\n", filename, suff->quality)); @@ -1472,7 +1472,7 @@ void HTDirEntry(HTStructured * target, const char *tail, if (strcmp(escaped, "..") != 0) { stripped = escaped; escaped = HTEscape(stripped, URL_XPALPHAS); - if (((len = strlen(escaped)) > 2) && + if (((len = (int) strlen(escaped)) > 2) && escaped[(len - 3)] == '%' && escaped[(len - 2)] == '2' && TOUPPER(escaped[(len - 1)]) == 'F') { diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 3c28b737..10489450 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFormat.c,v 1.69 2010/04/29 09:55:30 tom Exp $ + * $LynxId: HTFormat.c,v 1.70 2010/06/17 00:25:03 tom Exp $ * * Manage different file formats HTFormat.c * ============================= @@ -343,7 +343,7 @@ static int half_match(char *trial_type, char *target) trial_type, target)); /* main type matches */ - if (!strncmp(trial_type, target, (cp - trial_type) - 1)) + if (!strncmp(trial_type, target, (size_t) ((cp - trial_type) - 1))) return 1; return 0; @@ -634,8 +634,10 @@ float HTStackValue(HTFormat rep_in, float value = initial_value * pres->quality; if (HTMaxSecs > 0.0) - value = value - (length * pres->secs_per_byte + pres->secs) - / HTMaxSecs; + value = (value + - ((float) length * pres->secs_per_byte + + pres->secs) + / HTMaxSecs); return value; } } @@ -929,7 +931,7 @@ int HTFileCopy(FILE *fp, HTStream *sink) */ HTReadProgress(bytes = 0, 0); for (;;) { - status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp); + status = (int) fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp); if (status == 0) { /* EOF or error */ if (ferror(fp) == 0) { rv = HT_LOADED; @@ -1174,11 +1176,12 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink) for (;;) { if (s.avail_in == 0) { s.next_in = (Bytef *) input_buffer; - len = s.avail_in = fread(input_buffer, 1, INPUT_BUFFER_SIZE, zzfp); + s.avail_in = fread(input_buffer, 1, INPUT_BUFFER_SIZE, zzfp); + len = (int) s.avail_in; } status = inflate(&s, flush); if (status == Z_STREAM_END || status == Z_BUF_ERROR) { - len = sizeof(output_buffer) - s.avail_out; + len = (int) sizeof(output_buffer) - (int) s.avail_out; if (len > 0) { (*targetClass.put_block) (sink, output_buffer, len); bytes += len; @@ -1198,7 +1201,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink) s.avail_in = sizeof(dummy_head); (void) inflate(&s, flush); s.next_in = (Bytef *) input_buffer; - s.avail_in = len; + s.avail_in = (unsigned) len; continue; } else if (status != Z_OK) { CTRACE((tfp, "HTZzFileCopy inflate() %s\n", zError(status))); @@ -1337,7 +1340,7 @@ void HTCopyNoCR(HTParentAnchor *anchor GCC_UNUSED, character = HTGetCharacter(); if (character == EOF) break; - (*targetClass.put_character) (sink, UCH(character)); + (*targetClass.put_character) (sink, (char) character); } } diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 0ccdfd56..e023a618 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTGopher.c,v 1.45 2010/04/30 00:00:41 tom Exp $ + * $LynxId: HTGopher.c,v 1.46 2010/06/16 23:45:31 tom Exp $ * * GOPHER ACCESS HTGopher.c * ============= @@ -313,7 +313,7 @@ static void parse_menu(const char *arg GCC_UNUSED, /* gtype and name ok */ /* Nameless files are a separator line */ if (name != NULL && gtype == GOPHER_TEXT) { - int i = strlen(name) - 1; + int i = (int) strlen(name) - 1; while (name[i] == ' ' && i >= 0) name[i--] = '\0'; @@ -699,11 +699,11 @@ static void de_escape(char *command, const char *selector) p++; c = *p++; - b = from_hex(c); + b = UCH(from_hex(c)); c = *p++; if (!c) break; /* Odd number of chars! */ - *q++ = (char) FROMASCII((b << 4) + from_hex(c)); + *q++ = (char) FROMASCII((b << 4) + UCH(from_hex(c))); } else { *q++ = *p++; /* Record */ } @@ -769,7 +769,7 @@ static void interpret_cso_key(const char *key, error = 1; } if (!error) { - *length = strlen(buf); + *length = (int) strlen(buf); return; } } @@ -855,16 +855,14 @@ static void interpret_cso_key(const char *key, buf[out++] = (*key++); if (out > sizeof(buf) - 2) { buf[out] = '\0'; - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); out = 0; } } buf[out++] = ')'; buf[out] = '\0'; - *length = strlen(buf); - return; } - *length = strlen(buf); + *length = (int) strlen(buf); return; } @@ -1149,7 +1147,7 @@ static int generate_cso_form(char *host, */ buf[out] = '\0'; if (out > 0) - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); for (key = &line[j]; line[j + 1] && (line[j] != ')'); j++) { ; } @@ -1162,21 +1160,21 @@ static int generate_cso_form(char *host, i = ctx.cur_line; j = ctx.cur_off; line = ctemplate[i]; - out = length; + out = (size_t) length; if (ctx.seek) { /* * Command wants us to skip (forward) to indicated token. * Start at current position. */ - int slen = strlen(ctx.seek); + size_t slen = strlen(ctx.seek); for (; ctemplate[i]; i++) { for (line = ctemplate[i]; line[j]; j++) { if (line[j] == '$') if (0 == strncmp(ctx.seek, &line[j], slen)) { if (j == 0) - j = strlen(ctemplate[--i]) - 1; + j = (int) strlen(ctemplate[--i]) - 1; else --j; line = ctemplate[i]; @@ -1192,7 +1190,7 @@ static int generate_cso_form(char *host, char *temp = 0; HTSprintf0(&temp, GOPHER_CSO_SEEK_FAILED, ctx.seek); - (*Target->isa->put_block) (Target, temp, strlen(temp)); + (*Target->isa->put_block) (Target, temp, (int) strlen(temp)); FREE(temp); } } @@ -1203,7 +1201,7 @@ static int generate_cso_form(char *host, buf[out++] = line[j]; if (out > (sizeof(buf) - 3)) { buf[out] = '\0'; - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); out = 0; } } @@ -1212,7 +1210,7 @@ static int generate_cso_form(char *host, buf[out] = '\0'; } if (out > 0) - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); return 0; } @@ -1262,7 +1260,7 @@ static int generate_cso_report(HTStream *Target) } rcode = (p[0] == '-') ? &p[1] : p; ndx_str = fname = NULL; - len = strlen(p); + len = (int) strlen(p); for (i = 0; i < len; i++) { if (p[i] == ':') { p[i] = '\0'; @@ -1279,22 +1277,22 @@ static int generate_cso_report(HTStream *Target) if (prev_ndx != ndx) { if (prev_ndx != -100) { HTSprintf0(&buf, "</DL></DL>\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } if (ndx == 0) { HTSprintf0(&buf, "<HR><DL><DT>Information/status<DD><DL><DT>\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } else { HTSprintf0(&buf, "<HR><DL><DT>Entry %d:<DD><DL COMPACT><DT>\n", ndx); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } prev_ndx = ndx; } } else { HTSprintf0(&buf, "<DD>%s\n", rcode); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); continue; } if ((*rcode >= '2') && (*rcode <= '5') && (fname != ndx_str)) { @@ -1304,7 +1302,7 @@ static int generate_cso_report(HTStream *Target) for (fvalue = fname; *fvalue; fvalue++) { if (*fvalue == ':') { *fvalue++ = '\0'; - i = strlen(fname) - 1; + i = (int) strlen(fname) - 1; while (i >= 0 && fname[i] == ' ') { fname[i--] = '\0'; /* trim trailing */ } @@ -1329,10 +1327,10 @@ static int generate_cso_report(HTStream *Target) HTSprintf0(&buf, "<DT><I>%s</I><DD><A HREF=\"%s\">%s</A>\n", fname, fvalue, fvalue); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } else { HTSprintf0(&buf, "<DT><I>%s</I><DD>", fname); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); buf[0] = '\0'; l = fvalue; while (*l) { @@ -1373,11 +1371,11 @@ static int generate_cso_report(HTStream *Target) } } StrAllocCat(buf, "\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } } else { HTSprintf0(&buf, "<DD>"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); buf[0] = '\0'; l = fvalue; while (*l) { @@ -1417,18 +1415,18 @@ static int generate_cso_report(HTStream *Target) } } StrAllocCat(buf, "\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } } else { HTSprintf0(&buf, "<DD>%s\n", fname ? fname : rcode); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } } } end_CSOreport: if (prev_ndx != -100) { HTSprintf0(&buf, "</DL></DL>\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); } FREE(buf); return 0; @@ -1619,6 +1617,7 @@ static int HTLoadCSO(const char *arg, "Warning: non-lookup field ignored<BR>\n"); (*Target->isa->put_block) (Target, buf, + (int) strlen(buf)); } } else if (data[start] == 'r') { @@ -1644,9 +1643,9 @@ static int HTLoadCSO(const char *arg, NETCLOSE(s); strcpy(buf, "<EM>Error:</EM> At least one indexed field value must be specified!\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); strcpy(buf, "</BODY>\n</HTML>\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); (*Target->isa->_free) (Target); free_CSOfields(); return HT_LOADED; @@ -1666,10 +1665,10 @@ static int HTLoadCSO(const char *arg, } HTBprintf(&command, "%c%c", CR, LF); strcpy(buf, "<H2>\n<EM>CSO/PH command:</EM> "); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); (*Target->isa->put_block) (Target, BStrData(command), BStrLen(command)); strcpy(buf, "</H2>\n"); - (*Target->isa->put_block) (Target, buf, strlen(buf)); + (*Target->isa->put_block) (Target, buf, (int) strlen(buf)); if (TRACE) { CTRACE((tfp, "HTLoadCSO: Writing command `")); trace_bstring(command); @@ -1722,7 +1721,7 @@ static int HTLoadGopher(const char *arg, * the ISINDEX search). - FM */ { - int len; + size_t len; if ((len = strlen(arg)) > 5) { if (0 == strcmp((const char *) &arg[len - 6], ":105/2")) { diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index 08890099..dc0b7bda 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTMIME.c,v 1.72 2010/04/29 23:14:44 tom Exp $ + * $LynxId: HTMIME.c,v 1.73 2010/06/16 23:54:20 tom Exp $ * * MIME Message Parse HTMIME.c * ================== @@ -170,10 +170,10 @@ struct _HTStream { */ void HTMIME_TrimDoubleQuotes(char *value) { - int i; + size_t i; char *cp = value; - if (!(cp && *cp) || *cp != '"') + if (isEmpty(cp) || *cp != '"') return; i = strlen(cp); @@ -204,7 +204,7 @@ static BOOL content_is_compressed(HTStream *me) */ static void dequote(char *url) { - int len; + size_t len; len = strlen(url); if (*url == '\'' && len > 1 && url[len - 1] == url[0]) { @@ -2034,7 +2034,7 @@ static void HTMIME_put_character(HTStream *me, } /* switch on state */ #ifdef EXP_HTTP_HEADERS - HTChunkPutc(&me->anchor->http_headers, c); + HTChunkPutc(&me->anchor->http_headers, UCH(c)); if (me->state == MIME_TRANSPARENT) { HTChunkTerminate(&me->anchor->http_headers); CTRACE((tfp, "Server Headers:\n%.*s\n", @@ -2053,7 +2053,7 @@ static void HTMIME_put_character(HTStream *me, me->state = miJUNK_LINE; #ifdef EXP_HTTP_HEADERS - HTChunkPutc(&me->anchor->http_headers, c); + HTChunkPutc(&me->anchor->http_headers, UCH(c)); #endif return; @@ -2355,14 +2355,14 @@ static void HTmmdec_quote(char **t, if (*s == '=') { cval = 0; if (s[1] && (p = strchr(HTmmquote, s[1]))) { - cval += (char) (p - HTmmquote); + cval = (char) (cval + (char) (p - HTmmquote)); } else { *bp++ = *s++; continue; } if (s[2] && (p = strchr(HTmmquote, s[2]))) { - cval <<= 4; - cval += (char) (p - HTmmquote); + cval = (char) (cval << 4); + cval = (char) (cval + (p - HTmmquote)); *bp++ = cval; s += 3; } else { diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index c0f1fdfa..bc5825a4 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTNews.c,v 1.62 2010/04/29 23:15:07 tom Exp $ + * $LynxId: HTNews.c,v 1.63 2010/06/17 00:10:46 tom Exp $ * * NEWS ACCESS HTNews.c * =========== @@ -297,7 +297,7 @@ static int response(char *command) if (command) { int status; - int length = strlen(command); + int length = (int) strlen(command); CTRACE((tfp, "NNTP command to be sent: %s", command)); #ifdef NOT_ASCII @@ -767,11 +767,14 @@ static void write_anchor(const char *text, const char *addr) const char *p; char *q; - for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p != ','); p++) ; - if (strlen(NewsHREF) + (p - addr) + 1 < sizeof(href)) { + for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p != ','); p++) { + ; + } + if (strlen(NewsHREF) + (size_t) (p - addr) + 1 < sizeof(href)) { q = href; strcpy(q, NewsHREF); - strncat(q, addr, p - addr); /* Make complete hypertext reference */ + /* Make complete hypertext reference */ + strncat(q, addr, (size_t) (p - addr)); } else { q = NULL; HTSprintf0(&q, "%s%.*s", NewsHREF, (int) (p - addr), addr); @@ -917,7 +920,7 @@ static void post_article(char *postfile) strcat(buf, "."); blen++; } - llen = strlen(line); + llen = (int) strlen(line); if (in_header && !strncasecomp(line, "From:", 5)) { seen_header = 1; seen_fromline = 1; @@ -1570,7 +1573,7 @@ static int read_list(char *arg) pattern[strlen(pattern) - 1] = '\0'; } if (tail || head) { - len = strlen(pattern); + len = (int) strlen(pattern); } } @@ -2484,8 +2487,8 @@ static int HTLoadNews(const char *arg, } SnipIn(command, "GROUP %.*s", 9, groupName); } else { - int add_open = (strchr(p1, '<') == 0); - int add_close = (strchr(p1, '>') == 0); + size_t add_open = (strchr(p1, '<') == 0); + size_t add_close = (strchr(p1, '>') == 0); if (strlen(p1) + add_open + add_close >= 252) { FREE(ProxyHost); diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 7b90e23b..ec6d2193 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTParse.c,v 1.55 2010/04/29 23:28:27 tom Exp $ + * $LynxId: HTParse.c,v 1.57 2010/06/18 00:15:07 tom Exp $ * * Parse HyperText Document Address HTParse.c * ================================ @@ -12,6 +12,7 @@ #include <LYLeaks.h> #include <LYStrings.h> #include <LYCharUtils.h> +#include <LYGlobalDefs.h> #ifdef HAVE_ALLOCA_H #include <alloca.h> @@ -313,7 +314,8 @@ char *HTParse(const char *aName, char *result = NULL; char *tail = NULL; /* a pointer to the end of the 'result' string */ char *return_value = NULL; - unsigned len, len1, len2; + size_t len, len1, len2; + size_t need; char *name = NULL; char *rel = NULL; char *p, *q; @@ -348,7 +350,11 @@ char *HTParse(const char *aName, len2 = strlen(relatedName) + 1; len = len1 + len2 + MIN_PARSE; /* Lots of space: more than enough */ - result = tail = (char *) LYalloca(len * 2 + len1 + len2); + need = (len * 2 + len1 + len2); + if (need > (size_t) max_uri_size) + return StrAllocCopy(return_value, ""); + + result = tail = (char *) LYalloca(need); if (result == NULL) { outofmem(__FILE__, "HTParse"); @@ -395,7 +401,6 @@ char *HTParse(const char *aName, if (!strcmp(given.access, "http") || !strcmp(given.access, "https") || !strcmp(given.access, "ftp")) { - static char empty_string[] = ""; /* * Assume root. @@ -743,23 +748,28 @@ const char *HTParseAnchor(const char *aName) * keeping in mind scan() peculiarities on schemes: */ struct struct_parts given; + size_t need = ((unsigned) ((p - aName) + (int) strlen(p) + 1)); + char *name; - char *name = (char *) LYalloca((unsigned) ((p - aName) - + (int) strlen(p) + 1)); + if (need > (size_t) max_uri_size) { + p += strlen(p); + } else { + name = (char *) LYalloca(need); - if (name == NULL) { - outofmem(__FILE__, "HTParseAnchor"); + if (name == NULL) { + outofmem(__FILE__, "HTParseAnchor"); - assert(name != NULL); - } - strcpy(name, aName); - scan(name, &given); - LYalloca_free(name); - - p++; /*next to '#' */ - if (given.anchor == NULL) { - for (; *p; p++) /*scroll to end '\0' */ - ; + assert(name != NULL); + } + strcpy(name, aName); + scan(name, &given); + LYalloca_free(name); + + p++; /*next to '#' */ + if (given.anchor == NULL) { + for (; *p; p++) /*scroll to end '\0' */ + ; + } } } return p; diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c index bb40ad38..35b36719 100644 --- a/WWW/Library/Implementation/HTRules.c +++ b/WWW/Library/Implementation/HTRules.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTRules.c,v 1.40 2010/04/29 22:57:58 tom Exp $ + * $LynxId: HTRules.c,v 1.42 2010/06/17 21:33:35 tom Exp $ * * Configuration manager for Hypertext Daemon HTRules.c * ========================================== @@ -236,7 +236,7 @@ char *HTTranslate(const char *required) } if (*p == '*') { /* Match up to wildcard */ - m = strlen(q) - strlen(p + 1); /* Amount to match to wildcard */ + m = (int) strlen(q) - (int) strlen(p + 1); /* Amount to match to wildcard */ if (m < 0) continue; /* tail is too short to match */ if (0 != strcmp(q + m, p + 1)) @@ -250,9 +250,9 @@ char *HTTranslate(const char *required) switch (r->op) { /* Perform operation */ -#ifdef ACCESS_AUTH case HT_DefProt: case HT_Protect: +#ifdef ACCESS_AUTH { char *local_copy = NULL; char *p2; @@ -282,8 +282,8 @@ char *HTTranslate(const char *required) /* continue translating rules */ } - break; #endif /* ACCESS_AUTH */ + break; case HT_UserMsg: /* Produce message immediately */ LYFixCursesOn("show rule message:"); @@ -657,10 +657,10 @@ int HTSetConfiguration(char *config) FREE(line); /* syntax error, condition is a mess - kw */ return -2; /* NB unrecognized cond passes here - kw */ } - if (cond && !strncasecomp(cond, "redirected", strlen(cond))) { + if (cond && !strncasecomp(cond, "redirected", (int) strlen(cond))) { cond = "redirected"; /* recognized, canonical case - kw */ } else if (cond && strlen(cond) >= 8 && - !strncasecomp(cond, "userspecified", strlen(cond))) { + !strncasecomp(cond, "userspecified", (int) strlen(cond))) { cond = "userspec"; /* also allow abbreviation - kw */ } HTAddRule(op, word2, word3, cond_op, cond); diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index 24ee6683..426608bb 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTString.c,v 1.60 2010/04/29 23:34:07 tom Exp $ + * $LynxId: HTString.c,v 1.62 2010/06/17 21:33:51 tom Exp $ * * Case-independent string comparison HTString.c * @@ -306,6 +306,7 @@ char *HTSACopy(char **dest, *dest = (char *) malloc(size); if (*dest == NULL) outofmem(__FILE__, "HTSACopy"); + assert(*dest != NULL); memcpy(*dest, src, size); } } else { @@ -326,11 +327,13 @@ char *HTSACat(char **dest, *dest = (char *) realloc(*dest, length + strlen(src) + 1); if (*dest == NULL) outofmem(__FILE__, "HTSACat"); + assert(*dest != NULL); strcpy(*dest + length, src); } else { *dest = (char *) malloc(strlen(src) + 1); if (*dest == NULL) outofmem(__FILE__, "HTSACat"); + assert(*dest != NULL); strcpy(*dest, src); } } @@ -358,12 +361,13 @@ char *HTSACopy_extra(char **dest, if (*dest != 0) { size = *(EXTRA_TYPE *) ((*dest) - EXTRA_SIZE); } - if (size < srcsize) { + if ((*dest == 0) || (size < srcsize)) { FREE_extra(*dest); size = srcsize * 2; /* x2 step */ *dest = (char *) malloc(size + EXTRA_SIZE); if (*dest == NULL) outofmem(__FILE__, "HTSACopy_extra"); + assert(*dest != NULL); *(EXTRA_TYPE *) (*dest) = size; *dest += EXTRA_SIZE; } @@ -581,6 +585,7 @@ static char *HTAlloc(char *ptr, size_t length) ptr = (char *) malloc(length); if (ptr == 0) outofmem(__FILE__, "HTAlloc"); + assert(ptr != NULL); return ptr; } @@ -638,8 +643,8 @@ PUBLIC_IF_FIND_LEAKS char *StrAllocVsprintf(char **pstr, if (vasprintf(&temp, fmt, *ap) >= 0) { if (dst_len != 0) { - int src_len = strlen(temp); - int new_len = dst_len + src_len + 1; + size_t src_len = strlen(temp); + size_t new_len = dst_len + src_len + 1; result = HTAlloc(pstr ? *pstr : 0, new_len); if (result != 0) { @@ -693,6 +698,8 @@ PUBLIC_IF_FIND_LEAKS char *StrAllocVsprintf(char **pstr, if ((fmt_ptr = malloc(need * NUM_WIDTH)) == 0 || (tmp_ptr = malloc(tmp_len)) == 0) { outofmem(__FILE__, "StrAllocVsprintf"); + assert(fmt_ptr != NULL); + assert(tmp_ptr != NULL); } #endif /* SAVE_TIME_NOT_SPACE */ @@ -1071,8 +1078,10 @@ void HTAddXpand(char **result, while (next[0] != 0) { if (HTIsParam(next)) { if (next != last) { - size_t len = (next - last) - + ((*result != 0) ? strlen(*result) : 0); + size_t len = ((size_t) (next - last) + + ((*result != 0) + ? strlen(*result) + : 0)); HTSACat(result, last); (*result)[len] = 0; @@ -1114,8 +1123,10 @@ void HTAddToCmd(char **result, while (next[0] != 0) { if (HTIsParam(next)) { if (next != last) { - size_t len = (next - last) - + ((*result != 0) ? strlen(*result) : 0); + size_t len = ((size_t) (next - last) + + ((*result != 0) + ? strlen(*result) + : 0)); HTSACat(result, last); (*result)[len] = 0; @@ -1182,7 +1193,7 @@ void HTSABCopy(bstring **dest, const char *src, int len) { bstring *t; - unsigned need = len + 1; + unsigned need = (unsigned) (len + 1); CTRACE2(TRACE_BSTRING, (tfp, "HTSABCopy(%p, %p, %d)\n", @@ -1204,7 +1215,7 @@ void HTSABCopy(bstring **dest, const char *src, assert(t->str != NULL); - memcpy(t->str, src, len); + memcpy(t->str, src, (size_t) len); t->len = len; t->str[t->len] = '\0'; *dest = t; @@ -1221,7 +1232,7 @@ void HTSABCopy(bstring **dest, const char *src, */ void HTSABCopy0(bstring **dest, const char *src) { - HTSABCopy(dest, src, strlen(src)); + HTSABCopy(dest, src, (int) strlen(src)); } /* @@ -1236,7 +1247,7 @@ void HTSABCat(bstring **dest, const char *src, (tfp, "HTSABCat(%p, %p, %d)\n", (void *) dest, (const void *) src, len)); if (src) { - unsigned need = len + 1; + unsigned need = (unsigned) (len + 1); if (TRACE_BSTRING) { CTRACE((tfp, "=== %4d:", len)); @@ -1244,7 +1255,7 @@ void HTSABCat(bstring **dest, const char *src, CTRACE((tfp, "\n")); } if (t) { - unsigned length = t->len + need; + unsigned length = (unsigned) t->len + need; t->str = (char *) realloc(t->str, length); } else { @@ -1260,7 +1271,7 @@ void HTSABCat(bstring **dest, const char *src, assert(t->str != NULL); - memcpy(t->str + t->len, src, len); + memcpy(t->str + t->len, src, (size_t) len); t->len += len; t->str[t->len] = '\0'; *dest = t; @@ -1277,7 +1288,7 @@ void HTSABCat(bstring **dest, const char *src, */ void HTSABCat0(bstring **dest, const char *src) { - HTSABCat(dest, src, strlen(src)); + HTSABCat(dest, src, (int) strlen(src)); } /* @@ -1285,12 +1296,12 @@ void HTSABCat0(bstring **dest, const char *src) */ BOOL HTSABEql(bstring *a, bstring *b) { - unsigned len_a = (a != 0) ? a->len : 0; - unsigned len_b = (b != 0) ? b->len : 0; + unsigned len_a = (unsigned) ((a != 0) ? a->len : 0); + unsigned len_b = (unsigned) ((b != 0) ? b->len : 0); if (len_a == len_b) { if (len_a == 0 - || memcmp(a->str, b->str, a->len) == 0) + || memcmp(a->str, b->str, (size_t) a->len) == 0) return TRUE; } return FALSE; @@ -1322,7 +1333,7 @@ bstring *HTBprintf(bstring **pstr, const char *fmt,...) { temp = StrAllocVsprintf(&temp, 0, fmt, &ap); if (non_empty(temp)) { - HTSABCat(pstr, temp, strlen(temp)); + HTSABCat(pstr, temp, (int) strlen(temp)); } FREE(temp); result = *pstr; diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index 8c420917..3be960dc 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTCP.c,v 1.100 2010/04/29 23:34:34 tom Exp $ + * $LynxId: HTTCP.c,v 1.101 2010/06/17 00:32:51 tom Exp $ * * Generic Communication Code HTTCP.c * ========================== @@ -260,7 +260,7 @@ unsigned int HTCardinal(int *pstatus, n = 0; while ((**pp >= '0') && (**pp <= '9')) - n = n * 10 + *((*pp)++) - '0'; + n = n * 10 + (unsigned) (*((*pp)++) - '0'); if (n > max_value) { *pstatus = -4; /* Cardinal outside range */ @@ -466,7 +466,7 @@ static size_t fill_rehostent(char *rehostent, if (!phost) return 0; - required_per_addr = phost->h_length + sizeof(char *); + required_per_addr = (size_t) phost->h_length + sizeof(char *); if (phost->h_addr_list) available -= sizeof(phost->h_addr_list[0]); @@ -517,9 +517,9 @@ static size_t fill_rehostent(char *rehostent, p_next_charptr = (char **) (rehostent + curlen); p_next_char = rehostent + curlen; if (phost->h_addr_list) - p_next_char += (num_addrs + 1) * sizeof(phost->h_addr_list[0]); + p_next_char += (size_t) (num_addrs + 1) * sizeof(phost->h_addr_list[0]); if (phost->h_aliases) - p_next_char += (num_aliases + 1) * sizeof(phost->h_aliases[0]); + p_next_char += (size_t) (num_aliases + 1) * sizeof(phost->h_aliases[0]); if (phost->h_addr_list) { data->h.h_addr_list = p_next_charptr; @@ -568,7 +568,7 @@ static size_t fill_rehostent(char *rehostent, } else { data->h.h_aliases = NULL; } - curlen = p_next_char - (char *) rehostent; + curlen = (size_t) (p_next_char - (char *) rehostent); return curlen; } @@ -637,7 +637,7 @@ static unsigned readit(int fd, char *buffer, unsigned length) unsigned result = 0; while (length != 0) { - unsigned got = read(fd, buffer, length); + unsigned got = (unsigned) read(fd, buffer, length); if (got != 0) { result += got; @@ -776,7 +776,8 @@ LYNX_HOSTENT *LYGetHostByName(char *str) * variables. */ int fpid, waitret; - int pfd[2], selret, readret; + int pfd[2], selret; + unsigned readret; #ifdef HAVE_TYPE_UNIONWAIT union wait waitstat; @@ -1045,7 +1046,7 @@ LYNX_HOSTENT *LYGetHostByName(char *str) #ifdef DEBUG_HOSTENT dump_hostent("Read from pipe", (LYNX_HOSTENT *) rehostent); #endif - if (readret == (int) statuses.rehostentlen) { + if (readret == statuses.rehostentlen) { got_rehostent = 1; result_phost = (LYNX_HOSTENT *) rehostent; lynx_nsl_status = HT_OK; @@ -1463,7 +1464,7 @@ static void get_host_details(void) LYNX_HOSTENT *phost; /* Pointer to host -- See netdb.h */ #endif /* INET6 */ #endif /* NEED_HOST_ADDRESS */ - int namelength = sizeof(name); + size_t namelength = sizeof(name); if (hostname) return; /* Already done */ @@ -1773,11 +1774,11 @@ int HTDoConnect(const char *url, FD_SET((unsigned) *s, &writefds); #ifdef SOCKS if (socks_flag) - ret = Rselect((unsigned) *s + 1, NULL, + ret = Rselect(*s + 1, NULL, &writefds, NULL, &select_timeout); else #endif /* SOCKS */ - ret = select((unsigned) *s + 1, + ret = select(*s + 1, NULL, &writefds, NULL, @@ -2040,11 +2041,11 @@ int HTDoRead(int fildes, FD_SET((unsigned) fildes, &readfds); #ifdef SOCKS if (socks_flag) - ret = Rselect((unsigned) fildes + 1, + ret = Rselect(fildes + 1, &readfds, NULL, NULL, &select_timeout); else #endif /* SOCKS */ - ret = select((unsigned) fildes + 1, + ret = select(fildes + 1, &readfds, NULL, NULL, &select_timeout); } while ((ret == -1) && (errno == EINTR)); diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index c5485a54..bd37e7f0 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTP.c,v 1.113 2010/04/30 00:00:13 tom Exp $ + * $LynxId: HTTP.c,v 1.115 2010/06/17 09:55:03 tom Exp $ * * HyperText Tranfer Protocol - Client implementation HTTP.c * ========================== @@ -525,7 +525,7 @@ static int HTLoadHTTP(const char *arg, BOOL auth_proxy = NO; /* Generate a proxy authorization. - AJL */ int length, rawlength, rv; - int server_status; + int server_status = 0; BOOL doing_redirect, already_retrying = FALSE; int len = 0; @@ -1987,7 +1987,8 @@ static int HTLoadHTTP(const char *arg, */ if (show_401) break; - if (HTAA_shouldRetryWithAuth(start_of_data, length, s, NO)) { + if (HTAA_shouldRetryWithAuth(start_of_data, (size_t) + length, s, NO)) { HTTP_NETCLOSE(s, handle); if (dump_output_immediately && !authentication_info[0]) { @@ -2037,7 +2038,8 @@ static int HTLoadHTTP(const char *arg, */ if (!using_proxy || show_407) break; - if (HTAA_shouldRetryWithAuth(start_of_data, length, s, YES)) { + if (HTAA_shouldRetryWithAuth(start_of_data, (size_t) + length, s, YES)) { HTTP_NETCLOSE(s, handle); if (dump_output_immediately && !proxyauth_info[0]) { diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index bc44693d..d55bf452 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.133 2010/04/30 08:28:32 tom Exp $ + * $LynxId: SGML.c,v 1.134 2010/06/16 23:27:40 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -1454,9 +1454,10 @@ static void SGML_free(HTStream *context) #ifdef USE_PRETTYSRC if (!psrc_view) /* Don't actually call on target if viewing psrc - kw */ #endif - (*context->actions->end_element) (context->target, - NORMAL_TAGNUM(TAGNUM_OF_TAGP(t)), - &context->include); + (*context->actions->end_element) + (context->target, + (int) NORMAL_TAGNUM(TAGNUM_OF_TAGP(t)), + &context->include); FREE(context->include); } @@ -1628,13 +1629,8 @@ static void SGML_character(HTStream *context, char c_in) UCode_t clong, uck = 0; /* Enough bits for UCS4 ... */ int testlast; -#ifdef CJK_EX unsigned char c; - -#else - char c; -#endif - char saved_char_in = '\0'; + unsigned char saved_char_in = '\0'; ++sgml_offset; @@ -1644,7 +1640,7 @@ static void SGML_character(HTStream *context, char c_in) */ #define unsign_c clong - c = c_in; + c = UCH(c_in); clong = UCH(c); /* a.k.a. unsign_c */ if (context->T.decode_utf8) { @@ -1659,7 +1655,7 @@ static void SGML_character(HTStream *context, char c_in) if (context->utf_count > 0 && (TOASCII(c) & 0xc0) == 0x80) { context->utf_char = (context->utf_char << 6) | (TOASCII(c) & 0x3f); context->utf_count--; - *(context->utf_buf_p) = c; + *(context->utf_buf_p) = (char) c; (context->utf_buf_p)++; if (context->utf_count == 0) { /* @@ -1669,7 +1665,7 @@ static void SGML_character(HTStream *context, char c_in) *(context->utf_buf_p) = '\0'; clong = context->utf_char; if (clong < 256) { - c = ((char) (clong & 0xff)); + c = UCH(clong & 0xff); } /* lynx does not use left-to-right */ if (clong == 0x200e) @@ -1686,7 +1682,7 @@ static void SGML_character(HTStream *context, char c_in) * Start handling a new multibyte character. - FM */ context->utf_buf_p = context->utf_buf; - *(context->utf_buf_p) = c; + *(context->utf_buf_p) = (char) c; (context->utf_buf_p)++; if ((c & 0xe0) == 0xc0) { context->utf_count = 1; @@ -1748,13 +1744,13 @@ static void SGML_character(HTStream *context, char c_in) if (context->utf_count == 0) { if (IS_SJIS_HI1((unsigned char) c) || IS_SJIS_HI2((unsigned char) c)) { - context->utf_buf[0] = c; + context->utf_buf[0] = (char) c; context->utf_count = 1; clong = -11; } } else { if (IS_SJIS_LO((unsigned char) c)) { - context->utf_buf[1] = c; + context->utf_buf[1] = (char) c; clong = UCTransJPToUni(context->utf_buf, 2, context->inUCLYhndl); } context->utf_count = 0; @@ -1762,13 +1758,13 @@ static void SGML_character(HTStream *context, char c_in) } else { if (context->utf_count == 0) { if (IS_EUC_HI((unsigned char) c)) { - context->utf_buf[0] = c; + context->utf_buf[0] = (char) c; context->utf_count = 1; clong = -11; } } else { if (IS_EUC_LOX((unsigned char) c)) { - context->utf_buf[1] = c; + context->utf_buf[1] = (char) c; clong = UCTransJPToUni(context->utf_buf, 2, context->inUCLYhndl); } context->utf_count = 0; @@ -1783,11 +1779,11 @@ static void SGML_character(HTStream *context, char c_in) /* * Convert the octet to Unicode. - FM */ - clong = UCTransToUni(c, context->inUCLYhndl); + clong = UCTransToUni((char) c, context->inUCLYhndl); if (clong > 0) { saved_char_in = c; if (clong < 256) { - c = FROMASCII((char) clong); + c = FROMASCII(UCH(clong)); } } goto top1; @@ -1797,23 +1793,23 @@ static void SGML_character(HTStream *context, char c_in) * This else if may be too ugly to keep. - KW */ if (context->T.trans_from_uni && - (((clong = UCTransToUni(c, context->inUCLYhndl)) >= ' ') || + (((clong = UCTransToUni((char) c, context->inUCLYhndl)) >= ' ') || (context->T.transp && - (clong = UCTransToUni(c, context->inUCLYhndl)) > 0))) { + (clong = UCTransToUni((char) c, context->inUCLYhndl)) > 0))) { saved_char_in = c; if (clong < 256) { - c = FROMASCII((char) clong); + c = FROMASCII(UCH(clong)); } goto top1; } else { uck = -1; if (context->T.transp) { - uck = UCTransCharStr(replace_buf, 60, c, + uck = UCTransCharStr(replace_buf, 60, (char) c, context->inUCLYhndl, context->inUCLYhndl, NO); } if (!context->T.transp || uck < 0) { - uck = UCTransCharStr(replace_buf, 60, c, + uck = UCTransCharStr(replace_buf, 60, (char) c, context->inUCLYhndl, context->outUCLYhndl, YES); } @@ -1822,7 +1818,7 @@ static void SGML_character(HTStream *context, char c_in) } else if (uck < 0) { goto top0a; } - c = replace_buf[0]; + c = UCH(replace_buf[0]); if (c && replace_buf[1]) { if (context->state == S_text) { PUTS(replace_buf); @@ -2101,9 +2097,9 @@ static void SGML_character(HTStream *context, char c_in) PUTC(c); } else if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && - UCH(saved_char_in) >= + saved_char_in >= LYlowest_eightbit[context->outUCLYhndl]) { - PUTUTF8((0xf000 | UCH(saved_char_in))); + PUTUTF8((0xf000 | saved_char_in)); } else { PUTUTF8(clong); } @@ -2240,13 +2236,13 @@ static void SGML_character(HTStream *context, char c_in) * Check for a strippable koi8-r 8-bit character. - FM */ } else if (context->T.strip_raw_char_in && saved_char_in && - (UCH(saved_char_in) >= 0xc0) && - (UCH(saved_char_in) < 255)) { + (saved_char_in >= 0xc0) && + (saved_char_in < 255)) { /* * KOI8 special: strip high bit, gives (somewhat) readable ASCII * or KOI7 - it was constructed that way! - KW */ - PUTC(((char) (saved_char_in & 0x7f))); + PUTC((saved_char_in & 0x7f)); saved_char_in = '\0'; #endif /* NOTDEFINED */ /* @@ -2629,15 +2625,18 @@ static void SGML_character(HTStream *context, char c_in) /* * Terminate the numeric entity and try to handle it. - FM */ - unsigned long code; + unsigned long lcode; int i; HTChunkTerminate(string); #ifdef USE_PRETTYSRC entity_string = string->data; #endif - if ((context->isHex ? sscanf(string->data, "%lx", &code) : - sscanf(string->data, "%lu", &code)) == 1) { + if ((context->isHex + ? sscanf(string->data, "%lx", &lcode) + : sscanf(string->data, "%lu", &lcode)) == 1) { + UCode_t code = (UCode_t) lcode; + /* =============== work in ASCII below here =============== S/390 -- gil -- 1092 */ code = LYcp1252ToUnicode(code); /* @@ -3090,7 +3089,7 @@ static void SGML_character(HTStream *context, char c_in) * Clear out attributes. */ memset((void *) context->present, 0, sizeof(BOOL) * - context->current_tag->number_of_attributes); + (unsigned) (context->current_tag->number_of_attributes)); } string->size = 0; @@ -3304,10 +3303,10 @@ static void SGML_character(HTStream *context, char c_in) context->T.trans_from_uni)) { if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && - UCH(saved_char_in) >= + saved_char_in >= LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, - (0xf000 | UCH(saved_char_in))); + (0xf000 | saved_char_in)); } else { HTChunkPutUtf8Char(string, clong); } @@ -3714,10 +3713,10 @@ static void SGML_character(HTStream *context, char c_in) context->T.trans_from_uni)) { if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && - UCH(saved_char_in) >= + saved_char_in >= LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, - (0xf000 | UCH(saved_char_in))); + (0xf000 | saved_char_in)); } else { HTChunkPutUtf8Char(string, clong); } @@ -3754,10 +3753,10 @@ static void SGML_character(HTStream *context, char c_in) context->T.trans_from_uni)) { if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && - UCH(saved_char_in) >= + saved_char_in >= LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, - (0xf000 | UCH(saved_char_in))); + (0xf000 | saved_char_in)); } else { HTChunkPutUtf8Char(string, clong); } @@ -3774,7 +3773,7 @@ static void SGML_character(HTStream *context, char c_in) c == '>')) { /* as a co-terminator of dquoted and tag */ HTChunkTerminate(string); #ifdef USE_PRETTYSRC - if (!end_if_prettysrc(context, string, c)) + if (!end_if_prettysrc(context, string, (char) c)) #endif handle_attribute_value(context, string->data); string->size = 0; @@ -3798,10 +3797,10 @@ static void SGML_character(HTStream *context, char c_in) context->T.trans_from_uni)) { if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && - UCH(saved_char_in) >= + saved_char_in >= LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, - (0xf000 | UCH(saved_char_in))); + (0xf000 | saved_char_in)); } else { HTChunkPutUtf8Char(string, clong); } @@ -4250,7 +4249,7 @@ static void SGML_character(HTStream *context, char c_in) FREE(context->recover); context->recover_index = 0; } else { - c = context->recover[context->recover_index]; + c = UCH(context->recover[context->recover_index]); context->recover_index++; goto top; } @@ -4275,10 +4274,10 @@ static void SGML_character(HTStream *context, char c_in) */ char *puni = context->active_include + context->include_index; - c = *puni; + c = UCH(*puni); clong = UCGetUniFromUtf8String(&puni); if (clong < 256 && clong >= 0) { - c = ((char) (clong & 0xff)); + c = UCH((clong & 0xff)); } saved_char_in = '\0'; context->include_index = puni - context->active_include + 1; @@ -4288,7 +4287,7 @@ static void SGML_character(HTStream *context, char c_in) * Otherwise assume no UTF-8 - do charset-naive processing and * hope for the best. - kw */ - c = context->active_include[context->include_index]; + c = UCH(context->active_include[context->include_index]); context->include_index++; goto top; } @@ -4304,7 +4303,7 @@ static void SGML_character(HTStream *context, char c_in) FREE(context->csi); context->csi_index = 0; } else { - c = context->csi[context->csi_index]; + c = UCH(context->csi[context->csi_index]); context->csi_index++; goto top; } @@ -4326,7 +4325,7 @@ static void InferUtfFromBom(HTStream *context, int chndl) static void SGML_widechar(HTStream *context, long ch) { if (!UCPutUtf8_charstring(context, SGML_character, ch)) { - SGML_character(context, UCH(ch)); + SGML_character(context, (char) ch); } } @@ -4373,7 +4372,7 @@ static void SGML_write(HTStream *context, const char *str, int l) static void SGML_string(HTStream *context, const char *str) { - SGML_write(context, str, strlen(str)); + SGML_write(context, str, (int) strlen(str)); } /*_______________________________________________________________________ @@ -4597,8 +4596,8 @@ void JISx0201TO0208_EUC(unsigned char IHI, }; if ((IHI == 0x8E) && (ILO >= 0xA1) && (ILO <= 0xDF)) { - *OHI = table[ILO - 0xA1][0]; - *OLO = table[ILO - 0xA1][1]; + *OHI = UCH(table[ILO - 0xA1][0]); + *OLO = UCH(table[ILO - 0xA1][1]); } else { *OHI = IHI; *OLO = ILO; @@ -4620,39 +4619,39 @@ static int IS_SJIS_STR(const unsigned char *str) return 0; } -unsigned char *SJIS_TO_JIS1(register unsigned char HI, - register unsigned char LO, - register unsigned char *JCODE) +unsigned char *SJIS_TO_JIS1(unsigned char HI, + unsigned char LO, + unsigned char *JCODE) { - HI -= UCH((HI <= 0x9F) ? 0x71 : 0xB1); + HI = UCH(HI - UCH((HI <= 0x9F) ? 0x71 : 0xB1)); HI = UCH((HI << 1) + 1); if (0x7F < LO) LO--; if (0x9E <= LO) { - LO -= UCH(0x7D); + LO = UCH(LO - UCH(0x7D)); HI++; } else { - LO -= UCH(0x1F); + LO = UCH(LO - UCH(0x1F)); } JCODE[0] = HI; JCODE[1] = LO; return JCODE; } -unsigned char *JIS_TO_SJIS1(register unsigned char HI, - register unsigned char LO, - register unsigned char *SJCODE) +unsigned char *JIS_TO_SJIS1(unsigned char HI, + unsigned char LO, + unsigned char *SJCODE) { if (HI & 1) - LO += UCH(0x1F); + LO = UCH(LO + UCH(0x1F)); else - LO += UCH(0x7D); + LO = UCH(LO + UCH(0x7D)); if (0x7F <= LO) LO++; HI = UCH(((HI - 0x21) >> 1) + 0x81); if (0x9F < HI) - HI += UCH(0x40); + HI = UCH(HI + UCH(0x40)); SJCODE[0] = HI; SJCODE[1] = LO; return SJCODE; @@ -4660,7 +4659,7 @@ unsigned char *JIS_TO_SJIS1(register unsigned char HI, unsigned char *EUC_TO_SJIS1(unsigned char HI, unsigned char LO, - register unsigned char *SJCODE) + unsigned char *SJCODE) { if (HI == 0x8E) JISx0201TO0208_EUC(HI, LO, &HI, &LO); @@ -4668,9 +4667,9 @@ unsigned char *EUC_TO_SJIS1(unsigned char HI, return SJCODE; } -void JISx0201TO0208_SJIS(register unsigned char I, - register unsigned char *OHI, - register unsigned char *OLO) +void JISx0201TO0208_SJIS(unsigned char I, + unsigned char *OHI, + unsigned char *OLO) { unsigned char SJCODE[2]; @@ -4693,8 +4692,8 @@ unsigned char *SJIS_TO_EUC1(unsigned char HI, unsigned char *SJIS_TO_EUC(unsigned char *src, unsigned char *dst) { - register unsigned char hi, lo, *sp, *dp; - register int in_sjis = 0; + unsigned char hi, lo, *sp, *dp; + int in_sjis = 0; in_sjis = IS_SJIS_STR(src); for (sp = src, dp = dst; (hi = sp[0]) != '\0';) { @@ -4715,7 +4714,7 @@ unsigned char *SJIS_TO_EUC(unsigned char *src, unsigned char *EUC_TO_SJIS(unsigned char *src, unsigned char *dst) { - register unsigned char *sp, *dp; + unsigned char *sp, *dp; for (sp = src, dp = dst; *sp;) { if (*sp & 0x80) { @@ -4741,10 +4740,10 @@ unsigned char *EUC_TO_JIS(unsigned char *src, const char *toK, const char *toA) { - register unsigned char kana_mode = 0; - register unsigned char cch; - register unsigned char *sp = src; - register unsigned char *dp = dst; + unsigned char kana_mode = 0; + unsigned char cch; + unsigned char *sp = src; + unsigned char *dp = dst; int is_JIS = 0; while ((cch = *sp++) != '\0') { @@ -4813,11 +4812,11 @@ static const unsigned char *repairJIStoEUC(const unsigned char *src, unsigned char *TO_EUC(const unsigned char *jis, unsigned char *euc) { - register const unsigned char *s; - register unsigned char c, jis_stat; + const unsigned char *s; + unsigned char c, jis_stat; unsigned char *d; - register int to1B, to2B; - register int in_sjis = 0; + int to1B, to2B; + int in_sjis = 0; static int nje; int n8bits; int is_JIS; diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h index 392fbd99..cc3bddd0 100644 --- a/WWW/Library/Implementation/www_tcp.h +++ b/WWW/Library/Implementation/www_tcp.h @@ -1,5 +1,5 @@ /* System dependencies in the W3 library - * $LynxId: www_tcp.h,v 1.39 2009/03/09 22:43:29 Doug.Kaufman Exp $ + * $LynxId: www_tcp.h,v 1.40 2010/06/16 23:46:28 tom Exp $ * SYSTEM DEPENDENCIES @@ -330,8 +330,8 @@ VAX/VMS #undef NETWRITE #undef NETCLOSE #define SOCKET_READ(s,b,l) ((s)>10 ? netread((s),(b),(l)) : read((s),(b),(l))) -#define NETWRITE(s,b,l) ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l))) -#define NETCLOSE(s) ((s)>10 ? netclose(s) : close(s)) +#define NETWRITE(s,b,l) ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l))) +#define NETCLOSE(s) ((s)>10 ? netclose(s) : close(s)) #undef IOCTL #define IOCTL(a,b,c) -1 /* disables ioctl function */ #define NO_IOCTL /* flag to check if ioctl is disabled */ @@ -343,9 +343,9 @@ VAX/VMS #undef NETWRITE #undef NETCLOSE #define SOCKET_READ(s,b,l) (cmu_get_sdc((s)) != 0 ? cmu_read((s),(b),(l)) : read((s),(b),(l))) -#define NETREAD(s,b,l) (cmu_get_sdc((s)) != 0 ? HTDoRead((s),(b),(l)) : read((s),(b),(l))) -#define NETWRITE(s,b,l) (cmu_get_sdc((s)) != 0 ? cmu_write((s),(b),(l)) : write((s),(b),(l))) -#define NETCLOSE(s) (cmu_get_sdc((s)) != 0 ? cmu_close((s)) : close((s))) +#define NETREAD(s,b,l) (cmu_get_sdc((s)) != 0 ? HTDoRead((s),(b),(l)) : read((s),(b),(l))) +#define NETWRITE(s,b,l) (cmu_get_sdc((s)) != 0 ? cmu_write((s),(b),(l)) : write((s),(b),(l))) +#define NETCLOSE(s) (cmu_get_sdc((s)) != 0 ? cmu_close((s)) : close((s))) #endif /* CMU_TCP */ #ifdef MULTINET @@ -367,9 +367,9 @@ extern int socket_ioctl(); #define SOCKET_READ(s,b,l) ((s)>10 ? socket_read((s),(b),(l)) : \ read((s),(b),(l))) -#define NETWRITE(s,b,l) ((s)>10 ? socket_write((s),(b),(l)) : \ +#define NETWRITE(s,b,l) ((s)>10 ? socket_write((s),(b),(l)) : \ write((s),(b),(l))) -#define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s)) +#define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s)) #define IOCTL socket_ioctl #define SOCKET_ERRNO socket_errno #endif /* MULTINET */ @@ -380,13 +380,13 @@ extern int socket_ioctl(); #undef NETWRITE #undef NETCLOSE #undef IOCTL -#define SOCKET_READ(s,b,l) (si_get_sdc((s)) != 0 ? si_read((s),(b),(l)) : \ +#define SOCKET_READ(s,b,l) (si_get_sdc((s)) != 0 ? si_read((s),(b),(l)) : \ read((s),(b),(l))) -#define NETREAD(s,b,l) (si_get_sdc((s)) != 0 ? HTDoRead((s),(b),(l)) : \ +#define NETREAD(s,b,l) (si_get_sdc((s)) != 0 ? HTDoRead((s),(b),(l)) : \ read((s),(b),(l))) -#define NETWRITE(s,b,l) (si_get_sdc((s)) != 0 ? si_write((s),(b),(l)) : \ +#define NETWRITE(s,b,l) (si_get_sdc((s)) != 0 ? si_write((s),(b),(l)) : \ write((s),(b),(l))) -#define NETCLOSE(s) (si_get_sdc((s)) != 0 ? si_close((s)) : close((s))) +#define NETCLOSE(s) (si_get_sdc((s)) != 0 ? si_close((s)) : close((s))) #define IOCTL si_ioctl #endif /* SOCKETSHR_TCP */ |