From 2a391bcfef89ba0fc54d5d161f2081e7ec381a3f Mon Sep 17 00:00:00 2001 From: Andrej Lajovic Date: Sat, 29 Sep 2012 19:29:35 -0500 Subject: [PATCH] Log file update * Write UTF-8 to log file * Remove redundant code - open log file in main.cxx - also in function create_fl_digi_main_primary() --- src/dialogs/fl_digi.cxx | 4 ++-- src/main.cxx | 10 ---------- src/misc/log.cxx | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 9981f455..41e49174 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -6449,7 +6449,6 @@ void put_echo_char(unsigned int data, int style) if (asc == ascii2 && iscntrl(data)) style = FTextBase::CTRL; -#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3 sch.clear(); if (asc != NULL) { // MAIL / ARQ / RTTY / CW sch.assign(asc[data & 0xFF]); @@ -6461,6 +6460,7 @@ void put_echo_char(unsigned int data, int style) sch.assign(" "); sch[0] = data; } +#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3 REQ(&FTextRX::addstr, ReceiveText, sch, style); #else REQ(&FTextBase::addchr, ReceiveText, data, style); @@ -6471,7 +6471,7 @@ void put_echo_char(unsigned int data, int style) Maillogfile->log_to_file(cLogfile::LOG_TX, s); if (progStatus.LOGenabled) - logfile->log_to_file(cLogfile::LOG_TX, s); + logfile->log_to_file(cLogfile::LOG_TX, sch); } void resetRTTY() { diff --git a/src/main.cxx b/src/main.cxx index 22f5acfe..f12a90bc 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -413,16 +413,6 @@ int main(int argc, char ** argv) if (progdefaults.XmlRigFilename.empty()) progdefaults.XmlRigFilename = xmlfname; - if (progStatus.LOGenabled == true) { - Date tdy; - string lfname = HomeDir; - lfname.append("fldigi"); - lfname.append(tdy.szDate(2)); - lfname.append(".log"); - logfile = new cLogfile(lfname); - logfile->log_to_file_start(); - } - #if BENCHMARK_MODE return setup_benchmark(); #endif diff --git a/src/misc/log.cxx b/src/misc/log.cxx index b0c649c5..fcba7964 100644 --- a/src/misc/log.cxx +++ b/src/misc/log.cxx @@ -82,7 +82,7 @@ void cLogfile::log_to_file(log_t type, const string& s) fprintf(logfile, "%s %s : %s (%s): ", lognames[type], freq, logmode, timestr); } for (size_t i = 0; i < s.length(); i++) - if (s[i] == '\n' || s[i] >= ' ') fprintf(logfile, "%c", s[i]); + if (s[i] == '\n' || (unsigned char)s[i] >= ' ') fprintf(logfile, "%c", s[i]); retflag = *s.rbegin() == '\n'; if (!retflag) fflush(logfile);