Commit bc1506a1 authored by Rémi Duraffort's avatar Rémi Duraffort

Do not use strlen just to check that a string is non-empty.

parent 79943f01
...@@ -1004,7 +1004,7 @@ void addAsso( QVLCRegistry *qvReg, const char *psz_ext ) ...@@ -1004,7 +1004,7 @@ void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
/* Save a backup if already assigned */ /* Save a backup if already assigned */
char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" ); char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" );
if( psz_value && strlen( psz_value ) > 0 ) if( !EMPTY_STR(psz_value) )
qvReg->WriteRegistryString( psz_ext, "VLC.backup", psz_value ); qvReg->WriteRegistryString( psz_ext, "VLC.backup", psz_value );
delete psz_value; delete psz_value;
......
...@@ -546,7 +546,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -546,7 +546,7 @@ static int Open( vlc_object_t *p_this )
{ {
i_pid = strtoul( psz, &psz_next, 0 ); i_pid = strtoul( psz, &psz_next, 0 );
if ( strlen(psz_next) > 0 ) if ( psz_next[0] != '\0' )
psz = &psz_next[1]; psz = &psz_next[1];
if ( i_pid == 0 ) if ( i_pid == 0 )
{ {
...@@ -665,7 +665,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -665,7 +665,7 @@ static int Open( vlc_object_t *p_this )
while ( psz != NULL ) while ( psz != NULL )
{ {
i_pid = strtoul( psz, &psz_next, 0 ); i_pid = strtoul( psz, &psz_next, 0 );
if( strlen(psz_next) > 0 ) if( psz_next[0] != '\0' )
psz = &psz_next[1]; psz = &psz_next[1];
else else
psz = NULL; psz = NULL;
......
...@@ -95,7 +95,7 @@ ATMO_BOOL CAtmoMultiConnection::OpenConnection() ...@@ -95,7 +95,7 @@ ATMO_BOOL CAtmoMultiConnection::OpenConnection()
for(int c = 0; c < 4; c++ ) { for(int c = 0; c < 4; c++ ) {
char *devName = m_pAtmoConfig->getSerialDevice( c ); char *devName = m_pAtmoConfig->getSerialDevice( c );
if( devName && strlen(devName) > 0 ) if( !EMPTY_STR( devName ) )
{ {
m_hComports[z] = OpenDevice( devName ); m_hComports[z] = OpenDevice( devName );
if(m_hComports[z] == INVALID_HANDLE_VALUE) { if(m_hComports[z] == INVALID_HANDLE_VALUE) {
...@@ -168,7 +168,7 @@ int CAtmoMultiConnection::getNumChannels() ...@@ -168,7 +168,7 @@ int CAtmoMultiConnection::getNumChannels()
char *psz_dev; char *psz_dev;
for(int i=0;i<4;i++) { for(int i=0;i<4;i++) {
psz_dev = m_pAtmoConfig->getSerialDevice( i ); psz_dev = m_pAtmoConfig->getSerialDevice( i );
if( psz_dev && strlen( psz_dev ) > 0 ) if( !EMPTY_STR( psz_dev ) )
z+=4; z+=4;
} }
#else #else
......
...@@ -1232,7 +1232,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter) ...@@ -1232,7 +1232,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
p_filter, p_filter,
CFG_PREFIX "channels" CFG_PREFIX "channels"
); );
if( psz_channels && strlen(psz_channels) > 0 ) if( !EMPTY_STR(psz_channels) )
{ {
msg_Dbg( p_filter, "deal with new zone mapping %s", psz_channels ); msg_Dbg( p_filter, "deal with new zone mapping %s", psz_channels );
int channel = 0; int channel = 0;
...@@ -1316,7 +1316,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter) ...@@ -1316,7 +1316,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
p_filter, p_filter,
psz_gradient_var_name psz_gradient_var_name
); );
if(psz_gradient_file && strlen(psz_gradient_file)>0) if( !EMPTY_STR(psz_gradient_file) )
{ {
msg_Dbg( p_filter, "loading gradientfile %s for "\ msg_Dbg( p_filter, "loading gradientfile %s for "\
"zone %d", psz_gradient_file, i); "zone %d", psz_gradient_file, i);
...@@ -1348,7 +1348,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter) ...@@ -1348,7 +1348,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
p_filter, p_filter,
CFG_PREFIX "gradient_path" CFG_PREFIX "gradient_path"
); );
if( psz_gradient_path && strlen(psz_gradient_path) > 0 ) if( EMPTY_STR(psz_gradient_path) )
{ {
char *psz_file_name = (char *)malloc( strlen(psz_gradient_path) + 16 ); char *psz_file_name = (char *)malloc( strlen(psz_gradient_path) + 16 );
assert( psz_file_name ); assert( psz_file_name );
...@@ -1397,7 +1397,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config) ...@@ -1397,7 +1397,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config)
CFG_PREFIX "serialdev" ); CFG_PREFIX "serialdev" );
char *psz_temp = psz_serialdev; char *psz_temp = psz_serialdev;
if( psz_temp && strlen(psz_temp) > 0 ) if( !EMPTY_STR(psz_serialdev) )
{ {
char *psz_token; char *psz_token;
int i_port = 0; int i_port = 0;
...@@ -1528,7 +1528,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config) ...@@ -1528,7 +1528,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config)
char *psz_chbase = var_CreateGetStringCommand( p_filter, char *psz_chbase = var_CreateGetStringCommand( p_filter,
CFG_PREFIX "dmx-chbase" ); CFG_PREFIX "dmx-chbase" );
if( psz_chbase && strlen(psz_chbase) > 0 ) if( !EMPTY_STR(psz_chbase) )
p_atmo_config->setDMX_BaseChannels( psz_chbase ); p_atmo_config->setDMX_BaseChannels( psz_chbase );
free( psz_chbase ); free( psz_chbase );
...@@ -1598,7 +1598,7 @@ static void Atmo_SetupParameters(filter_t *p_filter) ...@@ -1598,7 +1598,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
*/ */
char *psz_path = var_CreateGetStringCommand( p_filter, char *psz_path = var_CreateGetStringCommand( p_filter,
CFG_PREFIX "atmowinexe" ); CFG_PREFIX "atmowinexe" );
if( psz_path && strlen(psz_path) > 0 ) if( !EMPTY_STR(psz_path) )
{ {
char *psz_bs = strrchr( psz_path , '\\'); char *psz_bs = strrchr( psz_path , '\\');
if( psz_bs ) if( psz_bs )
......
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