kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Logbook file open/close changes
Fixed seg fault opening invalid or empty logbook file Changed to allow saving an empty adif logbook filepull/2/head
rodzic
90224b77dc
commit
bd3a8a292b
|
@ -1,5 +1,7 @@
|
|||
#include <FL/Fl.H>
|
||||
#include <FL/filename.H>
|
||||
#include <FL/fl_ask.H>
|
||||
|
||||
|
||||
#include "adif_io.h"
|
||||
#include "config.h"
|
||||
|
@ -118,7 +120,12 @@ void cAdifIO::readFile (const char *fname, cQsoDb *db) {
|
|||
fread (buff, filesize, 1, adiFile);
|
||||
fclose (adiFile);
|
||||
|
||||
char *p1 = buff, *p2;
|
||||
if (filesize == 0 || (strstr( buff, "<ADIF_VERS:")) == 0) {
|
||||
fl_message("Not an ADIF log file");
|
||||
return;
|
||||
}
|
||||
|
||||
char *p1 = buff, *p2;
|
||||
// is there a header?
|
||||
if (*p1 != '<') { // yes find the start of the records
|
||||
p1 = strchr(buff, '<');
|
||||
|
|
|
@ -130,10 +130,11 @@ void cb_mnuOpenLogbook(Fl_Menu_* m, void* d)
|
|||
}
|
||||
|
||||
void cb_mnuSaveLogbook(Fl_Menu_*m, void* d) {
|
||||
if (qsodb.nbrRecs() == 0) return;
|
||||
const char* p = FSEL::saveas("Save logbook file", "ADIF\t*." ADIF_SUFFIX,
|
||||
logbook_filename.c_str());
|
||||
if (p) {
|
||||
logbook_filename = p;
|
||||
dlgLogbook->label(fl_filename_name(logbook_filename.c_str()));
|
||||
if (adifFile.writeLog (p, &qsodb))
|
||||
fl_message ("Could not write to %s", p);
|
||||
qsodb.isdirty(0);
|
||||
|
|
Ładowanie…
Reference in New Issue