if (NS_FAILED(res))
if (NS_FAILED(res) || !srcLen)
PRBool nsMsgI18N7bit_data_part(const char *charset, const char *inString, const PRUint32 size){  nsAutoString aCharset; aCharset.AssignWithConversion(charset);  nsresult res;  PRBool result = PR_TRUE;    nsCOMPtr <nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &res);  if (NS_SUCCEEDED(res)) {    nsIUnicodeDecoder* decoder = nsnull;    // get an unicode converter    res = ccm->GetUnicodeDecoder(&aCharset, &decoder);    if(NS_SUCCEEDED(res)) {      char *currentSrcPtr = NS_CONST_CAST(char *, inString);      PRUint32 consumedLen = 0;      PRUnichar unicharBuff[512];      PRInt32 srcLen;      PRInt32 unicharLength;      // convert to unicode      while (consumedLen < size) {        srcLen = ((size - consumedLen) >= 512) ? 512 : (size - consumedLen);  // buffer len or remaining src len        unicharLength = 512;        res = decoder->Convert(currentSrcPtr, &srcLen, unicharBuff, &unicharLength);        if (NS_FAILED(res))          break;        for (PRInt32 i = 0; i < unicharLength; i++) {          if (unicharBuff[i] > 127) {            result = PR_FALSE;            break;          }        }        currentSrcPtr += srcLen;        consumedLen = currentSrcPtr - inString; // src length used so far      }      NS_IF_RELEASE(decoder);    }      }  return result;}