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

Qt: kill warnings and probably a crash on Win32

parent 146af0bd
......@@ -912,7 +912,7 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
const char* psz_VLC = "VLC";
current = new QTreeWidgetItem( parent, QStringList( psz_ext ) );
if( strstr( qvReg->ReadRegistryString( psz_ext, "", "" ), psz_VLC ) )
if( strstr( qvReg->ReadRegistryString( psz_ext, "", "" ), psz_VLC ) )
{
current->setCheckState( 0, Qt::Checked );
b_temp = false;
......@@ -966,7 +966,7 @@ void SPrefsPanel::assoDialog()
videoType->setExpanded( true ); videoType->setCheckState( 0, Qt::Unchecked );
otherType->setExpanded( true ); otherType->setCheckState( 0, Qt::Unchecked );
QTreeWidgetItem *currentItem;
QTreeWidgetItem *currentItem = NULL;
int i_temp = 0;
#define aTa( name ) i_temp += addType( name, currentItem, audioType, qvReg )
......@@ -1066,7 +1066,7 @@ void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
{
char psz_VLC[] = "VLC";
char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" );
char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" );
if( psz_value && !strcmp( strcat( psz_VLC, psz_ext ), psz_value ) )
{
......@@ -1081,7 +1081,7 @@ void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
}
void SPrefsPanel::saveAsso()
{
QVLCRegistry * qvReg;
QVLCRegistry * qvReg = NULL;
for( int i = 0; i < listAsso.size(); i ++ )
{
qvReg = new QVLCRegistry( HKEY_CLASSES_ROOT );
......
......@@ -128,10 +128,12 @@ int QVLCRegistry::ReadRegistryInt( const char *path, const char *valueName, int
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;
char *tempValue = NULL;
char *tempValue2 = NULL;
DWORD size1;
DWORD valueType;
......@@ -145,20 +147,14 @@ char * QVLCRegistry::ReadRegistryString( const char *path, const char *valueName
tempValue = ( char * )malloc( size1+1 ); // +1 für NullByte`?
if( RegQueryValueEx( keyHandle, valueName, NULL, &valueType, (LPBYTE)tempValue, &size1 ) == ERROR_SUCCESS )
{
default_value = tempValue;
tempValue2 = tempValue;
};
}
}
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 )
......
......@@ -39,7 +39,7 @@ public:
void WriteRegistryDouble( const char *path, const char *valueName, double 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);
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