diff --git a/speechhlp.cc b/speechhlp.cc index 0795b182..3bfbd25b 100644 --- a/speechhlp.cc +++ b/speechhlp.cc @@ -81,7 +81,7 @@ bool speechAvailable(SpeechHelper sp) void speechEnumerateAvailableEngines(EnumerateCallback callback, void *userData) { HRESULT hr; - IEnumSpObjectTokens * enumSpTokens; + IEnumSpObjectTokens * enumSpTokens = NULL; ULONG count = 0; bool next = true; hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); diff --git a/sphelper.hh b/sphelper.hh index 04b9b314..75029d02 100644 --- a/sphelper.hh +++ b/sphelper.hh @@ -20,7 +20,7 @@ #ifdef _SAPI_VER #undef _SAPI_VER #endif -#define _SAPI_VER 0503 +#define _SAPI_VER 0x053 inline void SpHexFromUlong(WCHAR * psz, ULONG ul) { @@ -110,6 +110,12 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip WCHAR szLangId[10]; HRESULT hr = S_OK; + if (ppszDescription == NULL) + { + return E_POINTER; + } + *ppszDescription = NULL; + #if _SAPI_VER >= 0x053 WCHAR* pRegKeyPath = 0; WCHAR* pszTemp = 0; @@ -120,12 +126,6 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip OSVERSIONINFO ver; ver.dwOSVersionInfoSize = sizeof( ver ); - if (ppszDescription == NULL) - { - return E_POINTER; - } - *ppszDescription = NULL; - if( ( ::GetVersionEx( &ver ) == TRUE ) && ( ver.dwMajorVersion >= 6 ) ) { // If we reach this code we are running under Windows Vista