diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-12 19:37:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-12 19:37:35 +0300 |
commit | 2ebd5155bdf88bdb3fbc76fbf7e9fdc9765133d6 (patch) | |
tree | f4a50c8ff88f45e52d20943142de33478559afc7 /plugins | |
parent | 413bfdfbc3b4bbcdf5ebe47d83c618c3781c6a82 (diff) |
fixes for format specifiers
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ShellExt/src/shlcom.cpp | 2 | ||||
-rw-r--r-- | plugins/Variables/src/help.cpp | 2 | ||||
-rw-r--r-- | plugins/Variables/src/parse_metacontacts.cpp | 6 | ||||
-rw-r--r-- | plugins/Variables/src/parse_miranda.cpp | 2 | ||||
-rw-r--r-- | plugins/WinterSpeak/src/SpeechApi40a.cpp | 64 | ||||
-rw-r--r-- | plugins/YARelay/src/main.cpp | 2 |
6 files changed, 28 insertions, 50 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;
|