Skip to content

Commit 4fc62cd

Browse files
committed
SimpCfg: Keep compiler happy, also add newline wrt alt logging def
1 parent f2f0be1 commit 4fc62cd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

common/simpcfg.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define TEST_LOGIC
1818
#ifdef TEST_LOGIC
19-
#define LOG_TEELN(FMT, ...) printf(FMT, __VA_ARGS__)
19+
#define LOG_TEELN(FMT, ...) printf(FMT"\n", __VA_ARGS__)
2020
#else
2121
#include "log.h"
2222
#endif
@@ -50,13 +50,13 @@ std::string str_trim(std::string sin) {
5050
return sin;
5151
}
5252

53-
bool sc_load(std::string &fname) {
53+
void sc_load(std::string &fname) {
5454
std::ifstream f {fname};
5555
if (!f) {
56-
LOG_TEELN("ERRR:%s:%s:failed to load...", __func__, fname);
56+
LOG_TEELN("ERRR:%s:%s:failed to load...", __func__, fname.c_str());
5757
throw std::runtime_error { "ERRR:SimpCfg:File not found" };
5858
} else {
59-
LOG_TEELN("DBUG:%s:%s", __func__, fname);
59+
LOG_TEELN("DBUG:%s:%s", __func__, fname.c_str());
6060
}
6161
std::string group;
6262
int iLine = 0;
@@ -74,24 +74,24 @@ bool sc_load(std::string &fname) {
7474
curL = str_trim(curL);
7575
if (bGroup) {
7676
group = curL;
77-
LOG_TEELN("DBUG:%s:%s:%s:%s", __func__, group);
77+
LOG_TEELN("DBUG:%s:%s", __func__, group.c_str());
7878
continue;
7979
}
8080
auto dPos = curL.find(':');
8181
if (dPos == std::string::npos) {
82-
LOG_TEELN("ERRR:%s:%d:invalid key value line:%s", __func__, iLine, curL);
82+
LOG_TEELN("ERRR:%s:%d:invalid key value line:%s", __func__, iLine, curL.c_str());
8383
throw std::runtime_error { "ERRR:SimpCfg:Invalid key value line" };
8484
}
8585
auto dEnd = curL.length() - dPos;
8686
if ((dPos == 0) || (dEnd < 2)) {
87-
LOG_TEELN("ERRR:%s:%d:invalid key value line:%s", __func__, iLine, curL);
87+
LOG_TEELN("ERRR:%s:%d:invalid key value line:%s", __func__, iLine, curL.c_str());
8888
throw std::runtime_error { "ERRR:SimpCfg:Invalid key value line" };
8989
}
9090
std::string key = curL.substr(0, dPos);
9191
key = str_trim(key);
9292
std::string value = curL.substr(dPos+1);
9393
value = str_trim(value);
94-
LOG_TEELN("DBUG:%s:%s:%s:%s", __func__, group, key, value);
94+
LOG_TEELN("DBUG:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), value.c_str());
9595
sc_set_string(group, key, value);
9696
}
9797
}

0 commit comments

Comments
 (0)