if (firstChar == '#' || firstChar == CR || firstChar == LF || firstChar == 0) {
if (firstChar == '#' || firstChar == nsCRT::CR || firstChar == nsCRT::LF || firstChar == 0) {
COOKIE_Read() {  if (cookie_list) {    return NS_OK;  }  cookie_CookieStruct *new_cookie, *tmp_cookie_ptr;  size_t new_len;  nsAutoString buffer;  PRBool added_to_list;  nsFileSpec dirSpec;  nsresult rv = CKutil_ProfileDirectory(dirSpec);  if (NS_FAILED(rv)) {    return rv;  }  nsInputFileStream strm(dirSpec + kCookiesFileName);  if (!strm.is_open()) {    /* file doesn't exist -- that's not an error */    return NS_OK;  }  /* format is:   *   * host \t isDomain \t path \t secure \t expires \t name \t cookie   *   * if this format isn't respected we move onto the next line in the file.   * isDomain is PR_TRUE or PR_FALSE -- defaulting to PR_FALSE   * secure is PR_TRUE or PR_FALSE   -- should default to PR_TRUE   * expires is a time_t integer   * cookie can have tabs   */  while (CKutil_GetLine(strm,buffer) != -1){    added_to_list = PR_FALSE;    if ( !buffer.IsEmpty() ) {      PRUnichar firstChar = buffer.CharAt(0);      if (firstChar == '#' || firstChar == CR ||          firstChar == LF || firstChar == 0) {        continue;      }    }    int hostIndex, isDomainIndex, pathIndex, secureIndex, expiresIndex, nameIndex, cookieIndex;    hostIndex = 0;    if ((isDomainIndex=buffer.FindChar('\t', PR_FALSE,hostIndex)+1) == 0 ||        (pathIndex=buffer.FindChar('\t', PR_FALSE,isDomainIndex)+1) == 0 ||        (secureIndex=buffer.FindChar('\t', PR_FALSE,pathIndex)+1) == 0 ||        (expiresIndex=buffer.FindChar('\t', PR_FALSE,secureIndex)+1) == 0 ||        (nameIndex=buffer.FindChar('\t', PR_FALSE,expiresIndex)+1) == 0 ||        (cookieIndex=buffer.FindChar('\t', PR_FALSE,nameIndex)+1) == 0 ) {      continue;    }    nsAutoString host, isDomain, path, isSecure, expires, name, cookie;    buffer.Mid(host, hostIndex, isDomainIndex-hostIndex-1);    buffer.Mid(isDomain, isDomainIndex, pathIndex-isDomainIndex-1);    buffer.Mid(path, pathIndex, secureIndex-pathIndex-1);    buffer.Mid(isSecure, secureIndex, expiresIndex-secureIndex-1);    buffer.Mid(expires, expiresIndex, nameIndex-expiresIndex-1);    buffer.Mid(name, nameIndex, cookieIndex-nameIndex-1);    buffer.Mid(cookie, cookieIndex, buffer.Length()-cookieIndex);    /* create a new cookie_struct and fill it in */    new_cookie = PR_NEW(cookie_CookieStruct);    if (!new_cookie) {      strm.close();      return NS_ERROR_OUT_OF_MEMORY;    }    memset(new_cookie, 0, sizeof(cookie_CookieStruct));    new_cookie->name = name.ToNewCString();    new_cookie->cookie = cookie.ToNewCString();    new_cookie->host = host.ToNewCString();    new_cookie->path = path.ToNewCString();    if (isDomain.EqualsWithConversion("TRUE")) {      new_cookie->isDomain = PR_TRUE;    } else {      new_cookie->isDomain = PR_FALSE;    }    if (isSecure.EqualsWithConversion("TRUE")) {      new_cookie->isSecure = PR_TRUE;    } else {      new_cookie->isSecure = PR_FALSE;    }    char * expiresCString = expires.ToNewCString();    new_cookie->expires = strtoul(expiresCString, nsnull, 10);    nsCRT::free(expiresCString);    /* start new cookie list if one does not already exist */    if (!cookie_list) {      cookie_list = new nsVoidArray();      if (!cookie_list) {        strm.close();        return NS_ERROR_OUT_OF_MEMORY;      }    }    /* add new cookie to the list so that it is before any strings of smaller length */    new_len = PL_strlen(new_cookie->path);    for (PRInt32 i = cookie_list->Count(); i > 0;) {      i--;      tmp_cookie_ptr = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(i));      NS_ASSERTION(tmp_cookie_ptr, "corrupt cookie list");      if (new_len <= PL_strlen(tmp_cookie_ptr->path)) {        cookie_list->InsertElementAt(new_cookie, i);        added_to_list = PR_TRUE;        break;      }    }    /* no shorter strings found in list so add new cookie at end */    if (!added_to_list) {      cookie_list->AppendElement(new_cookie);    }  }  strm.close();  cookie_changed = PR_FALSE;  return NS_OK;}