Fix nits
This commit is contained in:
parent
03196c875d
commit
a97e961d16
@ -475,73 +475,45 @@ DS_FreeString(char* str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
DS_Version() {
|
DS_Version()
|
||||||
|
{
|
||||||
return strdup(ds_version());
|
return strdup(ds_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
DS_ErrorCodeToErrorMessage(int aErrorCode){
|
DS_ErrorCodeToErrorMessage(int aErrorCode)
|
||||||
|
{
|
||||||
switch(aErrorCode)
|
switch(aErrorCode)
|
||||||
{
|
{
|
||||||
case DS_ERR_OK:
|
case DS_ERR_OK:
|
||||||
char message[] = "No Error.";
|
return strdup("No error.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_NO_MODEL:
|
case DS_ERR_NO_MODEL:
|
||||||
char message[] = "Missing model information.";
|
return strdup("Missing model information.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_INVALID_ALPHABET:
|
case DS_ERR_INVALID_ALPHABET:
|
||||||
char message[] = "Invalid alphabet embedded in model. (Data corruption?)";
|
return strdup("Invalid alphabet embedded in model. (Data corruption?)");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_INVALID_SHAPE:
|
case DS_ERR_INVALID_SHAPE:
|
||||||
char message[] = "Invalid model shape.";
|
return strdup("Invalid model shape.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_INVALID_SCORER:
|
case DS_ERR_INVALID_SCORER:
|
||||||
char message[] = "Invalid scorer file.";
|
return strdup("Invalid scorer file.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_INIT_MMAP:
|
case DS_ERR_FAIL_INIT_MMAP:
|
||||||
char message[] = "Failed to initialize memory mapped model.";
|
return strdup("Failed to initialize memory mapped model.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_INIT_SESS:
|
case DS_ERR_FAIL_INIT_SESS:
|
||||||
char message[] = "Failed to initialize the session.";
|
return strdup("Failed to initialize the session.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_INTERPRETER:
|
case DS_ERR_FAIL_INTERPRETER:
|
||||||
char message[] = "Interpreter failed.";
|
return strdup("Interpreter failed.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_RUN_SESS:
|
case DS_ERR_FAIL_RUN_SESS:
|
||||||
char message[] = "Failed to run the session.";
|
return strdup("Failed to run the session.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_CREATE_STREAM:
|
case DS_ERR_FAIL_CREATE_STREAM:
|
||||||
char message[] = "Error creating the stream.";
|
return strdup("Error creating the stream.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_READ_PROTOBUF:
|
case DS_ERR_FAIL_READ_PROTOBUF:
|
||||||
char message[] = "Error reading the proto buffer model file.";
|
return strdup("Error reading the proto buffer model file.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_FAIL_CREATE_SESS:
|
case DS_ERR_FAIL_CREATE_SESS:
|
||||||
char message[] = "Failed to create session.";
|
return strdup("Failed to create session.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_MODEL_INCOMPATIBLE:
|
case DS_ERR_MODEL_INCOMPATIBLE:
|
||||||
char message[] = "Incompatible model.";
|
return strdup("Incompatible model.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
case DS_ERR_SCORER_NOT_ENABLED:
|
case DS_ERR_SCORER_NOT_ENABLED:
|
||||||
char message[] = "External scorer is not enabled.";
|
return strdup("External scorer is not enabled.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
default:
|
default:
|
||||||
char message[] = "Unknown error, please make sure you are using the correct native binary.";
|
return strdup("Unknown error, please make sure you are using the correct native binary.");
|
||||||
char* error = strdup(message);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,8 +288,8 @@ DEEPSPEECH_EXPORT
|
|||||||
void DS_FreeString(char* str);
|
void DS_FreeString(char* str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return version of this library. The returned version is a semantic version
|
* @brief Returns the version of this library. The returned version is a semantic
|
||||||
* (SemVer 2.0.0). The string returned must be freed with {@link DS_FreeString()}.
|
* version (SemVer 2.0.0). The string returned must be freed with {@link DS_FreeString()}.
|
||||||
*
|
*
|
||||||
* @return The version string.
|
* @return The version string.
|
||||||
*/
|
*/
|
||||||
@ -297,11 +297,10 @@ DEEPSPEECH_EXPORT
|
|||||||
char* DS_Version();
|
char* DS_Version();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This method shows the textual descriptions of error codes so applications can show
|
* @brief Returns a textual description corresponding to an error code.
|
||||||
* something meaningful to users in error messages.
|
* The string returned must be freed with @{link DS_FreeString()}.
|
||||||
* Use DS_FreeString() on the returned pointer.
|
|
||||||
*
|
*
|
||||||
* @return The error string.
|
* @return The error description.
|
||||||
*/
|
*/
|
||||||
DEEPSPEECH_EXPORT
|
DEEPSPEECH_EXPORT
|
||||||
char* DS_ErrorCodeToErrorMessage(int aErrorCode);
|
char* DS_ErrorCodeToErrorMessage(int aErrorCode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user