[Libreoffice-commits] core.git: 2 commits - avmedia/source
Tor Lillqvist
tml at iki.fi
Tue Sep 3 05:38:36 PDT 2013
avmedia/source/vlc/wrapper/SymbolLoader.hxx | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
New commits:
commit e576b47521446002a473575f2051ec36c4237bf2
Author: Tor Lillqvist <tml at iki.fi>
Date: Tue Sep 3 15:17:46 2013 +0300
Blind fix to make this perhaps actually work
Change-Id: If99b8f1bf55fe9acd12b9668bf8e8e4386aa44e7
diff --git a/avmedia/source/vlc/wrapper/SymbolLoader.hxx b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
index cfc8653..8f70dab 100644
--- a/avmedia/source/vlc/wrapper/SymbolLoader.hxx
+++ b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
@@ -45,10 +45,14 @@ namespace
if ( ::RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\VideoLAN\\VLC",
0, KEY_READ, &hKey ) == ERROR_SUCCESS )
{
- if ( ::RegQueryValueExW( hKey, L"InstallDir", NULL, &dwType, (LPBYTE) arCurrent, &dwCurrentSize ) == ERROR_SUCCESS )
+ if ( ::RegQueryValueExW( hKey, L"InstallDir", NULL, &dwType, (LPBYTE) arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ dwType == REG_SZ )
{
::RegCloseKey( hKey );
- return OUString( arCurrent, wcslen(arCurrent) ) + "/";
+ // The value might be 0-terminated or not
+ if (arCurrent[dwCurrentSize/2] == 0)
+ dwCurrentSize -= 2;
+ return OUString( arCurrent, dwCurrentSize ) + "/";
}
::RegCloseKey( hKey );
commit f50f10ed74975da793cbabef1a96078989fe7bd9
Author: Tor Lillqvist <tml at iki.fi>
Date: Tue Sep 3 15:06:47 2013 +0300
Just use the wide char API and no TCHAR crack, puh-lease
Change-Id: I12dc2d9d1c76e43d27b6aaf2ded6444a6aa3d365
diff --git a/avmedia/source/vlc/wrapper/SymbolLoader.hxx b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
index bf75ac5..cfc8653 100644
--- a/avmedia/source/vlc/wrapper/SymbolLoader.hxx
+++ b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
@@ -10,7 +10,6 @@
#ifndef _SYMBOL_LOADER_HXX
#define _SYMBOL_LOADER_HXX
#if defined( WNT )
-# include <tchar.h>
# include <windows.h>
# include <winreg.h>
#endif
@@ -40,16 +39,16 @@ namespace
OUString GetVLCPath()
{
HKEY hKey;
- TCHAR arCurrent[MAX_PATH];
+ wchar_t arCurrent[MAX_PATH];
DWORD dwType, dwCurrentSize = sizeof( arCurrent );
- if ( ::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T( "Software\\VideoLAN\\VLC" ),
+ if ( ::RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\VideoLAN\\VLC",
0, KEY_READ, &hKey ) == ERROR_SUCCESS )
{
- if ( ::RegQueryValueEx( hKey, _T( "InstallDir" ), NULL, &dwType, ( LPBYTE )arCurrent, &dwCurrentSize ) == ERROR_SUCCESS )
+ if ( ::RegQueryValueExW( hKey, L"InstallDir", NULL, &dwType, (LPBYTE) arCurrent, &dwCurrentSize ) == ERROR_SUCCESS )
{
::RegCloseKey( hKey );
- return OUString( arCurrent, strlen(arCurrent), RTL_TEXTENCODING_UTF8 ) + "/";
+ return OUString( arCurrent, wcslen(arCurrent) ) + "/";
}
::RegCloseKey( hKey );
@@ -58,7 +57,6 @@ namespace
}
#endif
-
template<size_t N>
bool tryLink( oslModule &aModule, const ApiMap ( &pMap )[N] )
{
More information about the Libreoffice-commits
mailing list