diff options
author | skswales <stuart.swales.croftnuisk@gmail.com> | 2016-05-10 17:58:20 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-05-24 20:27:22 +0000 |
commit | 163dcad72e03e214d842e74d1f71ed025cbdd870 (patch) | |
tree | e6aec5f21e5b2c37130321f99306b31fb2427855 /setup_native/source | |
parent | c5ab14e2bca0cc4fabd25b27f078a1c38fda4fa7 (diff) |
Work towards tdf#72606
EasyHack _tstring/TCHAR elimination
These were already compiled UNICODE - changes for clarity and consistency
Change-Id: I846063ddf37af80b3a8787b45d97215e1770c0f3
Reviewed-on: https://gerrit.libreoffice.org/24859
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'setup_native/source')
-rw-r--r-- | setup_native/source/win32/customactions/tools/checkversion.cxx | 31 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/tools/seterror.cxx | 23 |
2 files changed, 28 insertions, 26 deletions
diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx index 49ae4550f3a5..2b7cc130ff48 100644 --- a/setup_native/source/win32/customactions/tools/checkversion.cxx +++ b/setup_native/source/win32/customactions/tools/checkversion.cxx @@ -18,6 +18,7 @@ */ #define UNICODE +#define _UNICODE #ifdef _MSC_VER #pragma warning(push,1) // disable warnings within system headers @@ -31,21 +32,21 @@ #include <string.h> #include <malloc.h> #include <stdio.h> -#include "strsafe.h" +#include <strsafe.h> -#include <seterror.hxx> +#include "seterror.hxx" -BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) +BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) { DWORD sz = 0; - if ( MsiGetProperty( hMSI, pPropName, const_cast<wchar_t *>(L""), &sz ) == ERROR_MORE_DATA ) + if ( MsiGetPropertyW( hMSI, pPropName, const_cast<wchar_t *>(L""), &sz ) == ERROR_MORE_DATA ) { sz++; DWORD nbytes = sz * sizeof( wchar_t ); wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) ); ZeroMemory( buff, nbytes ); - MsiGetProperty( hMSI, pPropName, buff, &sz ); + MsiGetPropertyW( hMSI, pPropName, buff, &sz ); *ppValue = buff; return TRUE; @@ -56,18 +57,18 @@ BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) #ifdef DEBUG -inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +inline void OutputDebugStringFormatW( PCWSTR pFormat, ... ) { - TCHAR buffer[1024]; + WCHAR buffer[1024]; va_list args; va_start( args, pFormat ); - StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); - OutputDebugString( buffer ); + StringCchVPrintfW( buffer, sizeof(buffer)/sizeof(buffer[0]), pFormat, args ); + OutputDebugStringW( buffer ); va_end(args); } #else -static inline void OutputDebugStringFormat( LPCTSTR, ... ) +static inline void OutputDebugStringFormatW( PCWSTR, ... ) { } #endif @@ -75,21 +76,21 @@ static inline void OutputDebugStringFormat( LPCTSTR, ... ) extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI ) { - // MessageBox(NULL, L"CheckVersions", L"Information", MB_OK | MB_ICONINFORMATION); + // MessageBoxW(NULL, L"CheckVersions", L"Information", MB_OK | MB_ICONINFORMATION); wchar_t* pVal = NULL; - if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) && pVal ) + if ( GetMsiPropW( hMSI, L"NEWPRODUCTS", &pVal ) && pVal ) { - OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTS found [%s]"), pVal ); + OutputDebugStringFormatW( L"DEBUG: NEWPRODUCTS found [%s]", pVal ); if ( *pVal != 0 ) SetMsiErrorCode( MSI_ERROR_NEW_VERSION_FOUND ); free( pVal ); } pVal = NULL; - if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) && pVal ) + if ( GetMsiPropW( hMSI, L"OLDPRODUCTS", &pVal ) && pVal ) { - OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTS found [%s]"), pVal ); + OutputDebugStringFormatW( L"DEBUG: OLDPRODUCTS found [%s]", pVal ); if ( *pVal != 0 ) SetMsiErrorCode( MSI_ERROR_OLD_VERSION_FOUND ); free( pVal ); diff --git a/setup_native/source/win32/customactions/tools/seterror.cxx b/setup_native/source/win32/customactions/tools/seterror.cxx index a9af467b2068..aeb2ff5bc775 100644 --- a/setup_native/source/win32/customactions/tools/seterror.cxx +++ b/setup_native/source/win32/customactions/tools/seterror.cxx @@ -18,6 +18,7 @@ */ #define UNICODE +#define _UNICODE #ifdef _MSC_VER #pragma warning(push,1) // disable warnings within system headers @@ -30,24 +31,24 @@ #include <string.h> #include <malloc.h> #include <stdio.h> -#include "strsafe.h" +#include <strsafe.h> -#include <seterror.hxx> +#include "seterror.hxx" #ifdef DEBUG -inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +inline void OutputDebugStringFormatW( PCWSTR pFormat, ... ) { - TCHAR buffer[1024]; + WCHAR buffer[1024]; va_list args; va_start( args, pFormat ); - StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); - OutputDebugString( buffer ); + StringCchVPrintfW( buffer, sizeof(buffer)/sizeof(buffer[0]), pFormat, args ); + OutputDebugStringW( buffer ); va_end(args); } #else -static inline void OutputDebugStringFormat( LPCTSTR, ... ) +static inline void OutputDebugStringFormatW( PCWSTR, ... ) { } #endif @@ -55,19 +56,19 @@ static inline void OutputDebugStringFormat( LPCTSTR, ... ) void SetMsiErrorCode( int nErrorCode ) { - const TCHAR sMemMapName[] = TEXT( "Global\\MsiErrorObject" ); + const WCHAR sMemMapName[] = L"Global\\MsiErrorObject"; HANDLE hMapFile; int *pBuf; - hMapFile = OpenFileMapping( + hMapFile = OpenFileMappingW( FILE_MAP_ALL_ACCESS, // read/write access FALSE, // do not inherit the name sMemMapName ); // name of mapping object if ( hMapFile == NULL ) // can not set error code { - OutputDebugStringFormat( TEXT("Could not open map file (%d).\n"), GetLastError() ); + OutputDebugStringFormatW( L"Could not open map file (%d).\n", GetLastError() ); return; } @@ -82,7 +83,7 @@ void SetMsiErrorCode( int nErrorCode ) UnmapViewOfFile( pBuf ); } else - OutputDebugStringFormat( TEXT("Could not map view of file (%d).\n"), GetLastError() ); + OutputDebugStringFormatW( L"Could not map view of file (%d).\n", GetLastError() ); CloseHandle( hMapFile ); } |