summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-12 19:37:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-12 19:37:35 +0300
commit2ebd5155bdf88bdb3fbc76fbf7e9fdc9765133d6 (patch)
treef4a50c8ff88f45e52d20943142de33478559afc7
parent413bfdfbc3b4bbcdf5ebe47d83c618c3781c6a82 (diff)
fixes for format specifiers
-rw-r--r--plugins/ShellExt/src/shlcom.cpp2
-rw-r--r--plugins/Variables/src/help.cpp2
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp6
-rw-r--r--plugins/Variables/src/parse_miranda.cpp2
-rw-r--r--plugins/WinterSpeak/src/SpeechApi40a.cpp64
-rw-r--r--plugins/YARelay/src/main.cpp2
-rw-r--r--protocols/YAMN/src/protoplugin.cpp2
-rw-r--r--src/mir_app/src/netlibbind.cpp10
-rw-r--r--src/mir_core/src/threads.cpp4
9 files changed, 36 insertions, 58 deletions
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp
index 94dc2adf5c..2bcc909aaf 100644
--- a/plugins/ShellExt/src/shlcom.cpp
+++ b/plugins/ShellExt/src/shlcom.cpp
@@ -205,7 +205,7 @@ void ipcGetSkinIcons(THeaderIPC *ipch)
if (pct != nullptr) {
// capture all the icons!
spi.hProto = murmur_hash(pa->szModuleName);
- for (int j = 0; j <= 10; j++)
+ for (int j = 0; j < _countof(spi.hIcons); j++)
spi.hIcons[j] = Skin_LoadProtoIcon(pa->szModuleName, ID_STATUS_OFFLINE + j);
pct->fType = REQUEST_NEWICONS;
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index d2cf8fb869..4999207416 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -300,7 +300,7 @@ static wchar_t* getTokenDescription(TOKENREGISTEREX *tr)
}
if (tr->flags&TRF_FIELD)
- mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
+ mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString.w, FIELD_CHAR);
else {
if (args != nullptr)
tArgs = mir_a2u(args);
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp
index f9b13bea14..0d06cafffc 100644
--- a/plugins/Variables/src/parse_metacontacts.cpp
+++ b/plugins/Variables/src/parse_metacontacts.cpp
@@ -40,7 +40,7 @@ static wchar_t* parseGetParent(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_snwprintf(tszID, L"%p", hContact);
+ _itow_s(hContact, tszID, 10);
szUniqueID = mir_wstrdup(tszID);
}
@@ -68,7 +68,7 @@ static wchar_t* parseGetDefault(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_snwprintf(tszID, L"%p", hContact);
+ _itow_s(hContact, tszID, 10);
szUniqueID = mir_wstrdup(tszID);
}
@@ -96,7 +96,7 @@ static wchar_t* parseGetMostOnline(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_snwprintf(tszID, L"%p", hContact);
+ _itow_s(hContact, tszID, 10);
szUniqueID = mir_wstrdup(tszID);
}
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 2bd57f5804..e093fce35c 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -387,7 +387,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
return nullptr;
- mir_snwprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
+ _itow_s(ai->fi->hContact, szUniqueID, 20, 10);
}
if (szUniqueID == NULL)
diff --git a/plugins/WinterSpeak/src/SpeechApi40a.cpp b/plugins/WinterSpeak/src/SpeechApi40a.cpp
index d3bf7d2975..2c92ba48a6 100644
--- a/plugins/WinterSpeak/src/SpeechApi40a.cpp
+++ b/plugins/WinterSpeak/src/SpeechApi40a.cpp
@@ -39,12 +39,10 @@ bool SpeechApi40a::isAvailable()
bool ret = true;
// create the enumerator
- if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
- {
+ if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum))) {
ret = false;
}
- else
- {
+ else {
pITTSEnum->Release();
}
return ret;
@@ -53,8 +51,7 @@ bool SpeechApi40a::isAvailable()
//------------------------------------------------------------------------------
bool SpeechApi40a::load()
{
- if (isLoaded())
- {
+ if (isLoaded()) {
return true;
}
return loadWithVoice(std::wstring(m_voice));
@@ -63,14 +60,12 @@ bool SpeechApi40a::load()
//------------------------------------------------------------------------------
bool SpeechApi40a::unload()
{
- if (m_tts_attribs)
- {
+ if (m_tts_attribs) {
m_tts_attribs->Release();
m_tts_attribs = nullptr;
}
- if (m_tts_central)
- {
+ if (m_tts_central) {
m_tts_central->Release();
m_tts_central = nullptr;
}
@@ -92,12 +87,10 @@ bool SpeechApi40a::say(const std::wstring &sentence)
//MessageBoxA(NULL, text.c_str(), "TTS4", MB_OK);
bool ret = true;
- if (!isLoaded())
- {
+ if (!isLoaded()) {
ret = false;
}
- else
- {
+ else {
SDATA data;
data.dwSize = (DWORD)(sentence.size() * sizeof(WCHAR));
data.pData = (WCHAR *)sentence.c_str();
@@ -112,16 +105,14 @@ bool SpeechApi40a::setVolume(int volume)
{
m_volume = volume;
- if (!isLoaded())
- {
+ if (!isLoaded()) {
return true;
}
DWORD new_vol = volume / 100.0 * 0xffff;
new_vol |= new_vol << 16;
- if (FAILED(m_tts_attribs->VolumeSet(new_vol)))
- {
+ if (FAILED(m_tts_attribs->VolumeSet(new_vol))) {
return false;
}
@@ -134,13 +125,12 @@ bool SpeechApi40a::setPitch(int pitch)
m_pitch = pitch;
// valid range is 50 to 350
- if (isLoaded() && FAILED(m_tts_attribs->PitchSet(pitch * 3.0 + 50)))
- {
+ if (isLoaded() && FAILED(m_tts_attribs->PitchSet(pitch * 3.0 + 50))) {
return false;
}
return true;
-}
+}
//------------------------------------------------------------------------------
bool SpeechApi40a::setRate(int rate)
@@ -148,8 +138,7 @@ bool SpeechApi40a::setRate(int rate)
m_rate = rate;
// valid range is 50 to 350
- if (isLoaded() && FAILED(m_tts_attribs->SpeedSet(rate * 3.0 + 50)))
- {
+ if (isLoaded() && FAILED(m_tts_attribs->SpeedSet(rate * 3.0 + 50))) {
return false;
}
@@ -161,8 +150,7 @@ bool SpeechApi40a::setVoice(const std::wstring &voice)
{
m_voice = voice;
- if (!isLoaded())
- {
+ if (!isLoaded()) {
return true;
}
@@ -174,21 +162,17 @@ bool SpeechApi40a::setVoice(const std::wstring &voice)
std::vector<std::wstring> SpeechApi40a::getVoices() const
{
std::vector<std::wstring> ret;
-
+
PITTSENUM pITTSEnum = nullptr;
TTSMODEINFO inf;
CoInitialize(nullptr);
if (FAILED(CoCreateInstance(CLSID_TTSEnumerator, nullptr, CLSCTX_ALL, IID_ITTSEnum, (void**)&pITTSEnum)))
- {
return ret;
- }
- while (!pITTSEnum->Next(1, &inf, nullptr))
- {
+ while (SUCCEEDED(pITTSEnum->Next(1, &inf, nullptr)))
ret.push_back(inf.szModeName);
- }
pITTSEnum->Release();
@@ -200,15 +184,12 @@ bool SpeechApi40a::lexiconDialog(HWND window)
{
// open the dialog
SpeechApi40aLexicon dialog(window, m_tts_central);
-
if (!dialog.display())
- {
return false;
- }
return true;
}
-
+
//------------------------------------------------------------------------------
std::wstring SpeechApi40a::getDescription()
{
@@ -221,7 +202,7 @@ std::wstring SpeechApi40a::getDescription()
bool SpeechApi40a::loadWithVoice(const std::wstring &voice)
{
CoInitialize(nullptr);
-
+
PITTSENUM pITTSEnum;
TTSMODEINFO inf;
LPUNKNOWN pAudioDest;
@@ -231,19 +212,17 @@ bool SpeechApi40a::loadWithVoice(const std::wstring &voice)
return false;
// iterate through the voices until we find the right one
- while (!pITTSEnum->Next(1, &inf, nullptr))
+ while (SUCCEEDED(pITTSEnum->Next(1, &inf, nullptr)))
if (inf.szModeName == voice)
break;
- if (FAILED(CoCreateInstance(CLSID_MMAudioDest, nullptr, CLSCTX_ALL, IID_IAudioMultiMediaDevice, (void**)&pAudioDest)))
- {
+ if (FAILED(CoCreateInstance(CLSID_MMAudioDest, nullptr, CLSCTX_ALL, IID_IAudioMultiMediaDevice, (void**)&pAudioDest))) {
pITTSEnum->Release();
return false;
}
// select that voice
- if (FAILED(pITTSEnum->Select(inf.gModeID, &m_tts_central, pAudioDest)))
- {
+ if (FAILED(pITTSEnum->Select(inf.gModeID, &m_tts_central, pAudioDest))) {
pITTSEnum->Release();
return NULL;
}
@@ -259,6 +238,5 @@ bool SpeechApi40a::loadWithVoice(const std::wstring &voice)
setVolume(m_volume);
setRate(m_rate);
setPitch(m_pitch);
-
return true;
-} \ No newline at end of file
+}
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp
index 8d9a401489..4a29fedc9f 100644
--- a/plugins/YARelay/src/main.cpp
+++ b/plugins/YARelay/src/main.cpp
@@ -150,7 +150,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent)
if (id != NULL)
wcsncpy_s(buf, id, _TRUNCATE);
else
- mir_snwprintf(buf, L"%p", hContact);
+ _itow_s(hContact, buf, 10);
}
szUtfMsg.Append(T2Utf(buf));
break;
diff --git a/protocols/YAMN/src/protoplugin.cpp b/protocols/YAMN/src/protoplugin.cpp
index 4999b69401..a0dd01ca01 100644
--- a/protocols/YAMN/src/protoplugin.cpp
+++ b/protocols/YAMN/src/protoplugin.cpp
@@ -179,7 +179,7 @@ INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM)
if (FileName == nullptr)
return NULL;
- mir_snwprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, wParam, ProfileName);
+ mir_snwprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, (wchar_t*)wParam, ProfileName);
return (INT_PTR)FileName;
}
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp
index 1d06b70e9f..a6152adf09 100644
--- a/src/mir_app/src/netlibbind.cpp
+++ b/src/mir_app/src/netlibbind.cpp
@@ -141,7 +141,7 @@ static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp)
if (nlbp->s6 != INVALID_SOCKET)
FD_SET(nlbp->s6, &r);
if (select(0, &r, nullptr, nullptr, nullptr) == SOCKET_ERROR) {
- Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): select failed (%d)", nlbp->s, GetLastError());
+ Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): select failed (%d)", (void*)nlbp->s, GetLastError());
break;
}
@@ -153,20 +153,20 @@ static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp)
if (FD_ISSET(nlbp->s, &r)) {
s = accept(nlbp->s, (sockaddr*)&sin, &sinLen);
if (s == INVALID_SOCKET) {
- Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): accept V4 failed (%d)", nlbp->s, GetLastError());
+ Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): accept V4 failed (%d)", (void*)nlbp->s, GetLastError());
break;
}
}
else if (FD_ISSET(nlbp->s6, &r)) {
s = accept(nlbp->s6, (sockaddr*)&sin, &sinLen);
if (s == INVALID_SOCKET) {
- Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): accept V6 failed (%d)", nlbp->s, GetLastError());
+ Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): accept V6 failed (%d)", (void*)nlbp->s, GetLastError());
break;
}
}
else s = 0;
- Netlib_Logf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, ptrA(Netlib_AddressToString(&sin)), s);
+ Netlib_Logf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, ptrA(Netlib_AddressToString(&sin)), (void*)s);
NetlibConnection *nlc = new NetlibConnection();
nlc->nlu = nlbp->nlu;
@@ -179,7 +179,7 @@ static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp)
NetlibUPnPDeletePortMapping(nlbp->wExPort, "TCP");
nlbp->hThread = nullptr;
- Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread: (%p) thread for port %u closed", nlbp->s, nlbp->wPort);
+ Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread: (%p) thread for port %u closed", (void*)nlbp->s, nlbp->wPort);
}
MIR_APP_DLL(HNETLIBBIND) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb)
diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp
index ce108e4ac9..713c0eaaa7 100644
--- a/src/mir_core/src/threads.cpp
+++ b/src/mir_core/src/threads.cpp
@@ -235,7 +235,7 @@ static void __cdecl KillObjectThreadsWorker(void* owner)
if (it->pObject == owner) {
char szModuleName[MAX_PATH];
GetModuleFileNameA(it->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf(nullptr, "Killing object thread %s:%p", szModuleName, it->dwThreadId);
+ Netlib_Logf(nullptr, "Killing object thread %s:%08x", szModuleName, it->dwThreadId);
TerminateThread(it->hThread, 9999);
CloseHandle(it->hThread);
mir_free(it);
@@ -272,7 +272,7 @@ static void CALLBACK KillAllThreads(HWND, UINT, UINT_PTR, DWORD)
for (auto &p : threads) {
char szModuleName[MAX_PATH];
GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf(nullptr, "Killing thread %s:%p (%p)", szModuleName, p->dwThreadId, p->pEntryPoint);
+ Netlib_Logf(nullptr, "Killing thread %s:%08x (%p)", szModuleName, p->dwThreadId, p->pEntryPoint);
TerminateThread(p->hThread, 9999);
CloseHandle(p->hThread);
mir_free(p);