RESOLVED FIXED 8937
EncodingMap uses 0 as its empty value but 0 is a valid TextEncodingID
https://bugs.webkit.org/show_bug.cgi?id=8937
Summary EncodingMap uses 0 as its empty value but 0 is a valid TextEncodingID
mitz
Reported 2006-05-16 01:22:25 PDT
EncodingMap uses 0 as its empty value but 0 is a valid encoding ID (MacRoman), which is actually added to the map by buildDictionaries(). I think the empty value should be changed to something else (but not InvalidEncoding, which is used as the deleted value), and emptyValueIsZero should be defined as false.
Attachments
A fix (818 bytes, patch)
2006-05-17 09:29 PDT, mitz
darin: review-
Patch w/change log (3.07 KB, patch)
2006-05-18 07:20 PDT, mitz
darin: review+
mitz
Comment 1 2006-05-17 09:29:41 PDT
mitz
Comment 2 2006-05-17 09:35:48 PDT
Comment on attachment 8367 [details] A fix I'm really not sure about this one (except that it fixes the bug, of course).
Darin Adler
Comment 3 2006-05-17 22:00:37 PDT
Comment on attachment 8367 [details] A fix Actually, the specialization of the HashKeyStorageTraits can and should be removed entirely if we have to change the empty value. The reason that's there is to make the hash table implementation get shared. But that sharing can't take place if the traits are not the standard traits for the integer type. Otherwise, this patch looks fine.
Darin Adler
Comment 4 2006-05-17 22:02:58 PDT
This second invalid encoding should probably go in the TextEncoding.h header and have a symbolic name, too. I agree that the value 0xFFFFFFFEU is a good value to use. We can probably call it InvalidEncoding2 or some other lovely name like that.
mitz
Comment 5 2006-05-18 07:20:28 PDT
Created attachment 8391 [details] Patch w/change log InvalidEncoding2 it is!
Darin Adler
Comment 6 2006-05-18 08:46:58 PDT
Comment on attachment 8391 [details] Patch w/change log Looks great, r=me. One comment for the future. When you have an assert that has an && in it, it's usually better to have two asserts. That way each one has a smaller expression in it, and also if one fails you know which half failed.
Darin Adler
Comment 7 2006-05-18 09:08:49 PDT
Committed revision 14465.
Note You need to log in before you can comment on or make changes to this bug.