Tcl Source Code

View Ticket
Login
Ticket UUID: 419528
Title: Non portable code in tclIndexObj.c
Type: Bug Version: obsolete: 8.3.3
Submitter: nobody Created on: 2001-04-27 16:38:07
Subsystem: 13. Index Object Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-08-31 02:15:44
Resolution: Fixed Closed By: hobbs
    Closed on: 2001-08-30 19:15:44
Description:
I had a problem with porting tcl to a Cray machine.
The code at lines 197, 242-245 in tclIndexObj.c assumes
a byte
addressable machine.  It casts a pointer to (size_t)
and then adds a
byte count to come up with a (char**).  This only works
on a byte
addressable machine.  It should be casting to (char*)
instead of (size_t)
since it is adding a number of characters.

I also had a problem with tk routine tkUnixFont.c at
line 41.
#define     FONTMAP_PAGES \
       (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
There is an implicit assumption that
sizeof(Tcl_UniChar) is 2 bytes.
On a Cray it is 8 bytes, so that  FONTMAP_PAGES becomes
a huge
number, which is used to define the size of  an array
in structure  FontFamily.
My work around was to hardcode a 2 for
sizeof(Tcl_UniChar).

I believe these problems are in the 8.4 versions also.

Clay Andreasen ([email protected])
User Comments: hobbs added on 2001-08-31 02:15:44:
Logged In: YES 
user_id=72656

FWIW, these were change to size_t from long before, and 
this patch changed that to (char *).

hobbs added on 2001-08-31 01:58:43:
Logged In: YES 
user_id=72656

applied to 8.3.3+ and 8.4a4cvs.

msofer added on 2001-08-30 21:52:18:
Logged In: YES 
user_id=148712

Clay tells me that the enclosed patch solves his tcl
problem, and that he did report the tk bug to the tktoolkit
project.

Jan: would you care to take it from here?

msofer added on 2001-08-14 06:08:31:

File Added - 9498: patch419528.txt

msofer added on 2001-08-14 06:08:30:
Logged In: YES 
user_id=148712

Is the enclosed patch what is requested? It runs OK with
gcc/linux/i386.

dgp added on 2001-04-28 07:40:06:
Logged In: YES 
user_id=80530

Assigning to the Index Object category.

The Tk bug should be reported to the Tk project.

http://sourceforge.net/projects/tktoolkit/

Attachments: