Commit 19acda05 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: kill warnings and probably a crash on Win32

parent 146af0bd
...@@ -966,7 +966,7 @@ void SPrefsPanel::assoDialog() ...@@ -966,7 +966,7 @@ void SPrefsPanel::assoDialog()
videoType->setExpanded( true ); videoType->setCheckState( 0, Qt::Unchecked ); videoType->setExpanded( true ); videoType->setCheckState( 0, Qt::Unchecked );
otherType->setExpanded( true ); otherType->setCheckState( 0, Qt::Unchecked ); otherType->setExpanded( true ); otherType->setCheckState( 0, Qt::Unchecked );
QTreeWidgetItem *currentItem; QTreeWidgetItem *currentItem = NULL;
int i_temp = 0; int i_temp = 0;
#define aTa( name ) i_temp += addType( name, currentItem, audioType, qvReg ) #define aTa( name ) i_temp += addType( name, currentItem, audioType, qvReg )
...@@ -1081,7 +1081,7 @@ void delAsso( QVLCRegistry *qvReg, const char *psz_ext ) ...@@ -1081,7 +1081,7 @@ void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
} }
void SPrefsPanel::saveAsso() void SPrefsPanel::saveAsso()
{ {
QVLCRegistry * qvReg; QVLCRegistry * qvReg = NULL;
for( int i = 0; i < listAsso.size(); i ++ ) for( int i = 0; i < listAsso.size(); i ++ )
{ {
qvReg = new QVLCRegistry( HKEY_CLASSES_ROOT ); qvReg = new QVLCRegistry( HKEY_CLASSES_ROOT );
......
...@@ -128,10 +128,12 @@ int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int ...@@ -128,10 +128,12 @@ int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int
return default_value; return default_value;
} }
char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName, char *default_value ) char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName, const char *default_value )
{ {
HKEY keyHandle; HKEY keyHandle;
char *tempValue = NULL; char *tempValue = NULL;
char *tempValue2 = NULL;
DWORD size1; DWORD size1;
DWORD valueType; DWORD valueType;
...@@ -145,20 +147,14 @@ char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName ...@@ -145,20 +147,14 @@ char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName
tempValue = ( char * )malloc( size1+1 ); // +1 für NullByte`? tempValue = ( char * )malloc( size1+1 ); // +1 für NullByte`?
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, (LPBYTE)tempValue, &size1 ) == ERROR_SUCCESS ) if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, (LPBYTE)tempValue, &size1 ) == ERROR_SUCCESS )
{ {
default_value = tempValue; tempValue2 = tempValue;
}; };
} }
} }
RegCloseKey( keyHandle ); RegCloseKey( keyHandle );
} }
if( tempValue == NULL )
{
// wenn tempValue nicht aus registry gelesen wurde dafür sorgen das ein neuer String mit der Kopie von DefaultValue
// geliefert wird - das macht das Handling des Rückgabewertes der Funktion einfacher - immer schön mit free freigeben!
default_value = strdup( default_value );
}
return default_value; return tempValue == NULL ? strdup( default_value ) : tempValue2;
} }
double QVLCRegistry::ReadRegistryDouble( const char *path, const char *valueName, double default_value ) double QVLCRegistry::ReadRegistryDouble( const char *path, const char *valueName, double default_value )
......
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
void WriteRegistryDouble( const char *path, const char *valueName, double value); void WriteRegistryDouble( const char *path, const char *valueName, double value);
int ReadRegistryInt( const char *path, const char *valueName, int default_value); int ReadRegistryInt( const char *path, const char *valueName, int default_value);
char * ReadRegistryString( const char *path, const char *valueName, char *default_value); char * ReadRegistryString( const char *path, const char *valueName, const char *default_value);
double ReadRegistryDouble( const char *path, const char *valueName, double default_value); double ReadRegistryDouble( const char *path, const char *valueName, double default_value);
bool RegistryKeyExists( const char *path); bool RegistryKeyExists( const char *path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment