PRInt32 illegalCharacterIndex = str.FindCharInSet(illegalChars); char hashedname[MAX_LEN + 1];
char hashedname[9];
nsresult NS_MsgHashIfNecessary(nsCAutoString &name){  NS_NAMED_LITERAL_CSTRING (illegalChars,                             FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS ILLEGAL_FOLDER_CHARS);  nsCAutoString str(name);  // Given a filename, make it safe for filesystem  // certain filenames require hashing because they   // are too long or contain illegal characters  PRInt32 illegalCharacterIndex = str.FindCharInSet(illegalChars);  char hashedname[MAX_LEN + 1];  if (illegalCharacterIndex == kNotFound)   {    // no illegal chars, it's just too long    // keep the initial part of the string, but hash to make it fit    if (str.Length() > MAX_LEN)     {      PL_strncpy(hashedname, str.get(), MAX_LEN + 1);      PR_snprintf(hashedname + MAX_LEN - 8, 9, "%08lx",                (unsigned long) StringHash(str.get()));      name = hashedname;    }  }  else   {      // found illegal chars, hash the whole thing      // if we do substitution, then hash, two strings      // could hash to the same value.      // for example, on mac:  "foo__bar", "foo:_bar", "foo::bar"      // would map to "foo_bar".  this way, all three will map to      // different values      PR_snprintf(hashedname, 9, "%08lx",                (unsigned long) StringHash(str.get()));      name = hashedname;  }    return NS_OK;}