From 4b6c6c59b583ee8cba65226a96bacdb8b3a8d65a Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 13 Feb 2012 12:14:26 -0800 Subject: [PATCH] Squash warnings in mimedb, hopefully get it compiling on Linux --- mimedb.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mimedb.cpp b/mimedb.cpp index cc02d3a0a..4b9b5b2a5 100644 --- a/mimedb.cpp +++ b/mimedb.cpp @@ -678,7 +678,7 @@ static char *get_action( const char *mimetype ) { char *res=0; - char *launcher; + const char *launcher; char *end; string_list_t mime_filenames; @@ -740,13 +740,16 @@ static char *get_action( const char *mimetype ) /* Skip the = */ launcher++; - + + /* Make one we can change */ + std::string mut_launcher = launcher; + /* Only use first launcher */ end = strchr( launcher, ';' ); if( end ) - *end = '\0'; + mut_launcher.resize(end - launcher); - launcher_full = (char *)my_malloc( strlen( launcher) + strlen( APPLICATIONS_DIR)+1 ); + launcher_full = (char *)my_malloc( mut_launcher.size() + strlen( APPLICATIONS_DIR)+1 ); if( !launcher_full ) { free( (void *)launcher_str ); @@ -754,7 +757,7 @@ static char *get_action( const char *mimetype ) } strcpy( launcher_full, APPLICATIONS_DIR ); - strcat( launcher_full, launcher ); + strcat( launcher_full, mut_launcher.c_str() ); free( (void *)launcher_str ); std::string launcher_filename = get_filename( launcher_full ); @@ -1034,7 +1037,7 @@ static void launch( char *filter, const string_list_t &files, int fileno ) int count=0; int launch_again=0; - if( files.size() <= fileno ) + if( (int)files.size() <= fileno ) return; @@ -1078,8 +1081,7 @@ static void launch( char *filter, const string_list_t &files, int fileno ) case 'F': case 'N': { - int i; - for( i=0; i