fldigi/fldigi-namespace.patch

1260 lines
35 KiB
Diff

commit d29a4156344ebd06da98e6a66a944368d8310040
Author: Richard Shaw <hobbes1069@gmail.com>
Date: Mon Oct 5 14:48:22 2020 -0500
c++17 fixes
* streampos has been in std:: for some time. Depreceated access via
ostringstream has been removed.
* Using namespace std is discouraged and can cause namespace conflicts. c++17
treats treats them as ambiguous references.
string
vector
empty
byte
diff --git a/src/flarq-src/b64.cxx b/src/flarq-src/b64.cxx
index 8c0147b6..5422149d 100644
--- a/src/flarq-src/b64.cxx
+++ b/src/flarq-src/b64.cxx
@@ -89,7 +89,7 @@ void base64::init()
dtable[(int)'='] = 0;
}
-string base64::encode(string in)
+std::string base64::encode(std::string in)
{
int n;
byte igroup[3], ogroup[4];
@@ -143,7 +143,7 @@ string base64::encode(string in)
return output;
}
-string base64::decode(string in)
+std::string base64::decode(std::string in)
{
int i;
output = "";
@@ -204,10 +204,10 @@ int main(int argc,char*argv[])
char * cp;
byte c;
- string inputstring;
- string infilename;
- string outputstring;
- string outfilename;
+ std::string inputstring;
+ std::string infilename;
+ std::string outputstring;
+ std::string outfilename;
base64 b64;
diff --git a/src/flarq-src/flarq.cxx b/src/flarq-src/flarq.cxx
index bbc746da..631416d7 100644
--- a/src/flarq-src/flarq.cxx
+++ b/src/flarq-src/flarq.cxx
@@ -99,27 +99,27 @@
// directory structures for all NBEMS applications
static void checkdirectories(void);
-string HomeDir;
-string NBEMS_dir;
-string ARQ_dir;
-string ARQ_files_dir;
-string ARQ_recv_dir;
-string ARQ_send_dir;
-string ARQ_mail_dir;
-string ARQ_mail_in_dir;
-string ARQ_mail_out_dir;
-string ARQ_mail_sent_dir;
-string WRAP_dir;
-string WRAP_recv_dir;
-string WRAP_send_dir;
-string WRAP_auto_dir;
-string ICS_dir;
-string ICS_msg_dir;
-string ICS_tmp_dir;
-
-string MailFileName = "";
-string MailSaveFileName = "";
-string Logfile;
+std::string HomeDir;
+std::string NBEMS_dir;
+std::string ARQ_dir;
+std::string ARQ_files_dir;
+std::string ARQ_recv_dir;
+std::string ARQ_send_dir;
+std::string ARQ_mail_dir;
+std::string ARQ_mail_in_dir;
+std::string ARQ_mail_out_dir;
+std::string ARQ_mail_sent_dir;
+std::string WRAP_dir;
+std::string WRAP_recv_dir;
+std::string WRAP_send_dir;
+std::string WRAP_auto_dir;
+std::string ICS_dir;
+std::string ICS_msg_dir;
+std::string ICS_tmp_dir;
+
+std::string MailFileName = "";
+std::string MailSaveFileName = "";
+std::string Logfile;
struct dirent *entry;
DIR *dp;
@@ -128,7 +128,7 @@ bool SendingEmail = false;
bool SHOWDEBUG = false;
-extern void STATUSprint(string s);
+extern void STATUSprint(std::string s);
Fl_Text_Buffer_mod *txtbuffARQ;
Fl_Text_Buffer_mod *txtbuffRX;
@@ -148,27 +148,27 @@ int arqstate = 0;
bool configured = false;
bool ioMPSK = false;
-string arq_address = "127.0.0.1";
-string arq_port = FLDIGI_port;
+std::string arq_address = "127.0.0.1";
+std::string arq_port = FLDIGI_port;
-string RX;
-string TX;
+std::string RX;
+std::string TX;
-string teststring;
+std::string teststring;
-string statusmsg;
+std::string statusmsg;
-string MyCall;
-string beacontext;
+std::string MyCall;
+std::string beacontext;
#if !defined(__APPLE__) && !defined(__WOE32__) && USE_X
Pixmap flarq_icon_pixmap;
#endif
Socket *tcpip = 0;
-string txbuffer;
-string cmdbuffer;
-string rxbuffer;
+std::string txbuffer;
+std::string cmdbuffer;
+std::string rxbuffer;
size_t bufsize = 0;
size_t bufptr = 0;
@@ -209,24 +209,24 @@ const char *ASCII[32] = {
"<FS>", "<GS>", "<RS>", "<US>" // 0x1C - 0x1F
};
-string AsciiChars;
-
-string incomingText = "";
-string txtarqload = "";
-string rxfname = "";
-string arqstart = "ARQ::STX\n";
-string arqend = "ARQ::ETX\n";
-string arqfile = "ARQ:FILE::";
-string arqemail = "ARQ:EMAIL::\n";
-string arqascii = "ARQ:ENCODING::ASCII\n";
-string arqbase64 = "ARQ:ENCODING::BASE64\n";
-string arqsizespec = "ARQ:SIZE::";
-size_t startpos = string::npos;
-size_t endpos = string::npos;
-size_t fnamepos = string::npos;
-size_t indx = string::npos;
-size_t sizepos = string::npos;
-size_t lfpos = string::npos;
+std::string AsciiChars;
+
+std::string incomingText = "";
+std::string txtarqload = "";
+std::string rxfname = "";
+std::string arqstart = "ARQ::STX\n";
+std::string arqend = "ARQ::ETX\n";
+std::string arqfile = "ARQ:FILE::";
+std::string arqemail = "ARQ:EMAIL::\n";
+std::string arqascii = "ARQ:ENCODING::ASCII\n";
+std::string arqbase64 = "ARQ:ENCODING::BASE64\n";
+std::string arqsizespec = "ARQ:SIZE::";
+size_t startpos = std::string::npos;
+size_t endpos = std::string::npos;
+size_t fnamepos = std::string::npos;
+size_t indx = std::string::npos;
+size_t sizepos = std::string::npos;
+size_t lfpos = std::string::npos;
size_t arqPayloadSize = 0;
bool haveemail = false;
bool rxARQfile = false;
@@ -245,7 +245,7 @@ double TransferTime;
int datedir = 1;
int todir = 1;
int subdir = 1;
-string sendfilename = "";
+std::string sendfilename = "";
void cb_SortByDate()
{
@@ -321,15 +321,15 @@ void selectTrafficOut(bool ComposerOnly)
tblOutgoing->gridEnabled (true);
}
tblOutgoing->clear();
- string fline, fname, fdate, fto, fsubj;
+ std::string fline, fname, fdate, fto, fsubj;
char szline[10000];
size_t p;
- string folder = ARQ_mail_out_dir;
+ std::string folder = ARQ_mail_out_dir;
dp = 0;
dp = opendir(folder.c_str());
if (dp == 0) {
- string nfound = folder;
+ std::string nfound = folder;
nfound += " not found";
fl_message("%s", nfound.c_str());
return;
@@ -340,7 +340,7 @@ void selectTrafficOut(bool ComposerOnly)
if (entry->d_name[0] == '.')
continue;
fname = folder; fname.append(entry->d_name);
- if (fname.find(".eml") == string::npos)
+ if (fname.find(".eml") == std::string::npos)
continue;
int validlines = 0;
ifstream emailtxt(fname.c_str());
@@ -348,28 +348,28 @@ void selectTrafficOut(bool ComposerOnly)
memset(szline, 0, 10000);
emailtxt.getline(szline,10000);
fline = szline;
- if ((p = fline.find("Date: ")) != string::npos) {
+ if ((p = fline.find("Date: ")) != std::string::npos) {
fdate = fline.substr(p + 6);
validlines++;
continue;
}
- if ((p = fline.find("To: ")) != string::npos) {
+ if ((p = fline.find("To: ")) != std::string::npos) {
fto = fline.substr(p + 4);
p = fto.find('@');
- if (p != string::npos) fto.replace(p,1,"@@");
+ if (p != std::string::npos) fto.replace(p,1,"@@");
p = fto.find("<");
- if (p != string::npos) fto.erase(p,1);
+ if (p != std::string::npos) fto.erase(p,1);
p = fto.find(">");
- if (p != string::npos) fto.erase(p,1);
+ if (p != std::string::npos) fto.erase(p,1);
validlines++;
continue;
}
- if ((p = fline.find("Subject: ")) != string::npos) {
+ if ((p = fline.find("Subject: ")) != std::string::npos) {
fsubj = fline.substr(p + 9);
validlines++;
continue;
}
- if ((p = fline.find("//FLARQ COMPOSER")) != string::npos)
+ if ((p = fline.find("//FLARQ COMPOSER")) != std::string::npos)
validlines++;
}
emailtxt.close();
@@ -390,20 +390,20 @@ void selectTrafficOut(bool ComposerOnly)
//======================================================================================
// simple email composer
//======================================================================================
-extern bool fileExists(string fname);
+extern bool fileExists(std::string fname);
void cb_CancelComposeMail()
{
composer->hide();
}
-void readComposedFile(string filename)
+void readComposedFile(std::string filename)
{
ifstream textfile;
textfile.open(filename.c_str());
if (textfile) {
char szline[10000];
- string fline, tempstr;
+ std::string fline, tempstr;
size_t p;
txtMailText->clear();
inpMailFrom->value("");
@@ -413,27 +413,27 @@ void readComposedFile(string filename)
memset(szline,0, 10000);
textfile.getline(szline,10000);
fline = szline;
- if ((p = fline.find("//FLARQ COMPOSER")) != string::npos)
+ if ((p = fline.find("//FLARQ COMPOSER")) != std::string::npos)
continue;
- if ((p = fline.find("Date: ")) != string::npos)
+ if ((p = fline.find("Date: ")) != std::string::npos)
continue;
- if ((p = fline.find("Content-Type:")) != string::npos)
+ if ((p = fline.find("Content-Type:")) != std::string::npos)
continue;
- if ((p = fline.find("From: ")) != string::npos) {
+ if ((p = fline.find("From: ")) != std::string::npos) {
tempstr = fline.substr(p + 6);
inpMailFrom->value(tempstr.c_str());
continue;
}
- if ((p = fline.find("To: ")) != string::npos) {
+ if ((p = fline.find("To: ")) != std::string::npos) {
tempstr = fline.substr(p + 4);
p = tempstr.find("<");
- if (p != string::npos) tempstr.erase(p,1);
+ if (p != std::string::npos) tempstr.erase(p,1);
p = tempstr.find(">");
- if (p != string::npos) tempstr.erase(p,1);
+ if (p != std::string::npos) tempstr.erase(p,1);
inpMailTo->value(tempstr.c_str());
continue;
}
- if ((p = fline.find("Subject: ")) != string::npos) {
+ if ((p = fline.find("Subject: ")) != std::string::npos) {
inpMailSubj->value(fline.substr(p + 9).c_str());
continue;
}
@@ -447,7 +447,7 @@ void readComposedFile(string filename)
void cb_UseTemplate()
{
- string templatename = ARQ_mail_out_dir;
+ std::string templatename = ARQ_mail_out_dir;
const char *p = FSEL::select("Load Template file", "*.tpl", templatename.c_str());
if (!p) return;
if (!*p) return;
@@ -463,17 +463,17 @@ void cb_ClearComposer()
inpMailSubj->value("");
}
-string nextEmailFile(string fname)
+std::string nextEmailFile(std::string fname)
{
int nbr = 0;
char szNbr[20];
- string name;
- string ext;
- string nuname;
+ std::string name;
+ std::string ext;
+ std::string nuname;
size_t p;
p = fname.find_last_of('.');
- if (p != string::npos) {
+ if (p != std::string::npos) {
ext = fname.substr(p);
name = fname.substr(0,p);
} else {
@@ -495,7 +495,7 @@ string nextEmailFile(string fname)
return nuname;
}
-void saveComposedText(string filename)
+void saveComposedText(std::string filename)
{
ofstream textfile;
textfile.open(filename.c_str());
@@ -530,7 +530,7 @@ void SaveComposeMail()
void SaveComposeTemplate()
{
- string templatename = ARQ_mail_out_dir;
+ std::string templatename = ARQ_mail_out_dir;
const char *p = FSEL::saveas("Save Template file", "*.tpl", templatename.c_str());
if (!p) return;
if (!*p) return;
@@ -573,11 +573,11 @@ void ComposeMail()
//======================================================================================
-string noCR(string s)
+std::string noCR(std::string s)
{
- string text = s;
+ std::string text = s;
size_t p;
- while ((p = text.find('\r')) != string::npos)
+ while ((p = text.find('\r')) != std::string::npos)
text.erase(p,1);
return text;
}
@@ -606,9 +606,9 @@ void initVals()
}
-void testDirectory(string dir)
+void testDirectory(std::string dir)
{
- string tstdir = ARQ_dir;
+ std::string tstdir = ARQ_dir;
tstdir += '/';
tstdir.append(dir);
ifstream test(tstdir.c_str());
@@ -621,7 +621,7 @@ void testDirectory(string dir)
void readConfig()
{
extern void cbMenuConfig();
- string configfname = ARQ_dir;
+ std::string configfname = ARQ_dir;
configfname.append("flarq.config");
ifstream configfile(configfname.c_str());
if (configfile) {
@@ -662,7 +662,7 @@ void readConfig()
void saveConfig()
{
- string configfname = ARQ_dir;
+ std::string configfname = ARQ_dir;
configfname.append("flarq.config");
ofstream configfile(configfname.c_str());
if (configfile) {
@@ -730,13 +730,13 @@ void cbMenuAbout()
fl_message2("flarq - ARQ client\nversion: %s\nw1hkj@@w1hkj.com", VERSION);
}
-string txhold = "";
+std::string txhold = "";
//=============================================================================
void mpsk_on()
{
- string s;
+ std::string s;
s.append(1, MPSK_CMD).append(MPSK_TX).append(1, MPSK_END);
try {
tcpip->send(s);
@@ -748,7 +748,7 @@ void mpsk_on()
void mpsk_off_after_buffer_sent()
{
- string s;
+ std::string s;
s.append(1, MPSK_CMD).append(MPSK_TX2RX).append(1, MPSK_END);
try {
tcpip->send(s);
@@ -760,7 +760,7 @@ void mpsk_off_after_buffer_sent()
void mpsk_off()
{
- string s;
+ std::string s;
s.append(1, MPSK_CMD).append(MPSK_RX).append(1, MPSK_END);
try {
tcpip->send(s);
@@ -770,11 +770,11 @@ void mpsk_off()
}
}
-void MPSK_client_transmit(const string& s)
+void MPSK_client_transmit(const std::string& s)
{
if (s.empty())
return;
- string tosend;
+ std::string tosend;
tosend.reserve(s.length() * 2);
for (size_t i = 0; i < s.length(); i++)
tosend.append(1, MPSK_BYTE).append(1, s[i]);
@@ -814,7 +814,7 @@ void MPSK_Socket_rcv_loop(void *)
if (isCmdChar) {
if (cs == MPSK_CMDEND) {
isCmdChar = false;
- if (cmdbuffer.find("RX_AFTER_TX OK") != string::npos) {
+ if (cmdbuffer.find("RX_AFTER_TX OK") != std::string::npos) {
rxbuffer += 0x06;
cmdbuffer.clear();
txbuffer.clear();
@@ -848,7 +848,7 @@ void MPSK_Socket_rcv_loop(void *)
//=============================================================================
-void client_transmit(const string& s )
+void client_transmit(const std::string& s )
{
try {
if (!s.empty())
@@ -966,7 +966,7 @@ void arqBEACON()
}
}
-void printstring(string s)
+void printstring(std::string s)
{
for (size_t n = 0; n < s.length(); n++)
if (s[n] < ' ') printf("<%02d>",(int)s[n]);
@@ -1028,7 +1028,7 @@ void arqCONNECT()
}
}
-bool fileExists(string fname)
+bool fileExists(std::string fname)
{
ifstream test(fname.c_str());
if (test) {
@@ -1038,17 +1038,17 @@ bool fileExists(string fname)
return false;
}
-string nextFileName(string fname)
+std::string nextFileName(std::string fname)
{
int nbr = 0;
char szNbr[20];
- string name;
- string ext;
- string nuname;
+ std::string name;
+ std::string ext;
+ std::string nuname;
size_t p;
p = fname.find_last_of('.');
- if (p != string::npos) {
+ if (p != std::string::npos) {
ext = fname.substr(p);
name = fname.substr(0,p);
} else {
@@ -1070,15 +1070,15 @@ string nextFileName(string fname)
void saveEmailFile()
{
static char xfrmsg[80];
- string tempname;
+ std::string tempname;
time(&EndTime_t);
TransferTime = difftime(EndTime_t, StartTime_t);
snprintf(xfrmsg, sizeof(xfrmsg), "Transfer Completed in %4.0f sec's", TransferTime);
- string savetoname = ARQ_mail_in_dir;
+ std::string savetoname = ARQ_mail_in_dir;
- if (rxfname.find(".eml") == string::npos)
+ if (rxfname.find(".eml") == std::string::npos)
rxfname.append(".eml");
savetoname.append(rxfname);
while (fileExists(savetoname))
@@ -1103,7 +1103,7 @@ void saveRxFile()
TransferTime = difftime(EndTime_t, StartTime_t);
snprintf(xfrmsg, sizeof(xfrmsg), "Transfer Completed in %4.0f sec's", TransferTime);
- string savetoname = ARQ_recv_dir;
+ std::string savetoname = ARQ_recv_dir;
savetoname.append(rxfname);
if (fileExists(savetoname))
savetoname = nextFileName(savetoname);
@@ -1120,10 +1120,10 @@ void saveRxFile()
rxTextReady = false;
}
-void payloadText(string s)
+void payloadText(std::string s)
{
static char szPercent[10];
- string text = noCR(s);
+ std::string text = noCR(s);
txtARQ->insert(text.c_str());
txtARQ->show_insert_position();
@@ -1132,17 +1132,17 @@ void payloadText(string s)
incomingText.append (s);
if (!rxARQfile)
- if ((startpos = incomingText.find(arqstart)) != string::npos) {
+ if ((startpos = incomingText.find(arqstart)) != std::string::npos) {
rxARQfile = true;
startpos += arqstart.length();
time(&StartTime_t);
}
if (rxARQfile) {
if (!rxARQhavesize) {
- if ( (sizepos = incomingText.find(arqsizespec)) != string::npos) {
+ if ( (sizepos = incomingText.find(arqsizespec)) != std::string::npos) {
sizepos += arqsizespec.length();
- if ((lfpos = incomingText.find('\n', sizepos)) != string::npos) {
- string sizechars = incomingText.substr(sizepos, lfpos - sizepos);
+ if ((lfpos = incomingText.find('\n', sizepos)) != std::string::npos) {
+ std::string sizechars = incomingText.substr(sizepos, lfpos - sizepos);
unsigned int tempnbr;
sscanf(sizechars.c_str(), "%u", &tempnbr);
arqPayloadSize = tempnbr;
@@ -1154,7 +1154,7 @@ void payloadText(string s)
}
}
} else {
- if (startpos != string::npos) {
+ if (startpos != std::string::npos) {
float partial = incomingText.length() - startpos;
snprintf(szPercent, sizeof(szPercent), "%3.0f %%", 100.0 * partial / arqPayloadSize);
prgStatus->value( partial / arqPayloadSize );
@@ -1166,25 +1166,25 @@ void payloadText(string s)
prgStatus->redraw();
prgStatus->redraw_label();
}
- if ((endpos = incomingText.find(arqend)) != string::npos) {
+ if ((endpos = incomingText.find(arqend)) != std::string::npos) {
haveemail = false;
fnamepos = incomingText.find(arqfile);
fnamepos += arqfile.length();
indx = incomingText.find('\n', fnamepos);
rxfname = incomingText.substr(fnamepos, indx - fnamepos);
txtarqload = incomingText.substr(startpos, endpos - startpos);
- if (incomingText.find(arqbase64) != string::npos) {
+ if (incomingText.find(arqbase64) != std::string::npos) {
base64 b64;
txtarqload = b64.decode(txtarqload);
}
- if (incomingText.find(arqemail) != string::npos)
+ if (incomingText.find(arqemail) != std::string::npos)
haveemail = true;
- startpos = string::npos;
- endpos = string::npos;
- fnamepos = string::npos;
- indx = string::npos;
- sizepos = string::npos;
- lfpos = string::npos;
+ startpos = std::string::npos;
+ endpos = std::string::npos;
+ fnamepos = std::string::npos;
+ indx = std::string::npos;
+ sizepos = std::string::npos;
+ lfpos = std::string::npos;
arqPayloadSize = 0;
rxARQfile = false;
rxARQhavesize = false;
@@ -1224,7 +1224,7 @@ void abortTransfer()
digi_arq->abort();
}
-void rxBeaconCallsign(string s)
+void rxBeaconCallsign(std::string s)
{
txtURCALL->value(s.c_str());
beaconrcvd = true;
@@ -1237,7 +1237,7 @@ void moveEmailFile()
ifstream infile(MailFileName.c_str(), ios::in | ios::binary);
- if (MailSaveFileName.find(".eml") == string::npos)
+ if (MailSaveFileName.find(".eml") == std::string::npos)
MailSaveFileName.append(".eml");
while (fileExists(MailSaveFileName))
MailSaveFileName = nextFileName(MailSaveFileName);
@@ -1273,7 +1273,7 @@ void sendEmailFile()
char cin;
size_t txtsize;
- string textin = "";
+ std::string textin = "";
char sizemsg[40];
size_t p;
@@ -1287,7 +1287,7 @@ void sendEmailFile()
TX.append(arqfile);
MailSaveFileName = ARQ_mail_sent_dir;
p = sendfilename.find_last_of('/');
- if (p != string::npos) p++;
+ if (p != std::string::npos) p++;
MailSaveFileName.append(sendfilename.substr(p));
TX.append(sendfilename.substr(p));
TX.append("\n");
@@ -1296,7 +1296,7 @@ void sendEmailFile()
// only allow ASCII printable characters
while (textfile.get(cin)) textin += (cin & 0xFF);
textfile.close();
- if ( textin.find_first_not_of(AsciiChars) != string::npos) {
+ if ( textin.find_first_not_of(AsciiChars) != std::string::npos) {
fl_alert2("File contains non-ASCII bytes and must be sent as binary.");
return;
}
@@ -1333,12 +1333,12 @@ void sendAsciiFile()
fl_alert2("Not connected");
return;
}
- string readfromname = ARQ_send_dir;
+ std::string readfromname = ARQ_send_dir;
readfromname.append(rxfname);
const char *p = FSEL::select("ARQ text file", "*.txt\t*", readfromname.c_str());
char cin;
size_t txtsize;
- string textin = "";
+ std::string textin = "";
char sizemsg[40];
if (p && *p) {
ifstream textfile;
@@ -1353,7 +1353,7 @@ void sendAsciiFile()
while (textfile.get(cin)) textin += (cin & 0xFF);
textfile.close();
- if ( textin.find_first_not_of(AsciiChars) != string::npos) {
+ if ( textin.find_first_not_of(AsciiChars) != std::string::npos) {
fl_alert2("File contains non-ASCII bytes and must be sent as binary.");
return;
}
@@ -1389,8 +1389,8 @@ void sendImageFile()
const char *p = FSEL::select(_("ARQ image file"), "Images\t*.{png,jpg,bmp}", "");
char cin;
size_t b64size;
- string textin = "";
- string b64text;
+ std::string textin = "";
+ std::string b64text;
base64 b64(true);
char sizemsg[40];
if (p && *p) {
@@ -1438,8 +1438,8 @@ void sendBinaryFile()
const char *p = FSEL::select("ARQ file", "*", "");
char cin;
size_t b64size;
- string textin = "";
- string b64text;
+ std::string textin = "";
+ std::string b64text;
base64 b64(true);
char sizemsg[40];
if (p && *p) {
@@ -1689,7 +1689,7 @@ void changeMyCall(const char *nucall)
txtMyCall->value(MyCall.c_str());
digi_arq->myCall(MyCall.c_str());
- string title = "flarq ";
+ std::string title = "flarq ";
title.append(VERSION);
title.append(" - ");
title.append(MyCall);
@@ -1702,7 +1702,7 @@ void changeBeaconText(const char *txt)
beacontext = txt;
}
-void TALKprint(string s)
+void TALKprint(std::string s)
{
txtRX->insert(s.c_str());
txtRX->show_insert_position();
@@ -1715,7 +1715,7 @@ void clear_STATUS(void* arg)
}
-void STATUSprint(string s, double disptime)
+void STATUSprint(std::string s, double disptime)
{
txtStatus2->value(s.c_str());
if (disptime > 0.0) {
@@ -1726,7 +1726,7 @@ void STATUSprint(string s, double disptime)
void cbSendTalk()
{
- string tosend;
+ std::string tosend;
tosend = txtTX->value();
if (tosend.empty()) return;
tosend += '\n';
@@ -1737,12 +1737,12 @@ void cbSendTalk()
txtRX->redraw();
}
-void arqlog(string nom,string s)
+void arqlog(std::string nom,std::string s)
{
static char szGMT[80];
tm *now;
time_t tm;
- string strdebug;
+ std::string strdebug;
time(&tm);
now = localtime( &tm );
@@ -1758,28 +1758,28 @@ void arqlog(string nom,string s)
logfile << nom << szGMT << strdebug << endl;
}
-void DEBUGrxprint(string s)
+void DEBUGrxprint(std::string s)
{
- string text = noCR(s);
+ std::string text = noCR(s);
txtRX->insert(text.c_str());
txtRX->show_insert_position();
txtRX->redraw();
arqlog("<RX>",s);
}
-void DEBUGtxprint(string s)
+void DEBUGtxprint(std::string s)
{
- string text = noCR(s);
+ std::string text = noCR(s);
txtRX->insert(text.c_str());
txtRX->show_insert_position();
txtRX->redraw();
arqlog("<TX>",s);
}
-void TXecho(string s)
+void TXecho(std::string s)
{
blocksSent += s.length();
- string text = noCR(s);
+ std::string text = noCR(s);
txtARQ->insert(text.c_str());
txtARQ->show_insert_position();
txtARQ->redraw();
@@ -1809,13 +1809,13 @@ int main (int argc, char *argv[] )
NBEMS_dir.clear();
{
- string appname = argv[0];
- string appdir = argv[0];
+ std::string appname = argv[0];
+ std::string appdir = argv[0];
#ifdef __WIN32__
size_t p = appdir.find("FL_APPS\\");
- if (p == string::npos) p = appdir.find("FL_APPS/");
- if (p == string::npos) {
+ if (p == std::string::npos) p = appdir.find("FL_APPS/");
+ if (p == std::string::npos) {
char dirbuf[FL_PATH_MAX + 1];
fl_filename_expand(dirbuf, sizeof(dirbuf) -1, "$USERPROFILE/");
NBEMS_dir.assign(dirbuf);
@@ -1827,10 +1827,10 @@ int main (int argc, char *argv[] )
fl_filename_absolute(dirbuf, sizeof(dirbuf), argv[0]);
appdir.assign(dirbuf);
size_t p = appdir.rfind("flarq");
- if (p != string::npos)
+ if (p != std::string::npos)
appdir.erase(p);
p = appdir.find("FL_APPS/");
- if (p != string::npos)
+ if (p != std::string::npos)
NBEMS_dir.assign(appdir.substr(0, p + 8));
else {
fl_filename_expand(dirbuf, FL_PATH_MAX, "$HOME/");
@@ -1838,7 +1838,7 @@ int main (int argc, char *argv[] )
}
DIR *isdir = 0;
- string test_dir;
+ std::string test_dir;
test_dir.assign(NBEMS_dir).append("NBEMS.files/");
isdir = opendir(test_dir.c_str());
if (isdir) {
@@ -1896,7 +1896,7 @@ int main (int argc, char *argv[] )
tcpip->connect();
}
catch (const SocketException& e) {
- string errmsg;
+ std::string errmsg;
errmsg.append("Could not connect to modem program.\nPlease start ");
if (ioMPSK)
errmsg.append("MultiPSK");
@@ -1937,7 +1937,7 @@ int main (int argc, char *argv[] )
readConfig();
- string title = "flarq ";
+ std::string title = "flarq ";
title.append(VERSION);
title.append(" - ");
title.append(MyCall);
@@ -1968,7 +1968,7 @@ int main (int argc, char *argv[] )
static void checkdirectories(void)
{
struct DIRS {
- string& dir;
+ std::string& dir;
const char* suffix;
void (*new_dir_func)(void);
};
diff --git a/src/flarq-src/include/arq.h b/src/flarq-src/include/arq.h
index 255e3531..08566f60 100644
--- a/src/flarq-src/include/arq.h
+++ b/src/flarq-src/include/arq.h
@@ -49,8 +49,6 @@
extern int idtimer;
-using namespace std;
-
#define DEBUG
#define arq_Version "arq 0.1"
@@ -132,7 +130,7 @@ public:
~Ccrc16() {};
void reset() { crcval = 0xFFFF;}
unsigned int val() {return crcval;}
- string sval() {
+ std::string sval() {
snprintf(ss, sizeof(ss), "%04X", crcval);
return ss;
}
@@ -149,31 +147,31 @@ public:
update(c);
return crcval;
}
- unsigned int crc16(string s) {
+ unsigned int crc16(std::string s) {
reset();
for (size_t i = 0; i < s.length(); i++)
update(s[i]);
return crcval;
}
- string scrc16(string s) {
+ std::string scrc16(std::string s) {
crc16(s);
return sval();
}
};
-// text block; block # and string of text
+// text block; block # and std::string of text
class cTxtBlk {
private:
int number;
- string txt;
+ std::string txt;
public:
cTxtBlk() {number = -1; txt = "";}
- cTxtBlk(int n, string text) { number = n; txt = text; }
+ cTxtBlk(int n, std::string text) { number = n; txt = text; }
~cTxtBlk() {}
void nbr(int n) { number = n;}
int nbr() { return number; }
- string text() { return txt; }
- void text(string t) { txt = t;}
+ std::string text() { return txt; }
+ void text(std::string t) { txt = t;}
bool operator <(const cTxtBlk &b)const { return number < b.number; }
bool operator ==(const cTxtBlk b)const { return number == b.number; }
};
@@ -184,15 +182,15 @@ class arq {
private:
bool arqstop;
- string MyCall;
- string UrCall;
+ std::string MyCall;
+ std::string UrCall;
- string Header;
- string Frame;
- string Payload;
- string rcvPayload;
+ std::string Header;
+ std::string Frame;
+ std::string Payload;
+ std::string rcvPayload;
- string logfile;
+ std::string logfile;
char MyStreamID;
char UrStreamID;
@@ -204,10 +202,10 @@ private:
int blknbr;
// queues //
- string TxTextQueue; // Text out to mail engine
- string TxPlainTextQueue; // plain text transmit queu
- string RxTextQueue; // Text in from mail engine
- string RxFrameQueue;
+ std::string TxTextQueue; // Text out to mail engine
+ std::string TxPlainTextQueue; // plain text transmit queu
+ std::string RxTextQueue; // Text in from mail engine
+ std::string RxFrameQueue;
char lastRxChar;
bool TXflag;
@@ -256,19 +254,19 @@ private:
int blkcount;
int Blocks2Send; // number of blocks at beginning of Tx
- vector<int> MyMissing; // missing Rx blocks
- string MissingRxBlocks;
- vector<cTxtBlk> RxPending; // RxPending Rx blocks (not consecutive)
+ std::vector<int> MyMissing; // missing Rx blocks
+ std::string MissingRxBlocks;
+ std::vector<cTxtBlk> RxPending; // RxPending Rx blocks (not consecutive)
- list<cTxtBlk> TxBlocks; // fifo of transmit buffers
- list<cTxtBlk> TxMissing; // fifo of sent; RxPending Status report
- list<cTxtBlk> TxPending; // fifo of transmitted buffers pending print
+ std::list<cTxtBlk> TxBlocks; // fifo of transmit buffers
+ std::list<cTxtBlk> TxMissing; // fifo of sent; RxPending Status report
+ std::list<cTxtBlk> TxPending; // fifo of transmitted buffers pending print
// Ur status
int UrGoodHeader; // Other station's Good Header
int UrLastHeader; // Other station's Header last sent
int UrEndHeader; // Other station's last received Header
- vector<int> UrMissing; // Other station's missing Headers
+ std::vector<int> UrMissing; // Other station's missing Headers
int LinkState; // status of ARQ link
int Sending;
@@ -286,7 +284,7 @@ private:
void setBufferlength();
void checkblocks();
- string upcase(string s);
+ std::string upcase(std::string s);
void newblocknumber();
void newHeader();
void IdHeader();
@@ -304,16 +302,16 @@ private:
void disconnectFrame();
void abortFrame();
void ackAbortFrame();
- void beaconFrame(string txt);
+ void beaconFrame(std::string txt);
void textFrame(cTxtBlk block);
- void talkFrame(string txt);
+ void talkFrame(std::string txt);
- void addToTxQue(string s);
+ void addToTxQue(std::string s);
void sendblocks();
void transmitdata();
- string frame() {return Frame;}
+ std::string frame() {return Frame;}
bool isUrcall();
void parseIDENT();
@@ -330,22 +328,22 @@ private:
void parseDATA();
void parseTALK();
- int parseFrame(string txt);
+ int parseFrame(std::string txt);
// external functions called by arq class
- void (*sendfnc)(const string& s);
+ void (*sendfnc)(const std::string& s);
bool (*getc1)(char &);
void (*rcvfnc)();
- void (*printRX)(string s);
- void (*printTX)(string s);
- void (*printRX_DEBUG)(string s);
- void (*printTX_DEBUG)(string s);
- void (*printTALK)(string s);
+ void (*printRX)(std::string s);
+ void (*printTX)(std::string s);
+ void (*printRX_DEBUG)(std::string s);
+ void (*printTX_DEBUG)(std::string s);
+ void (*printTALK)(std::string s);
void (*abortfnc)();
void (*disconnectfnc)();
- void (*rxUrCall)(string s);
- void (*qualityfnc)(string s);
- void (*printSTATUS)(string s, double disptime);
+ void (*rxUrCall)(std::string s);
+ void (*qualityfnc)(std::string s);
+ void (*printSTATUS)(std::string s, double disptime);
public:
arq();
@@ -356,26 +354,26 @@ public:
void restart_arq();
- string checksum(string &s);
+ std::string checksum(std::string &s);
- void myCall(string s) { MyCall = upcase(s);}
- string myCall() { return MyCall;}
+ void myCall(std::string s) { MyCall = upcase(s);}
+ std::string myCall() { return MyCall;}
- void urCall(string s) { UrCall = s;}
- string urCall() { return UrCall;}
+ void urCall(std::string s) { UrCall = s;}
+ std::string urCall() { return UrCall;}
void newsession();
- void setSendFunc( void (*f)(const string& s)) { sendfnc = f;}
+ void setSendFunc( void (*f)(const std::string& s)) { sendfnc = f;}
void setGetCFunc( bool (*f)(char &)) { getc1 = f;}
void setRcvFunc( void (*f)()) { rcvfnc = f;}
- void setPrintRX( void (*f)(string s)) { printRX = f;}
- void setPrintTX( void (*f)(string s)) { printTX = f;}
- void setPrintTALK (void (*f)(string s)) {printTALK = f;}
- void setPrintRX_DEBUG (void (*f)(string s)){printRX_DEBUG = f;}
- void setPrintTX_DEBUG (void (*f)(string s)) {printTX_DEBUG = f;}
- void setPrintSTATUS (void (*f)(string s, double disptime)) { printSTATUS = f;}
+ void setPrintRX( void (*f)(std::string s)) { printRX = f;}
+ void setPrintTX( void (*f)(std::string s)) { printTX = f;}
+ void setPrintTALK (void (*f)(std::string s)) {printTALK = f;}
+ void setPrintRX_DEBUG (void (*f)(std::string s)){printRX_DEBUG = f;}
+ void setPrintTX_DEBUG (void (*f)(std::string s)) {printTX_DEBUG = f;}
+ void setPrintSTATUS (void (*f)(std::string s, double disptime)) { printSTATUS = f;}
void setMaxHeaders( int mh ) { maxheaders = mh; }
void setExponent( int exp ) { exponent = exp; setBufferlength(); }
@@ -397,22 +395,22 @@ public:
else _idtimer = (10 * 60 - 10) * 1000 / ARQLOOPTIME;
}
- void setrxUrCall( void (*f)(string s)) { rxUrCall = f;}
- void setQualityValue( void (*f)(string s)) { qualityfnc = f;}
+ void setrxUrCall( void (*f)(std::string s)) { rxUrCall = f;}
+ void setQualityValue( void (*f)(std::string s)) { qualityfnc = f;}
void setAbortedTransfer( void (*f)()) { abortfnc = f;};
void setDisconnected( void (*f)()) { disconnectfnc = f;};
void rcvChar( char c );
- void connect(string callsign);//, int blocksize = 6, int retries = 4);
+ void connect(std::string callsign);//, int blocksize = 6, int retries = 4);
- void sendblocks( string txt );
+ void sendblocks( std::string txt );
- void sendBeacon (string txt);
- void sendPlainText( string txt );
+ void sendBeacon (std::string txt);
+ void sendPlainText( std::string txt );
- string getText() { return RxTextQueue;}
- void sendText(string txt);
+ std::string getText() { return RxTextQueue;}
+ void sendText(std::string txt);
bool connected() { return (LinkState == ARQ_CONNECTED); }
void disconnect();
diff --git a/src/flarq-src/include/b64.h b/src/flarq-src/include/b64.h
index c17ad1d2..e60c6649 100644
--- a/src/flarq-src/include/b64.h
+++ b/src/flarq-src/include/b64.h
@@ -10,14 +10,12 @@
#include <string>
-using namespace std;
-
typedef unsigned char byte;
class base64 {
#define LINELEN 72
private:
- string output;
+ std::string output;
size_t iolen;
size_t iocp;
bool ateof;
@@ -29,6 +27,6 @@ private:
public:
base64(bool t = false) {crlf = t; init(); };
~base64(){};
- string encode(string in);
- string decode(string in);
+ std::string encode(std::string in);
+ std::string decode(std::string in);
};
diff --git a/src/flarq-src/xml_server.cxx b/src/flarq-src/xml_server.cxx
index eef34228..ed0735a6 100644
--- a/src/flarq-src/xml_server.cxx
+++ b/src/flarq-src/xml_server.cxx
@@ -139,7 +139,7 @@ public:
flarq_send_text(XmlRpcServer* s) : XmlRpcServerMethod("flarq.send_text", s) {}
void execute(XmlRpcValue& params, XmlRpcValue &result) {
- std::string txt_to_send = string(params[0]);
+ std::string txt_to_send = std::string(params[0]);
send_xml_text("FLMSG_XFR", txt_to_send);
}
std::string help() { return std::string("send_text"); }
@@ -147,7 +147,7 @@ public:
} flarq_send_text(&flarq_server);
struct MLIST {
- string name; string signature; string help;
+ std::string name; std::string signature; std::string help;
} mlist[] = {
{ "flarq.rcvd_text", "s:n", "return MODE of current VFO" },
{ "flarq.get_state", "s:n", "return PTT state" },
@@ -160,7 +160,7 @@ public:
void execute(XmlRpcValue& params, XmlRpcValue& result) {
- vector<XmlRpcValue> methods;
+ std::vector<XmlRpcValue> methods;
for (size_t n = 0; n < sizeof(mlist) / sizeof(*mlist); ++n) {
XmlRpcValue::ValueStruct item;
item["name"] = mlist[n].name;
diff --git a/src/logbook/qrzlib.cxx b/src/logbook/qrzlib.cxx
index 1a43d8e8..55ac2e27 100644
--- a/src/logbook/qrzlib.cxx
+++ b/src/logbook/qrzlib.cxx
@@ -32,7 +32,7 @@
#include <string>
#include <iostream>
-using namespace std;
+//using namespace std;
#include "qrzlib.h"
#include "configuration.h"
@@ -153,7 +153,7 @@ int checkPath( const char *filename )
strcpy (QRZdir, pathname);
return 1;
}
- string err = fname;
+ std::string err = fname;
err.append(" not found, performing search");
LOG_WARN("%s", err.c_str());
notfound = true;
@@ -178,7 +178,7 @@ int checkPath( const char *filename )
else
strcpy (QRZdir, QRZpath);
if (notfound) {
- string err = "Using ";
+ std::string err = "Using ";
err.append(fname);
LOG_WARN("%s", err.c_str());
}
@@ -748,12 +748,12 @@ int QRZ::FindRecord( char *field )
return( ReadRec() );
}
-static char empty[] = { '\0' };
int QRZ::ReadRec()
{
char *comma;
+ static char empty[] = { '\0' };
if( found == 1 ) {
Qcall = recbuffer;
diff --git a/src/widgets/picture.cxx b/src/widgets/picture.cxx
index b14ecdf6..431c7c86 100644
--- a/src/widgets/picture.cxx
+++ b/src/widgets/picture.cxx
@@ -539,7 +539,7 @@ static FILE* open_file(const char* name, const char* suffix)
fclose(fp);
const int n = 5; // rename existing image files to keep up to 5 old versions
ostringstream oldfn, newfn;
- ostringstream::streampos p;
+ std::streampos p;
oldfn << name << '.';
newfn << name << '.';