diff --git a/src/libCom/Makefile.Vx b/src/libCom/Makefile.Vx index 7ef37caf3..66ae7d573 100644 --- a/src/libCom/Makefile.Vx +++ b/src/libCom/Makefile.Vx @@ -15,7 +15,7 @@ SRCS.c = \ OBJS = \ calcPerform.o cvtBpt.o cvtFast.o ellLib.o envSubr.o errSymLib.o \ errSymTbl.o genSubr.o genTaskSubr.o nextFieldSubr.o postfix.o \ - bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o + bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o OBJS1 = \ cmdSubr.o cvtNumbers.o cvtFast.o ezsSockSubr.o helpSubr.o diff --git a/src/libCom/bucketLib.c b/src/libCom/bucketLib.c index fb174a568..0ba271eef 100644 --- a/src/libCom/bucketLib.c +++ b/src/libCom/bucketLib.c @@ -34,7 +34,6 @@ * .01 Storage for identifier must persist until an item is deleted */ - #include #include #include @@ -324,7 +323,11 @@ BUCKET *bucketCreate (unsigned nHashTableEntries) unsigned nbits; BUCKET *pb; - if (nHashTableEntries==0) { + /* + * no absurd sized buckets + */ + if (nHashTableEntries<=1) { + fprintf (stderr, "Tiny bucket create failed\n"); return NULL; } @@ -337,12 +340,15 @@ BUCKET *bucketCreate (unsigned nHashTableEntries) break; } } + /* * indexWidth must be specified at least one * bit less than the bit size of type BUCKETID */ if (nbits>=BUCKETID_BIT_WIDTH) { - printf("%s at %d: Requested index width=%d to large. max=%d\n", + fprintf ( + stderr, + "%s at %d: Requested index width=%d to large. max=%d\n", __FILE__, __LINE__, nbits, diff --git a/src/libCom/bucketLib/bucketLib.c b/src/libCom/bucketLib/bucketLib.c index fb174a568..0ba271eef 100644 --- a/src/libCom/bucketLib/bucketLib.c +++ b/src/libCom/bucketLib/bucketLib.c @@ -34,7 +34,6 @@ * .01 Storage for identifier must persist until an item is deleted */ - #include #include #include @@ -324,7 +323,11 @@ BUCKET *bucketCreate (unsigned nHashTableEntries) unsigned nbits; BUCKET *pb; - if (nHashTableEntries==0) { + /* + * no absurd sized buckets + */ + if (nHashTableEntries<=1) { + fprintf (stderr, "Tiny bucket create failed\n"); return NULL; } @@ -337,12 +340,15 @@ BUCKET *bucketCreate (unsigned nHashTableEntries) break; } } + /* * indexWidth must be specified at least one * bit less than the bit size of type BUCKETID */ if (nbits>=BUCKETID_BIT_WIDTH) { - printf("%s at %d: Requested index width=%d to large. max=%d\n", + fprintf ( + stderr, + "%s at %d: Requested index width=%d to large. max=%d\n", __FILE__, __LINE__, nbits, diff --git a/src/libCom/ellLib.c b/src/libCom/ellLib.c index ec259dd0d..e233dc71d 100644 --- a/src/libCom/ellLib.c +++ b/src/libCom/ellLib.c @@ -34,7 +34,7 @@ #include -#if !defined(NULL) || (NULL!=0) +#if !defined(NULL) #define NULL 0 #endif diff --git a/src/libCom/ellLib/ellLib.c b/src/libCom/ellLib/ellLib.c index ec259dd0d..e233dc71d 100644 --- a/src/libCom/ellLib/ellLib.c +++ b/src/libCom/ellLib/ellLib.c @@ -34,7 +34,7 @@ #include -#if !defined(NULL) || (NULL!=0) +#if !defined(NULL) #define NULL 0 #endif diff --git a/src/libCom/memDebugLib.c b/src/libCom/memDebugLib.c index ac12501d7..3a9da2981 100644 --- a/src/libCom/memDebugLib.c +++ b/src/libCom/memDebugLib.c @@ -131,7 +131,7 @@ unsigned long size; if(memDebugLevel>2){ fprintf(stderr, "%08x=malloc(%d) %s.%d\n", - pHdr->pUser, size, pFile, line); + (unsigned) pHdr->pUser, size, pFile, line); } return pHdr->pUser; @@ -178,8 +178,10 @@ void *ptr; if(status<0 || (pHdr->pUser != ptr)){ FASTUNLOCK(&memDebugLock); - fprintf(stderr, "%s.%d free(%08x) failed\n", pFile, line, ptr); - fprintf(stderr, "malloc occured at %s.%d\n", pHdr->pFile, pHdr->line); + fprintf(stderr, "%s.%d free(%08x) failed\n", + pFile, line, (unsigned) ptr); + fprintf(stderr, "malloc occured at %s.%d\n", + pHdr->pFile, pHdr->line); assert(0); } ellDelete(&memDebugList, &pHdr->node); @@ -188,7 +190,8 @@ void *ptr; memDebugVerify(pHdr); if(memDebugLevel>2){ - fprintf(stderr, "free(%08x) %s.%d\n", ptr, pFile, line); + fprintf(stderr, "free(%08x) %s.%d\n", + (unsigned)ptr, pFile, line); fprintf(stderr, "\tmalloc(%d) at %s.%d\n", pHdr->size, @@ -215,8 +218,10 @@ DMH *pHdr; } if(pHdr->magic != debugMallocMagic || pHdr->pFoot->magic != debugMallocMagic){ - fprintf(stderr, "block overwritten %x\n", pHdr->pUser); - fprintf(stderr, "malloc occured at %s.%d\n", pHdr->pFile, pHdr->line); + fprintf(stderr, "block overwritten %x\n", + (unsigned)pHdr->pUser); + fprintf(stderr, "malloc occured at %s.%d\n", + pHdr->pFile, pHdr->line); return 1; } @@ -252,7 +257,6 @@ int memDebugPrintAll(ignoreBeforeThisTick) unsigned long ignoreBeforeThisTick; #endif /*__STDC__*/ { - int status; DMH *pHdr; FASTLOCK(&memDebugLock); @@ -263,7 +267,7 @@ unsigned long ignoreBeforeThisTick; } fprintf(stderr, "%8x = malloc(%d) at %s.%d tick=%d\n", - pHdr->pUser, + (unsigned) pHdr->pUser, pHdr->size, pHdr->pFile, pHdr->line,