Closed Bug 279874 Opened 20 years ago Closed 20 years ago

ptthread.c, PR_LOG() using %X format spec for pointers

Categories

(NSPR :: NSPR, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tim.ruehsen, Assigned: wtc)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.3; Linux) KHTML/3.3.2 (like Gecko)
Build Identifier: 

There are several calls to PR_LOG using %X to format pointers.  
This might go wrong on platforms, where we have sizeof(int)!=sizeof(void *).  
  
examples: line 1133-1135, 1195-1197.  
 
Sorry, no patch - at the moment I am out of time. 
 

Reproducible: Always
You are right. Pointers should be printed
with the %p format.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch cvs diff for ptthread.c (obsolete) — Splinter Review
Replaced %X by %p for pointer arguments.
Also some trailing whitespace has been removed - can't switch it off within my
editor due to an editor's bug.
I removed the white space changes from Tim's patch.
The only real change I made is to change
    0x%p
to
    %p

The reason is that how %p is printed is implementation
dependent.  It may or may not have the 0x prefix.

I noticed that ptthread.c still has another problem:
it prints thred->id (of the type pthread_t) using the
%X format.  Since pthread_t is an opaque type, it may
be an integer, it may be a pointer, it may even be a
struct.  This patch does not address that issue.
Attachment #172696 - Attachment is obsolete: true
Patch checked in on the NSPR tip (NSPR 4.6) and
NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.8 Beta).

I opened bug 280578 for the pthread_t (thred->id)
format specifier issue.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: