name = hashedname; #ifdef DEBUG_NS_MsgHashIfNecessary printf("out: %s\n",hashedname); #endif
nsresult NS_MsgHashIfNecessary(nsCAutoString &name){#if defined(XP_MAC)  const PRUint32 MAX_LEN = 25;#elif defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS)  const PRUint32 MAX_LEN = 55;#else#error need_to_define_your_max_filename_length#endif  nsCAutoString str(name);#ifdef DEBUG_NS_MsgHashIfNecessary  printf("in: %s\n",str.get());#endif  // Given a name, use either that name, if it fits on our  // filesystem, or a hashified version of it, if the name is too  // long to fit.  char hashedname[MAX_LEN + 1];  PRBool needshash = PL_strlen(str.get()) > MAX_LEN;#if defined(XP_WIN16)  || defined(XP_OS2)  if (!needshash) {    needshash = PL_strchr(str.get(), '.') != nsnull ||      PL_strchr(str.get(), ':') != nsnull;  }#endif  PL_strncpy(hashedname, str.get(), MAX_LEN + 1);  if (needshash) {    PR_snprintf(hashedname + MAX_LEN - 8, 9, "%08lx",                (unsigned long) StringHash(str.get()));  }  name = hashedname;#ifdef DEBUG_NS_MsgHashIfNecessary  printf("out: %s\n",hashedname);#endif    return NS_OK;}