From: serassio <> Date: Sun, 3 Jul 2005 21:25:03 +0000 (+0000) Subject: Bug #767: Problems making Squid 3.0 PRE3 64 bit X-Git-Tag: SQUID_3_0_PRE4~710 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=137a13ea244569b00330496ed19de4f90eb9cace;p=thirdparty%2Fsquid.git Bug #767: Problems making Squid 3.0 PRE3 64 bit Fixed the following on HP Tru64 and probably on some other 64 bit platforms: - assert() must test logical expressions, not pointers - STATUS define conflict in parse.c (snmplib) - Warnings SMB, fakeauth and MSNT helpers - Various debug() ==> debugs() changes - Alpha asm access to CPU profiling info - timezone should be long, not time_t - Various clean of ESI code - assert() definition problem in diskd.cc --- diff --git a/helpers/basic_auth/MSNT/smblib-util.c b/helpers/basic_auth/MSNT/smblib-util.c index 7a8e546601..fcc7de0ae4 100644 --- a/helpers/basic_auth/MSNT/smblib-util.c +++ b/helpers/basic_auth/MSNT/smblib-util.c @@ -256,7 +256,6 @@ SMB_Negotiate(SMB_Handle_Type Con_Handle, const char *Prots[]) Con_Handle->Encrypt_Key_Len = SVAL(SMB_Hdr(pkt), SMB_negrLM_ekl_offset); p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset); - fprintf(stderr, "%d", (int) (SMB_Hdr(pkt) + SMB_negrLM_buf_offset)); memcpy(Con_Handle->Encrypt_Key, p, 8); p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset + Con_Handle->Encrypt_Key_Len); diff --git a/helpers/basic_auth/MSNT/smblib.c b/helpers/basic_auth/MSNT/smblib.c index be82e009e2..d9b202b902 100644 --- a/helpers/basic_auth/MSNT/smblib.c +++ b/helpers/basic_auth/MSNT/smblib.c @@ -27,6 +27,7 @@ int SMBlib_errno; int SMBlib_SMB_Error; #define SMBLIB_ERRNO #define uchar unsigned char +#include "util.h" #include "smblib-priv.h" #include "smblib.h" #include "rfcnb-priv.h" @@ -127,12 +128,12 @@ SMB_Connect_Server(SMB_Handle_Type Con_Handle, * service we are going to call, sine some servers want it in uppercase */ for (i = 0; i < strlen(server); i++) - called[i] = toupper(server[i]); + called[i] = xtoupper(server[i]); called[strlen(server)] = 0; /* Make it a string */ for (i = 0; i < strlen(con->myname); i++) - calling[i] = toupper(con->myname[i]); + calling[i] = xtoupper(con->myname[i]); calling[strlen(con->myname)] = 0; /* Make it a string */ @@ -229,12 +230,12 @@ SMB_Connect(SMB_Handle_Type Con_Handle, * service we are going to call, sine some servers want it in uppercase */ for (i = 0; i < strlen(host); i++) - called[i] = toupper(host[i]); + called[i] = xtoupper(host[i]); called[strlen(host)] = 0; /* Make it a string */ for (i = 0; i < strlen(con->myname); i++) - calling[i] = toupper(con->myname[i]); + calling[i] = xtoupper(con->myname[i]); calling[strlen(con->myname)] = 0; /* Make it a string */ diff --git a/helpers/ntlm_auth/SMB/ntlm_auth.c b/helpers/ntlm_auth/SMB/ntlm_auth.c index 8bd47060e7..0ed3258907 100644 --- a/helpers/ntlm_auth/SMB/ntlm_auth.c +++ b/helpers/ntlm_auth/SMB/ntlm_auth.c @@ -82,7 +82,7 @@ uc(char *string) { char *p = string, c; while ((c = *p)) { - *p = toupper(c); + *p = xtoupper(c); p++; } } @@ -93,7 +93,7 @@ lc(char *string) { char *p = string, c; while ((c = *p)) { - *p = tolower(c); + *p = xtolower(c); p++; } } diff --git a/helpers/ntlm_auth/SMB/smbval/smbencrypt.c b/helpers/ntlm_auth/SMB/smbval/smbencrypt.c index 008b240841..41b5cbcbb1 100644 --- a/helpers/ntlm_auth/SMB/smbval/smbencrypt.c +++ b/helpers/ntlm_auth/SMB/smbval/smbencrypt.c @@ -200,7 +200,7 @@ strupper(char *s) * #endif *//* KANJI_WIN95_COMPATIBILITY */ { if (islower((int)(unsigned char)*s)) - *s = toupper(*s); + *s = xtoupper(*s); s++; } } diff --git a/helpers/ntlm_auth/SMB/smbval/smblib.c b/helpers/ntlm_auth/SMB/smbval/smblib.c index d22a01e5f0..179a6cee47 100644 --- a/helpers/ntlm_auth/SMB/smbval/smblib.c +++ b/helpers/ntlm_auth/SMB/smbval/smblib.c @@ -171,12 +171,12 @@ SMB_Connect_Server(SMB_Handle_Type Con_Handle, * service we are going to call, sine some servers want it in uppercase */ for (i = 0; i < strlen(server); i++) - called[i] = toupper(server[i]); + called[i] = xtoupper(server[i]); called[strlen(server)] = 0; /* Make it a string */ for (i = 0; i < strlen(con->myname); i++) - calling[i] = toupper(con->myname[i]); + calling[i] = xtoupper(con->myname[i]); calling[strlen(con->myname)] = 0; /* Make it a string */ @@ -272,12 +272,12 @@ SMB_Connect(SMB_Handle_Type Con_Handle, * service we are going to call, sine some servers want it in uppercase */ for (i = 0; i < strlen(host); i++) - called[i] = toupper(host[i]); + called[i] = xtoupper(host[i]); called[strlen(host)] = 0; /* Make it a string */ for (i = 0; i < strlen(con->myname); i++) - calling[i] = toupper(con->myname[i]); + calling[i] = xtoupper(con->myname[i]); calling[strlen(con->myname)] = 0; /* Make it a string */ diff --git a/helpers/ntlm_auth/SMB/smbval/std-includes.h b/helpers/ntlm_auth/SMB/smbval/std-includes.h index d772c1dd75..1bd081c1eb 100644 --- a/helpers/ntlm_auth/SMB/smbval/std-includes.h +++ b/helpers/ntlm_auth/SMB/smbval/std-includes.h @@ -24,6 +24,7 @@ */ /* the types are provided by squid's configure preocess */ +#include "util.h" #define BOOL int16_t #define int16 int16_t diff --git a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c index b74a2b4bda..3421073287 100644 --- a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c +++ b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c @@ -57,7 +57,7 @@ lc(char *string) { char *p = string, c; while ((c = *p)) { - *p = tolower(c); + *p = xtolower(c); p++; } } diff --git a/include/profiling.h b/include/profiling.h index 6766cb22bd..02f35a11e5 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -30,7 +30,7 @@ get_tick(void) { hrtime_t regs; -asm volatile ("rpcc $0":"=A" (regs)); /* I'm not sure of syntax */ +asm volatile ("rpcc %0" : "=r" (regs)); return regs; } @@ -39,6 +39,7 @@ static __inline hrtime_t get_tick(void) { hrtime_t regs; + __asm { cpuid rdtsc diff --git a/lib/hash.c b/lib/hash.c index 9d2b6272de..0ff9c86a9b 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -1,6 +1,6 @@ /* - * $Id: hash.c,v 1.17 2004/12/21 17:28:28 robertc Exp $ + * $Id: hash.c,v 1.18 2005/07/03 15:25:07 serassio Exp $ * * DEBUG: section 0 Hash Tables * AUTHOR: Harvest Derived @@ -244,7 +244,7 @@ hash_next(hash_table * hid) void hash_last(hash_table * hid) { - assert(hid); + assert(hid != NULL); hid->next = NULL; hid->current_slot = 0; } @@ -312,7 +312,7 @@ hashFreeItems(hash_table * hid, HASHFREE * free_func) void hashFreeMemory(hash_table * hid) { - assert(hid); + assert(hid != NULL); if (hid->buckets) xfree(hid->buckets); xfree(hid); diff --git a/lib/heap.c b/lib/heap.c index 3fbc9dc03f..9daefcf213 100644 --- a/lib/heap.c +++ b/lib/heap.c @@ -1,6 +1,6 @@ /* - * $Id: heap.c,v 1.9 2003/01/23 00:37:01 robertc Exp $ + * $Id: heap.c,v 1.10 2005/07/03 15:25:07 serassio Exp $ * * AUTHOR: John Dilley, Hewlett Packard * @@ -122,7 +122,7 @@ void delete_heap(heap * hp) { int i; - assert(hp); + assert(hp != NULL); for (i = 0; i < hp->last; i++) { xfree(hp->nodes[i]); } diff --git a/lib/rfc1123.c b/lib/rfc1123.c index cb31fcac29..6ea50f7ad4 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -1,6 +1,6 @@ /* - * $Id: rfc1123.c,v 1.34 2005/03/09 20:02:06 serassio Exp $ + * $Id: rfc1123.c,v 1.35 2005/07/03 15:25:07 serassio Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -231,7 +231,7 @@ parse_rfc1123(const char *str) #elif defined(_SQUID_CYGWIN_) #elif defined(_SQUID_MSWIN_) #else - extern time_t timezone; + extern long timezone; #endif /* * The following assumes a fixed DST offset of 1 hour, diff --git a/lib/util.c b/lib/util.c index da822b64b0..064eab67aa 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1,6 +1,6 @@ /* - * $Id: util.c,v 1.92 2004/12/21 17:28:28 robertc Exp $ + * $Id: util.c,v 1.93 2005/07/03 15:25:07 serassio Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -631,7 +631,7 @@ xstrndup(const char *s, size_t n) size_t sz; void *p; PROF_start(xstrndup); - assert(s); + assert(s != NULL); assert(n); sz = strlen(s) + 1; if (sz > n) diff --git a/snmplib/mib.c b/snmplib/mib.c index 20b169a27e..69348ca585 100644 --- a/snmplib/mib.c +++ b/snmplib/mib.c @@ -128,11 +128,11 @@ lc_cmp(const char *s1, const char *s2) while (*s1 && *s2) { if (xisupper(*s1)) - c1 = tolower(*s1); + c1 = xtolower(*s1); else c1 = *s1; if (xisupper(*s2)) - c2 = tolower(*s2); + c2 = xtolower(*s2); else c2 = *s2; if (c1 != c2) diff --git a/snmplib/parse.c b/snmplib/parse.c index 537e61144d..98dd796dc2 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c @@ -135,7 +135,7 @@ int Line = 1; #define WRITEONLY 20 #undef NOACCESS #define NOACCESS 21 -#define STATUS 22 +#define SNMP_STATUS 22 #define MANDATORY 23 #define SNMP_OPTIONAL 24 #define OBSOLETE 25 @@ -193,7 +193,7 @@ struct tok tokens[] = {"read-only", sizeof("read-only") - 1, READONLY}, {"ACCESS", sizeof("ACCESS") - 1, ACCESS}, {"MAX-ACCESS", sizeof("MAX-ACCESS") - 1, ACCESS}, - {"STATUS", sizeof("STATUS") - 1, STATUS}, + {"STATUS", sizeof("STATUS") - 1, SNMP_STATUS}, {"SYNTAX", sizeof("SYNTAX") - 1, SYNTAX}, {"OBJECT-TYPE", sizeof("OBJECT-TYPE") - 1, OBJTYPE}, {"{", sizeof("{") - 1, LEFTBRACKET}, @@ -867,7 +867,7 @@ parse_objecttype(register FILE *fp, char *name) return 0; } type = get_token(fp, token); - if (type != STATUS) { + if (type != SNMP_STATUS) { print_error("Should be STATUS", token, nexttype); free_node(np); return 0; diff --git a/src/DiskIO/DiskDaemon/diskd.cc b/src/DiskIO/DiskDaemon/diskd.cc index 4ff44af369..9eacbb3c2e 100644 --- a/src/DiskIO/DiskDaemon/diskd.cc +++ b/src/DiskIO/DiskDaemon/diskd.cc @@ -1,5 +1,5 @@ /* - * $Id: diskd.cc,v 1.2 2004/12/21 15:47:33 robertc Exp $ + * $Id: diskd.cc,v 1.3 2005/07/03 15:25:09 serassio Exp $ * * DEBUG: section -- External DISKD process implementation. * AUTHOR: Harvest Derived @@ -41,9 +41,13 @@ #include "DiskIO/DiskDaemon/diomsg.h" -#undef assert -#include +void +xassert(const char *msg, const char *file, int line) +{ + fprintf(stderr,"assertion failed: %s:%d: \"%s\"\n", file, line, msg); + abort(); +} const int diomsg::msg_snd_rcv_sz = sizeof(diomsg) - sizeof(mtyp_t); #define DEBUG(LEVEL) if ((LEVEL) <= DebugLevel) diff --git a/src/ESI.cc b/src/ESI.cc index 91fe165527..84e0a31ef9 100644 --- a/src/ESI.cc +++ b/src/ESI.cc @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.14 2005/06/03 15:24:14 serassio Exp $ + * $Id: ESI.cc,v 1.15 2005/07/03 15:25:08 serassio Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -688,7 +688,7 @@ ESIContext::send () cbdataReferenceDone (templock); - debug (86,5)("ESIContext::send: this=%p sent %d\n",this,len); + debugs (86,5,"ESIContext::send: this=" << this << " sent " << len); return len; } @@ -785,7 +785,7 @@ esiProcessStream (clientStreamNode *thisNode, clientHttpRequest *http, HttpReply /* Increase our buffer area with incoming data */ assert (recievedData.length <= HTTP_REQBUF_SZ); assert (thisNode->readBuffer.offset == recievedData.offset); - debug (86,5)("esiProcessStream found %u bytes of body data at offset %ld\n", recievedData.length, (long)recievedData.offset); + debugs (86,5, "esiProcessStream found " << recievedData.length << " bytes of body data at offset " << recievedData.offset); /* secure the data for later use */ if (!context->incoming.getRaw()) { @@ -1187,7 +1187,7 @@ ESIContext::parserComment (const char *s) debug (86,0)("ESIContext::parserComment: Parsing fragment '%s' failed.\n", s + 3); setError(); char tempstr[1024]; - snprintf(tempstr, 1023, "ESIContext::parserComment: Parse error at line %d:\n%s\n", + snprintf(tempstr, 1023, "ESIContext::parserComment: Parse error at line %ld:\n%s\n", tempParser->lineNumber(), tempParser->errorString()); debug (86,0)("%s",tempstr); @@ -1243,13 +1243,13 @@ ESIContext::parseOneBuffer() { assert (buffered.getRaw()); - debug (86,9)("ESIContext::parseOneBuffer: %d bytes\n",buffered->len); + debugs (86,9,"ESIContext::parseOneBuffer: " << buffered->len << " bytes"); bool lastBlock = buffered->next.getRaw() == NULL && flags.finishedtemplate ? true : false; if (! parserState.theParser->parse(buffered->buf, buffered->len, lastBlock)) { setError(); char tempstr[1024]; - snprintf (tempstr, 1023, "esiProcess: Parse error at line %d:\n%s\n", + snprintf (tempstr, 1023, "esiProcess: Parse error at line %ld:\n%s\n", parserState.theParser->lineNumber(), parserState.theParser->errorString()); debug (86,0)("%s", tempstr); @@ -2060,13 +2060,13 @@ esiChoose::addElement(ESIElement::Pointer element) } else { elements.push_back (element); - debug (86,3)("esiChooseAdd: Added a new element, elements = %d\n", elements.size()); + debugs (86,3, "esiChooseAdd: Added a new element, elements = " << elements.size()); if (chosenelement == -1) if ((dynamic_cast(element.getRaw()))-> testsTrue()) { chosenelement = elements.size() - 1; - debug (86,3)("esiChooseAdd: Chose element %d\n", elements.size()); + debugs (86,3, "esiChooseAdd: Chose element " << elements.size()); } } @@ -2083,7 +2083,7 @@ esiChoose::selectElement() if ((dynamic_cast(elements[counter].getRaw()))-> testsTrue()) { chosenelement = counter; - debug (86,3)("esiChooseAdd: Chose element %d\n", counter + 1); + debugs (86,3, "esiChooseAdd: Chose element " << counter + 1); return; } } diff --git a/src/ESICustomParser.cc b/src/ESICustomParser.cc index 3e98703759..1badccf325 100644 --- a/src/ESICustomParser.cc +++ b/src/ESICustomParser.cc @@ -1,6 +1,6 @@ /* - * $Id: ESICustomParser.cc,v 1.6 2005/03/28 21:44:12 hno Exp $ + * $Id: ESICustomParser.cc,v 1.7 2005/07/03 15:25:08 serassio Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -51,14 +51,20 @@ ESICustomParser::GetTrie() SearchTrie = new Trie(new TrieCaseless); + static const ESITAG_t ESITAG_value = ESITAG; + assert (SearchTrie->add - ("add - ("add - ("