diff --git a/mailnews/mime/src/nsMsgHeaderParser.cpp b/mailnews/mime/src/nsMsgHeaderParser.cpp index a13c8185cac..80e6546e467 100644 --- a/mailnews/mime/src/nsMsgHeaderParser.cpp +++ b/mailnews/mime/src/nsMsgHeaderParser.cpp @@ -192,10 +192,7 @@ NS_IMETHODIMP nsMsgHeaderParser::ParseHeadersWithArray(const PRUnichar * aLine, nsresult nsMsgHeaderParser::ParseHeaderAddresses (const char *charset, const char *line, char **names, char **addresses, PRUint32 *numAddresses) { -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); *numAddresses = msg_parse_Header_addresses(line, names, addresses); @@ -206,10 +203,7 @@ nsresult nsMsgHeaderParser::ExtractHeaderAddressMailboxes (const char *charset, { if (mailboxes) { -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); *mailboxes = msg_extract_Header_address_mailboxes(line); return NS_OK; @@ -222,10 +216,7 @@ nsresult nsMsgHeaderParser::ExtractHeaderAddressNames (const char *charset, cons { if (names) { -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); *names = msg_extract_Header_address_names(line); return NS_OK; @@ -239,10 +230,7 @@ nsresult nsMsgHeaderParser::ExtractHeaderAddressName (const char *charset, const { if (name) { -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); *name = msg_extract_Header_address_name(line); return NS_OK; @@ -255,10 +243,7 @@ nsresult nsMsgHeaderParser::ReformatHeaderAddresses (const char *charset, const { if (reformattedAddress) { -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); *reformattedAddress = msg_reformat_Header_addresses(line); return NS_OK; @@ -271,12 +256,8 @@ nsresult nsMsgHeaderParser::RemoveDuplicateAddresses (const char *charset, const { if (newOutput) { -#if DEBUG - if (addrs) - (void) NS_ConvertUTF8toUCS2(addrs).get(); // asserts if invalid UTF-8 - if (other_addrs) - (void) NS_ConvertUTF8toUCS2(other_addrs).get(); -#endif + NS_ASSERTION(!addrs || IsUTF8(nsDependentCString(addrs)), "invalid UTF-8 in header"); + NS_ASSERTION(!other_addrs || IsUTF8(nsDependentCString(other_addrs)), "invalid UTF-8 in header"); *newOutput = msg_remove_duplicate_addresses(addrs, other_addrs, removeAliasesToMe); return NS_OK; @@ -288,11 +269,7 @@ nsresult nsMsgHeaderParser::RemoveDuplicateAddresses (const char *charset, const nsresult nsMsgHeaderParser::MakeFullAddress (const char *charset, const char* name, const char* addr, char ** fullAddress) { NS_ENSURE_ARG_POINTER(fullAddress); - -#if DEBUG - if (addr) - (void) NS_ConvertUTF8toUCS2(addr).get(); // asserts if invalid UTF-8 -#endif + NS_ASSERTION(!addr || IsUTF8(nsDependentCString(addr)), "invalid UTF-8 in header"); *fullAddress = msg_make_full_address(name, addr); return NS_OK; @@ -316,12 +293,7 @@ nsresult nsMsgHeaderParser::MakeFullAddressWString (const PRUnichar* name, const nsresult nsMsgHeaderParser::UnquotePhraseOrAddr (const char *line, PRBool preserveIntegrity, char** result) { NS_ENSURE_ARG_POINTER(result); - -#if DEBUG - if (line) - (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if invalid UTF-8 -#endif - + NS_ASSERTION(!line || IsUTF8(nsDependentCString(line)), "invalid UTF-8 in header"); return msg_unquote_phrase_or_addr(line, preserveIntegrity, result); }