From: <ro...@us...> - 2006-07-02 19:34:25
|
Revision: 16398 Author: roast Date: 2006-07-02 12:34:04 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16398&view=rev Log Message: ----------- file stream rewinding changed. counting written characters from fprintf doesn't count the \r's on windows. Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-02 18:33:13 UTC (rev 16397) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-02 19:34:04 UTC (rev 16398) @@ -1083,14 +1083,19 @@ // append suffix to file and seek back to keep a valid XML document out of the user space buffer { - int tail = 0; + fpos_t tail; const char *date = gaim_utf8_strftime("%Y-%m-%d %H:%M:%S%z", NULL); - tail += fprintf(data->file, "\t<event time=\"%s\" type=\"logEnd\" />\n", date); - tail += fprintf(data->file, "</chat>\n"); + if (fgetpos(data->file, &tail) != 0) { + gaim_debug_error("log", "Could not save logfile stream position. Not writing tail."); + } + else { + fprintf(data->file, "\t<event time=\"%s\" type=\"logEnd\" />\n", date); + fprintf(data->file, "</chat>\n"); - if (fseek(data->file, -1*tail, SEEK_CUR) != 0) { - gaim_debug_error("log", "Could not seek backwards in logfile."); + if (fsetpos(data->file, &tail) != 0) { + gaim_debug_error("log", "Could not return logfile strem position after tail write."); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |