passing argument 1 of 'strlen' makes pointer from integer without a cast
I write code witch generate file name based on: destination directory settings, radio station presets list and current time.
If users store radio station name (app presets) with white space in name:
Europa FM
Paprika Radio
Radio France Internationale
...........................
Rock FM
I want to remove whitespace for recording radio station filename and result look like this:
/home/ubuntu/Desktop/EuropaFM_07042012-111705.ogg
Code:
static int start_recording(const gchar *destination, const char* station, const char* time)
{
Recording* recording;
char *filename;
char* remove_whitespace(station)
{
char* result = malloc(strlen(station)+1);
char* i;
int temp = 0;
for( i = station; *i; ++i)
if(*i != ' ')
{
result[temp] = (*i);
++temp;
}
result[temp] = '\0';
return result;
}
filename = g_strdup_printf(_("%s/%s_%s"),
destination,
remove_whitespace(station),
time);
recording = recording_start(filename);
g_free(filename);
if (!recording)
return -1;
recording->station = g_strdup(station);
tray_icon_items_set_sensible(FALSE);
record_status_window(recording);
run_status_window(recording);
return 1;
}
But this get warnings:
warning: passing argument 1 of 'strlen' makes pointer from integer without a cast [enabled by default] warning: assignment makes pointer from integer without a cast [enabled by default]
I appreciate your help. Thanks.