Rémi Bernon (@rbernon) commented about dlls/windows.media.speech/vosk.c:
- {
if (dirent->d_type != DT_DIR)
continue;
dir_name = dirent->d_name;
if (!strncmp(dir_name, vosk_model_identifier_small, ident_small_len))
dir_name += ident_small_len;
else if (!strncmp(dir_name, vosk_model_identifier, ident_len))
dir_name += ident_len;
else
continue;
/* First match for lang and region (en-us), then only lang (en). */
if (strncmp(dir_name, locale, 5) && strncmp(dir_name, locale, 2))
continue;
Can you really assume fixed length here? If not sure, what about `strchr( locale, '-' )` somewhere to find the separator?