From 0c355e47e82f42d8d8988dc9eebadb524f1cc772 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 2 Feb 2009 05:54:53 +0000 Subject: * generic/tclStringObj.c (STRING_NOMEM): Add missing cast of NULL to (char *) that upsets some compilers. [Bug 2494093]. --- ChangeLog | 3 +++ generic/tclStringObj.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c43f610..158889f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-02-02 Don Porter + * generic/tclStringObj.c (STRING_NOMEM): Add missing cast of + NULL to (char *) that upsets some compilers. [Bug 2494093]. + * generic/tclStringObj.c (Tcl_(Attempt)SetObjLength): Added protections against callers asking for negative lengths. It is likely when this happens that an integer overflow is to blame. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index f5ba669..da80876 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.80 2009/02/02 05:47:54 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.81 2009/02/02 05:54:53 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -110,7 +110,8 @@ typedef struct String { #define STRING_SIZE(numBytes) \ (sizeof(String) - sizeof(Tcl_UniChar) + (numBytes)) #define STRING_NOMEM(numBytes) \ - (Tcl_Panic("unable to alloc %u bytes", STRING_SIZE(numBytes)), NULL) + (Tcl_Panic("unable to alloc %u bytes", STRING_SIZE(numBytes)), \ + (char *) NULL) #define stringAlloc(numBytes) \ (String *) (((numBytes) > INT_MAX - STRING_SIZE(0)) \ ? STRING_NOMEM(numBytes) \ -- cgit v0.12