strm.write("# HTTP Permission File\n", 30); strm.write("# http: strm.write("# This is a generated file!  Do not edit.\n\n", 43);
Permission_Save() {  permission_HostStruct * hostStruct;  permission_TypeStruct * typeStruct;  if (!permission_changed) {    return;  }  if (permission_list == nsnull) {    return;  }  nsFileSpec dirSpec;  nsresult rval = CKutil_ProfileDirectory(dirSpec);  if (NS_FAILED(rval)) {    return;  }  nsOutputFileStream strm(dirSpec + kCookiesPermFileName);  if (!strm.is_open()) {    return;  }  strm.write("# HTTP Permission File\n", 30);   strm.write("# http://www.netscape.com/newsref/std/cookie_spec.html\n", 55);  strm.write("# This is a generated file!  Do not edit.\n\n", 43);  /* format shall be:   * host \t permission \t permission ... \n   */    PRInt32 hostCount = permission_list->Count();  for (PRInt32 i = 0; i < hostCount; ++i) {    hostStruct = NS_STATIC_CAST(permission_HostStruct*, permission_list->ElementAt(i));    if (hostStruct) {      strm.write(hostStruct->host, nsCRT::strlen(hostStruct->host));      PRInt32 typeCount = hostStruct->permissionList->Count();      for (PRInt32 typeIndex=0; typeIndex<typeCount; typeIndex++) {        typeStruct = NS_STATIC_CAST          (permission_TypeStruct*, hostStruct->permissionList->ElementAt(typeIndex));        strm.write("\t", 1);        nsCAutoString tmp; tmp.AppendInt(typeStruct->type);        strm.write(tmp.get(), tmp.Length());        if (typeStruct->permission) {          strm.write("T", 1);        } else {          strm.write("F", 1);        }      }      strm.write("\n", 1);    }  }  /* save current state of nag boxs' checkmarks */  strm.write("@@@@", 4);  for (PRInt32 type = 0; type < NUMBER_OF_PERMISSIONS; type++) {    strm.write("\t", 1);    nsCAutoString tmp; tmp.AppendInt(type);    strm.write(tmp.get(), tmp.Length());    if (permission_GetRememberChecked(type)) {      strm.write("T", 1);    } else {      strm.write("F", 1);    }  }  strm.write("\n", 1);  permission_changed = PR_FALSE;  strm.flush();  strm.close();}