} nsInputFileStream strm(dirSpec + "cookperm.txt"); if (!strm.is_open()) {  return; }    net_lock_cookie_permission_list(); while(cookie_GetLine(strm,buffer) != -1) { if (buffer->CharAt(0) == '#' || buffer->CharAt(0) == CR || buffer->CharAt(0) == LF || buffer->CharAt(0) == 0) { PR_Free(buffer); continue; }  int hostIndex, permissionIndex; hostIndex = 0; if ((permissionIndex=buffer->Find('\t', hostIndex)+1) == 0) { PR_Free(buffer); continue; }   while (hostIndex < permissionIndex && (buffer->CharAt(hostIndex) == '.')) { hostIndex++; }  nsString host, permission; buffer->Mid(host, hostIndex, permissionIndex-hostIndex-1); buffer->Mid(permission, permissionIndex, buffer->Length()-permissionIndex);   new_cookie_permission = PR_NEW(net_CookiePermissionStruct); if (!new_cookie_permission) { net_unlock_cookie_permission_list(); strm.close(); return; }  new_cookie_permission->host = host.ToNewCString(); if (permission == "TRUE") { new_cookie_permission->permission = PR_TRUE; } else { new_cookie_permission->permission = PR_FALSE; }   if (host == "@@@@") { cookie_remember_checked = new_cookie_permission->permission; } else {  net_AddCookiePermission(new_cookie_permission, FALSE ); } }  strm.close(); net_unlock_cookie_permission_list(); cookie_permissions_changed = FALSE; return;
net_ReadCookiePermissions(){  nsAutoString * buffer;  net_CookiePermissionStruct * new_cookie_permission;  nsFileSpec dirSpec;  nsresult rv = cookie_ProfileDirectory(dirSpec);  if (NS_FAILED(rv)) {    return;  }  nsInputFileStream strm(dirSpec + "cookperm.txt");  if (!strm.is_open()) {    /* file doesn't exist -- that's not an error */    return;  }  /* format is:   * host \t permission   * if this format isn't respected we move onto the next line in the file.   */  net_lock_cookie_permission_list();  while(cookie_GetLine(strm,buffer) != -1) {    if (buffer->CharAt(0) == '#' || buffer->CharAt(0) == CR ||        buffer->CharAt(0) == LF || buffer->CharAt(0) == 0) {      PR_Free(buffer);      continue;    }    int hostIndex, permissionIndex;    hostIndex = 0;    if ((permissionIndex=buffer->Find('\t', hostIndex)+1) == 0) {      PR_Free(buffer);      continue;          }    /* ignore leading periods in host name */    while (hostIndex < permissionIndex && (buffer->CharAt(hostIndex) == '.')) {      hostIndex++;    }    nsString host, permission;    buffer->Mid(host, hostIndex, permissionIndex-hostIndex-1);    buffer->Mid(permission, permissionIndex, buffer->Length()-permissionIndex);    /* create a new cookie_struct and fill it in */    new_cookie_permission = PR_NEW(net_CookiePermissionStruct);    if (!new_cookie_permission) {      net_unlock_cookie_permission_list();      strm.close();      return;    }    new_cookie_permission->host = host.ToNewCString();    if (permission == "TRUE") {      new_cookie_permission->permission = PR_TRUE;    } else {      new_cookie_permission->permission = PR_FALSE;    }    /*     * a host value of "@@@@" is a special code designating the     * state of the cookie nag-box's checkmark     */    if (host == "@@@@") {      cookie_remember_checked = new_cookie_permission->permission;    } else {      /* add the permission entry */      net_AddCookiePermission(new_cookie_permission, FALSE );    }  }  strm.close();  net_unlock_cookie_permission_list();  cookie_permissions_changed = FALSE;  return;}