Skip to content

Commit

Permalink
when processing command line options: -o setting=value, the value is …
Browse files Browse the repository at this point in the history
…converted to UTF8
  • Loading branch information
pedrolcl authored and derselbst committed May 19, 2024
1 parent 32613c7 commit 2abb296
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/fluidsynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void print_help(fluid_settings_t *settings);
void print_welcome(void);
void print_configure(void);
void fluid_wasapi_device_enumerate(void);
#ifdef _WIN32
static char* win32_ansi_to_utf8(const char* ansi_null_terminated_string);
#endif

/*
* the globals
Expand Down Expand Up @@ -122,16 +125,25 @@ int process_o_cmd_line_option(fluid_settings_t *settings, char *optarg)
}

break;

case FLUID_STR_TYPE:
if(fluid_settings_setstr(settings, optarg, val) != FLUID_OK)

case FLUID_STR_TYPE: {
char *u8_val = val;
#if defined(_WIN32)
u8_val = win32_ansi_to_utf8(val);
#endif
if(fluid_settings_setstr(settings, optarg, u8_val) != FLUID_OK)
{
fprintf(stderr, "Failed to set string parameter '%s'\n", optarg);
#if defined(_WIN32)
free(u8_val);
#endif
return FLUID_FAILED;
}

#if defined(_WIN32)
free(u8_val);
#endif
break;

}
default:
fprintf(stderr, "Setting parameter '%s' not found\n", optarg);
return FLUID_FAILED;
Expand Down

0 comments on commit 2abb296

Please sign in to comment.