Closed
Bug 28424
Opened 25 years ago
Closed 22 years ago
nsString illegal cast up/down tracking bug
Categories
(Core Graveyard :: Tracking, defect, P3)
Core Graveyard
Tracking
Tracking
(Not tracked)
RESOLVED
WORKSFORME
M1
People
(Reporter: ftang, Assigned: ftang)
References
Details
(Keywords: meta)
this is a tracking bug for all the illegal cast up/down I filed
Assignee | ||
Updated•25 years ago
|
Assignee | ||
Comment 1•25 years ago
|
||
I believe there are more when I start to run editor and messanger.
28412 will also cause the assert, but that is because they pass in bogus length-
seperate issue.
Assignee | ||
Comment 2•25 years ago
|
||
Here is the new patch I used to catch these problem. notice you have to turn
track_latin to false sometimes. The nsTextFragment use Latin 1 which is not
really a problem. Howerver, most of the time char* contains 8bit on is a problem.
Index: bufferRoutines.h
===================================================================
RCS file: /m/pub/mozilla/xpcom/ds/bufferRoutines.h,v
retrieving revision 1.38
diff -c -r1.38 bufferRoutines.h
*** bufferRoutines.h 2000/02/13 17:45:01 1.38
--- bufferRoutines.h 2000/02/18 20:39:11
***************
*** 45,51 ****
--- 45,66 ----
#define KSHIFTLEFT (0)
#define KSHIFTRIGHT (1)
+ #if defined(DEBUG_ftang) || defined(DEBUG_nhotta) || defined(DEBUG_jbeta) ||
defined(DEBUG_erik) || defined(DEBUG_cata)
+ #define DEBUG_ILLEGAL_CAST_UP
+ #define DEBUG_ILLEGAL_CAST_DOWN
+
+ #if defined(DEBUG_ILLEGAL_CAST_UP) || defined(DEBUG_ILLEGAL_CAST_DOWN)
+ static PRBool track_illegal = PR_TRUE;
+ static PRBool track_latin1 = PR_TRUE;
+ #endif // defined
+
+ // To Do:
+ // Put some ifdef here to make linux build not assert but dump stack trace to
a file
+ #define TRACE_ILLEGAL_CAST_UP(c, s, m) NS_ASSERTION((c), (m))
+ #define TRACE_ILLEGAL_CAST_DOWN(c, s, m) NS_ASSERTION((c), (m))
+ #endif
+
inline PRUnichar GetUnicharAt(const char* aString,PRUint32 anIndex) {
return ((PRUnichar*)aString)[anIndex];
}
***************
*** 172,183 ****
--- 187,209 ----
const unsigned char* first= (const unsigned char*)aSource+anOffset;
const unsigned char* last = first+aCount;
+ #ifdef DEBUG_ILLEGAL_CAST_UP
+ PRBool illegal= PR_FALSE;
+ #endif
//now loop over characters, shifting them left...
while(first<last) {
*to=(PRUnichar)(*first);
+ #ifdef DEBUG_ILLEGAL_CAST_UP
+ if(track_illegal && track_latin1 && ( *to >= 0x80))
+ illegal= PR_TRUE;
+ #endif
to++;
first++;
}
+ #ifdef DEBUG_ILLEGAL_CAST_UP
+ TRACE_ILLEGAL_CAST_UP((!illegal), aSource, "illegal cast up in CopyChars1To2");
+ #endif
+
}
***************
*** 196,209 ****
--- 222,252 ----
const PRUnichar* first= theSource+anOffset;
const PRUnichar* last = first+aCount;
+ #ifdef DEBUG_ILLEGAL_CAST_DOWN
+ PRBool illegal= PR_FALSE;
+ #endif
//now loop over characters, shifting them left...
while(first<last) {
if(*first<256)
*to=(char)*first;
else *to='.';
+ #ifdef DEBUG_ILLEGAL_CAST_DOWN
+ if(track_illegal) {
+ if(track_latin1) {
+ if(*first & 0xFF80)
+ illegal = PR_TRUE;
+ } else {
+ if(*first & 0xFF00)
+ illegal = PR_TRUE;
+ } // track_latin1
+ } // track_illegal
+ #endif
to++;
first++;
}
+ #ifdef DEBUG_ILLEGAL_CAST_DOWN
+ TRACE_ILLEGAL_CAST_DOWN((!illegal), theSource, "illegal cast down in
CopyChars2To1");
+ #endif
}
/**
Assignee | ||
Comment 3•25 years ago
|
||
OK, I have a better patch that I post on http://warp/u/ftang/tmp/buftrace.txt
This is simplar to my last patch, but it will dump the stack trace to a file
called "nsStringTrace.txt" in Linux (in the bin directory) instead of assert.
Assignee | ||
Comment 5•24 years ago
|
||
mark it as future to make it out of our radar
Target Milestone: M20 → Future
Assignee | ||
Updated•23 years ago
|
Component: Internationalization → Tracking
Target Milestone: Future → mozilla1.0
Updated•23 years ago
|
Keywords: mozilla1.0
Assignee | ||
Comment 7•23 years ago
|
||
move all my "tracking" bug to "M1"
Target Milestone: mozilla1.1 → M1
Assignee | ||
Comment 10•22 years ago
|
||
this bug is lost its meanining now. mark it workforme
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•