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