mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
Fix warning in code
This commit is contained in:
parent
b562212fc6
commit
85349d2446
@ -137,7 +137,7 @@ esp_err_t esp_mn_commands_remove(char *phoneme_string)
|
||||
|
||||
esp_mn_phrase_t *esp_mn_commands_get_from_index(int index)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, ESP_ERR_INVALID_STATE, TAG, "The mn commands is not initialized");
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, NULL, TAG, "The mn commands is not initialized");
|
||||
|
||||
// phrase index also is phrase id, which is the depth from this phrase node to root node
|
||||
esp_mn_node_t *temp = esp_mn_root;
|
||||
@ -151,7 +151,7 @@ esp_mn_phrase_t *esp_mn_commands_get_from_index(int index)
|
||||
|
||||
esp_mn_phrase_t *esp_mn_commands_get_from_string(const char *phoneme_string)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, ESP_ERR_INVALID_STATE, TAG, "The mn commands is not initialized");
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, NULL, TAG, "The mn commands is not initialized");
|
||||
|
||||
// phrase index also is phrase id, which is the depth from this phrase node to root node
|
||||
esp_mn_node_t *temp = esp_mn_root;
|
||||
@ -165,9 +165,9 @@ esp_mn_phrase_t *esp_mn_commands_get_from_string(const char *phoneme_string)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
esp_mn_error_t *esp_mn_commands_update(const esp_mn_iface_t *multinet, const model_iface_data_t *model_data)
|
||||
esp_mn_error_t *esp_mn_commands_update(const esp_mn_iface_t *multinet, model_iface_data_t *model_data)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, ESP_ERR_INVALID_STATE, TAG, "The mn commands is not initialize");
|
||||
ESP_RETURN_ON_FALSE(NULL != esp_mn_root, NULL, TAG, "The mn commands is not initialize");
|
||||
esp_mn_error_t *error = multinet->set_speech_commands(model_data, esp_mn_root);
|
||||
|
||||
if (error->num == 0)
|
||||
@ -208,7 +208,7 @@ esp_mn_phrase_t *esp_mn_phrase_alloc(int command_id, char *phoneme_string)
|
||||
}
|
||||
|
||||
esp_mn_phrase_t *phrase = _esp_mn_calloc_(1, sizeof(esp_mn_phrase_t));
|
||||
ESP_RETURN_ON_FALSE(NULL != phrase, ESP_ERR_NO_MEM, TAG, "Fail to alloc mn phrase");
|
||||
ESP_RETURN_ON_FALSE(NULL != phrase, NULL, TAG, "Fail to alloc mn phrase");
|
||||
phrase->command_id = command_id;
|
||||
phrase->threshold = 0;
|
||||
phrase->wave = NULL;
|
||||
@ -227,7 +227,7 @@ void esp_mn_phrase_free(esp_mn_phrase_t *phrase)
|
||||
esp_mn_node_t *esp_mn_node_alloc(esp_mn_phrase_t *phrase)
|
||||
{
|
||||
esp_mn_node_t *node = _esp_mn_calloc_(1, sizeof(esp_mn_node_t));
|
||||
ESP_RETURN_ON_FALSE(NULL != node, ESP_ERR_NO_MEM, TAG, "Fail to alloc mn node");
|
||||
ESP_RETURN_ON_FALSE(NULL != node, NULL, TAG, "Fail to alloc mn node");
|
||||
node->next = NULL;
|
||||
node->phrase = phrase;
|
||||
return node;
|
||||
|
||||
@ -876,7 +876,7 @@ char *get_id_name_en(int i)
|
||||
#endif
|
||||
}
|
||||
|
||||
esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(esp_mn_iface_t *multinet, const model_iface_data_t *model_data)
|
||||
esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(const esp_mn_iface_t *multinet, model_iface_data_t *model_data)
|
||||
{
|
||||
esp_mn_commands_alloc();
|
||||
int total_phrase_num = 0;
|
||||
|
||||
@ -117,7 +117,7 @@ esp_mn_phrase_t *esp_mn_commands_get_from_string(const char *phoneme_string);
|
||||
* - NULL Success
|
||||
* - others The list of error phrase which can not be parsed by multinet.
|
||||
*/
|
||||
esp_mn_error_t *esp_mn_commands_update(const esp_mn_iface_t *multinet, const model_iface_data_t *model_data);
|
||||
esp_mn_error_t *esp_mn_commands_update(const esp_mn_iface_t *multinet, model_iface_data_t *model_data);
|
||||
|
||||
/**
|
||||
* @brief Print the MultiNet Speech Commands.
|
||||
|
||||
@ -20,4 +20,4 @@ void check_chip_config(void);
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_STATE Fail
|
||||
*/
|
||||
esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(esp_mn_iface_t *multinet, const model_iface_data_t *model_data);
|
||||
esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(const esp_mn_iface_t *multinet, model_iface_data_t *model_data);
|
||||
|
||||
@ -48,7 +48,7 @@ srmodel_list_t *read_models_form_spiffs(esp_vfs_spiffs_conf_t *conf)
|
||||
} else {
|
||||
models = malloc(sizeof(srmodel_list_t*));
|
||||
models->num = model_num;
|
||||
models->partition_label = conf->partition_label;
|
||||
models->partition_label = (char *)conf->partition_label;
|
||||
models->model_name = malloc(models->num*sizeof(char*));
|
||||
for (int i=0; i<models->num; i++)
|
||||
models->model_name[i] = (char*) calloc(MODEL_NAME_MAX_LENGTH, sizeof(char));
|
||||
@ -186,7 +186,7 @@ void srmodel_config_deinit(srmodel_list_t *models)
|
||||
|
||||
model_coeff_getter_t* srmodel_get_model_coeff(char *model_name)
|
||||
{
|
||||
model_coeff_getter_t *gettercb = &WAKENET_COEFF;
|
||||
model_coeff_getter_t *gettercb = (model_coeff_getter_t *)&WAKENET_COEFF;
|
||||
return gettercb;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ int set_model_base_path(const char *base_path)
|
||||
{
|
||||
if (base_path == NULL) return 0;
|
||||
|
||||
SRMODE_BASE_PATH = base_path;
|
||||
SRMODE_BASE_PATH = (char *)base_path;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ void esp_srmodel_deinit(srmodel_list_t *models)
|
||||
// repackage strstr function to support needle==NULL
|
||||
char *_esp_strstr_(const char *haystack, const char *needle)
|
||||
{
|
||||
if (needle == NULL) return haystack;
|
||||
if (needle == NULL) return (char *)haystack;
|
||||
else return (char *)strstr(haystack, needle);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user