summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-07-25 13:29:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-07-25 13:29:15 +0300
commitfa54e993b8764b385898e3ed658b777a60d0da5f (patch)
tree451eff0f176703542808abafb9ceb25a3d99d10a
parent9ff49558ea374a70cdb6fd6d16cf75dbf05d4fed (diff)
more warning fixes
-rw-r--r--src/mir_app/src/netlibhttp.cpp2
-rw-r--r--src/mir_app/src/netliblog.cpp26
2 files changed, 14 insertions, 14 deletions
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index 52e92a56f2..575aff8623 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -448,7 +448,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr
if (usingProxy && phost && !nlc->dnsThroughProxy) {
char *tszHost = mir_strdup(phost);
- if (ppath && phost)
+ if (ppath)
tszHost[ppath - phost] = 0;
char *cln = strchr(tszHost, ':'); if (cln) *cln = 0;
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index fd8858fa92..bd41723192 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -375,7 +375,7 @@ void PROTO_INTERFACE::debugLogW(const wchar_t *wszFormat, ...)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Netlib_Logf(HNETLIBUSER hUser, const char *fmt, ...)
+MIR_APP_DLL(int) Netlib_Logf(HNETLIBUSER hUser, _Printf_format_string_ const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
@@ -385,7 +385,7 @@ MIR_APP_DLL(int) Netlib_Logf(HNETLIBUSER hUser, const char *fmt, ...)
return NetlibLog_Worker(hUser, szText, 0);
}
-MIR_APP_DLL(int) Netlib_LogfW(HNETLIBUSER hUser, const wchar_t *fmt, ...)
+MIR_APP_DLL(int) Netlib_LogfW(HNETLIBUSER hUser, _Printf_format_string_ const wchar_t *fmt, ...)
{
va_list va;
va_start(va, fmt);
@@ -434,7 +434,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla
NetlibUser *nlu = nlc ? nlc->nlu : nullptr;
if (!(flags & MSG_NOTITLE))
- str.Format("(%p:%u) Data %s%s\r\n", nlc, nlc ? nlc->s : 0, sent ? "sent" : "received", flags & MSG_DUMPPROXY ? " (proxy)" : "");
+ str.Format("(%p:%u) Data %s%s\r\n", nlc, nlc ? (int)nlc->s : 0, sent ? "sent" : "received", flags & MSG_DUMPPROXY ? " (proxy)" : "");
ReleaseMutex(hConnectionHeaderMutex);
// check filter settings
@@ -466,20 +466,20 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla
}
// Binary data
else {
- int line, col, colsInLine;
-
- for (line = 0;; line += 16) {
- colsInLine = min(16, len - line);
- if (colsInLine == 16) {
- PBYTE p = buf + line;
+ for (int line = 0;; line += 16) {
+ PBYTE p = buf + line;
+ int colsInLine = min(16, len - line);
+ if (colsInLine == 16)
str.AppendFormat("%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ",
line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
- }
else {
str.AppendFormat("%08X: ", line);
+
// Dump data as hex
+ int col;
for (col = 0; col < colsInLine; col++)
- str.AppendFormat("%02X%c", buf[line + col], ((col & 3) == 3 && col != 15) ? '-' : ' ');
+ str.AppendFormat("%02X%c", p[col], ((col & 3) == 3) ? '-' : ' ');
+
// Fill out last line with blanks
for (; col < 16; col++)
str.Append(" ");
@@ -487,8 +487,8 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla
str.AppendChar(' ');
}
- for (col = 0; col < colsInLine; col++)
- str.AppendChar((buf[line + col] < ' ') ? '.' : (char)buf[line + col]);
+ for (int col = 0; col < colsInLine; col++)
+ str.AppendChar((p[col] < ' ') ? '.' : p[col]);
if (len - line <= 16)
break;