Closed Bug 471445 Opened 15 years ago Closed 15 years ago

Remove bogus unused strings for error conditions in mime.properties

Categories

(MailNews Core :: MIME, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b2

People

(Reporter: philor, Assigned: philor)

Details

Attachments

(1 file)

In too much detail, because libmime code is impossible to follow, so all I have to go on is my chain of inference:

Outside of jar manifests, the string "mime.properties" only appears twice, where mimemoz2.cpp defines MIME_URL before using it in MimeGetStringByID() and where nsMimeBaseEmitter.cpp defines MIME_URL before using it in nsMimeBaseEmitter::MimeGetStringByID(). From that, I claim that the only way to get a string out of mime.properties is by calling a MimeGetStringByID().

MIME_OUT_OF_MEMORY, MIME_UNABLE_TO_OPEN_TMP_FILE and MIME_ERROR_WRITING_FILE appear a ton, several, and one time respectively, as return values from things that are called with libmime's special intricate style, making it close to impossible to say what the callers are, much less what they do with the return value. For example, MIME_ERROR_WRITING_FILE is only returned by mime_decompose_file_output_fn, but that's then assigned to mdd->options->decompose_file_output_fn, which has half a dozen callers like real_write, which has half a dozen callers like flush_tag, which is called by mime_multipart_related_output_fn, which is the obj->options->output_fn in mimemrel, unless that's relobj->real_output_fn...

Back to my claim that you can only get to a mime.properties string by calling a MimeGetStringByID().

It's called by mimeebod.cpp, for MIME_MSG_LINK_TO_DOCUMENT and MIME_MSG_DOCUMENT_INFO, so those two are used.

It's called by mimemsg.cpp, for MIME_MSG_PARTIAL_FMT_1 and MIME_MSG_PARTIAL_FMT2_1 and their friends +1 and +2.

It's called by mimemoz2.cpp, for MIME_MSG_DEFAULT_ATTACHMENT_NAME

It's called by commented-out code in mimemapl.cpp, and not-commented-out code in mimeeobj.cpp, for MIME_MSG_ATTACHMENT

Then there are the secondary callers, where GetFoo() just wraps one or another MimeGetStringByID:

By way of MimeGetNamedString, mimedrft.cpp gets MIME_FORWARDED_MESSAGE_HTML_USER_WROTE, and most of the MIME_MHTML_ strings. 

Several more of the MIME_MHTML_ strings come from LocalizeHeaderName calling MapHeaderNameToID and then passing the id to MimeGetStringByID (and then, horrifyingly, using the localized mimeheader.properties as a backup that it thinks isn't localized, in case it wasn't localized in the other localized file with the same localized strings, another bug), not using a few that are another bug.

So, while many of 1000-1025 are used, and some of 1026-1036, and all of 1037-1044, the "strings" -1000, -1001 and -1002 are never accessed, and are nothing but internal error codes. In some cases, I'd overlook that, and not complicate things by having a StringResources file that's both StringResources and ErrorCodesThatAren'tStrings, but "Unable to open the temporary file\n%.200s.\n\n\" is evil even as an actual localized string, and pure evil as an unused localized string.
Attachment #354730 - Flags: superreview?(bienvenu)
Attachment #354730 - Flags: review?(bienvenu)
(In reply to comment #0)
> Several more of the MIME_MHTML_ strings come from LocalizeHeaderName calling
> MapHeaderNameToID and then passing the id to MimeGetStringByID (and then,
> horrifyingly, using the localized mimeheader.properties as a backup that it
> thinks isn't localized, in case it wasn't localized in the other localized file
> with the same localized strings, another bug), not using a few that are another
> bug.

bug 471487 and bug 471501.
Attachment #354730 - Flags: superreview?(bienvenu)
Attachment #354730 - Flags: superreview+
Attachment #354730 - Flags: review?(bienvenu)
Attachment #354730 - Flags: review+
Comment on attachment 354730 [details] [diff] [review]
Remove strings, note that they are error codes, v.1

thx, Phil.
http://hg.mozilla.org/comm-central/rev/963e83685ea3
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b2
You need to log in before you can comment on or make changes to this bug.