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

RESOLVED FIXED in 4.6

Status

defect
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: tim.ruehsen, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Reporter

Description

15 years ago
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
Assignee

Comment 1

15 years ago
You are right. Pointers should be printed
with the %p format.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Reporter

Comment 2

15 years ago
Posted 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.
Assignee

Comment 3

15 years ago
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
Assignee

Comment 4

15 years ago
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: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in before you can comment on or make changes to this bug.