vlc | branch: master | Rémi Duraffort <[email protected]> | Sat Oct 23 17:06:33 2010 +0200| [bc1506a1863c601fd47a1dd5beb116c3d6cf1c4a] | committer: Rémi Duraffort
Do not use strlen just to check that a string is non-empty. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc1506a1863c601fd47a1dd5beb116c3d6cf1c4a --- modules/gui/qt4/components/simple_preferences.cpp | 2 +- modules/mux/mpeg/ts.c | 4 ++-- modules/video_filter/atmo/AtmoMultiConnection.cpp | 4 ++-- modules/video_filter/atmo/atmo.cpp | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 658d0a7..d98f1a7 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -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; diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 2a1d8c3..7ba22ad 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -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; diff --git a/modules/video_filter/atmo/AtmoMultiConnection.cpp b/modules/video_filter/atmo/AtmoMultiConnection.cpp index 71f70f9..e648491 100644 --- a/modules/video_filter/atmo/AtmoMultiConnection.cpp +++ b/modules/video_filter/atmo/AtmoMultiConnection.cpp @@ -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 diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp index 25031ce..f67b160 100644 --- a/modules/video_filter/atmo/atmo.cpp +++ b/modules/video_filter/atmo/atmo.cpp @@ -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 ) _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
