strm.write("# This is a generated file!  Do not edit.\n\n", 43);
strm.write("# This is a generated file!  Do not edit.\n", 42); strm.write("# To delete cookies, use the Cookie Manager.\n\n", 46);
cookie_Save() {  cookie_CookieStruct * cookie_s;  time_t cur_date = get_current_time();  char date_string[36];  if (COOKIE_GetBehaviorPref() == COOKIE_DontUse) {    return;  }  if (!cookie_cookiesChanged) {    return;  }  if (cookie_cookieList == nsnull) {    return;  }  nsFileSpec dirSpec;  nsresult rv = cookie_ProfileDirectory(dirSpec);  if (NS_FAILED(rv)) {    return;  }  nsOutputFileStream strm(dirSpec + "cookies.txt");  if (!strm.is_open()) {    /* file doesn't exist -- that's not an error */    return;  }  strm.write("# HTTP Cookie File\n", 19);  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 isDomain \t path \t xxx \t expires \t name \t cookie   *   * isDomain is PR_TRUE or PR_FALSE   * xxx is PR_TRUE or PR_FALSE   * expires is a time_t integer   * cookie can have tabs   */  PRInt32 count = cookie_cookieList->Count();  for (PRInt32 i = 0; i < count; ++i) {    cookie_s = NS_STATIC_CAST(cookie_CookieStruct*, cookie_cookieList->ElementAt(i));    NS_ASSERTION(cookie_s, "corrupt cookie list");      if (cookie_s->expires < cur_date) {        /* don't write entry if cookie has expired or has no expiration date */        continue;      }      strm.write(cookie_s->host, nsCRT::strlen(cookie_s->host));      if (cookie_s->isDomain) {        strm.write("\tTRUE\t", 6);      } else {        strm.write("\tFALSE\t", 7);      }      strm.write(cookie_s->path, nsCRT::strlen(cookie_s->path));      if (cookie_s->xxx) {        strm.write("\tTRUE\t", 6);      } else {        strm.write("\tFALSE\t", 7);      }      PR_snprintf(date_string, sizeof(date_string), "%lu", cookie_s->expires);      strm.write(date_string, nsCRT::strlen(date_string));      strm.write("\t", 1);      strm.write(cookie_s->name, nsCRT::strlen(cookie_s->name));      strm.write("\t", 1);      strm.write(cookie_s->cookie, nsCRT::strlen(cookie_s->cookie));      strm.write("\n", 1);  }  cookie_cookiesChanged = PR_FALSE;  strm.flush();  strm.close();}