Skip to content

Instantly share code, notes, and snippets.

@Rainyan
Created August 28, 2022 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rainyan/75c34cda779c6b4066ba930138a2e506 to your computer and use it in GitHub Desktop.
Save Rainyan/75c34cda779c6b4066ba930138a2e506 to your computer and use it in GitHub Desktop.
Diff patch for the Source SDK 2013 dependency Microsoft Speech SDK 5.1 (sapi51) compile errors.
diff --git a/sphelper.h b/sphelper.h
index fbc5668..c684e32 100644
--- a/sphelper.h
+++ b/sphelper.h
@@ -767,7 +767,7 @@ inline HRESULT SpFindBestToken(
HRESULT hr = S_OK;
const WCHAR *pszVendorPreferred = L"VendorPreferred";
- const ulLenVendorPreferred = wcslen(pszVendorPreferred);
+ const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred);
// append VendorPreferred to the end of pszOptAttribs to force this preference
ULONG ulLen = pszOptAttribs ? wcslen(pszOptAttribs) + ulLenVendorPreferred + 1 : ulLenVendorPreferred;
@@ -1416,7 +1416,7 @@ public:
WAVEFORMATEX * m_pCoMemWaveFormatEx;
- static CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)
+ static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)
{
ULONG cb = sizeof(WAVEFORMATEX) + pSrc->cbSize;
*ppCoMemWFEX = (WAVEFORMATEX *)::CoTaskMemAlloc(cb);
@@ -2370,7 +2370,8 @@ public:
{
// Search for the first NULL and return pointer to the char past it.
SPDBG_ASSERT(eEventId == SPEI_PROPERTY_STRING_CHANGE);
- for (const WCHAR * psz = (const WCHAR *)lParam; *psz; psz++) {}
+ const WCHAR * psz = (const WCHAR *)lParam;
+ for (; *psz; psz++) {}
return psz + 1;
}
SPINTERFERENCE Interference() const
@@ -2557,7 +2558,7 @@ inline HRESULT CreatePhraseFromWordArray(const WCHAR ** ppWords, ULONG cWords,
::CoTaskMemFree(pStringPtrArray);
return E_OUTOFMEMORY;
}
- SPPHONEID* pphoneId = dsPhoneId;
+ SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId);
SPPHRASE Phrase;
memset(&Phrase, 0, sizeof(Phrase));
@@ -2631,7 +2632,7 @@ inline HRESULT CreatePhraseFromWordArray(const WCHAR ** ppWords, ULONG cWords,
if (SUCCEEDED(hr))
{
pPhraseElement[i].pszPronunciation = pphoneId;
- pphoneId += wcslen(pphoneId) + 1;
+ pphoneId += wcslen((const wchar_t *)pphoneId) + 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment