mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-18 02:48:42 +00:00
Use the ENOMEM errno code instead of ENE_OUT_OF_MEMORY.
This commit is contained in:
@@ -31,15 +31,14 @@ extern "C"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* Success Codes (>= 0) */
|
||||
|
||||
ENS_OK = 0,
|
||||
|
||||
/* 0 to 255 : errno */
|
||||
|
||||
/* Error Codes (< 0) */
|
||||
|
||||
ENE_READ_ERROR = -1,
|
||||
ENE_WRITE_ERROR = -2,
|
||||
ENE_OUT_OF_MEMORY = -3,
|
||||
ENE_COMPILE_ERRORS = -4,
|
||||
ENE_VERSION_MISMATCH = -5,
|
||||
} espeak_ng_STATUS;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -2862,7 +2863,7 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
fprintf(f_errors, "Failed to allocate data for tunes\n");
|
||||
fclose(f_in);
|
||||
fclose(f_errors);
|
||||
return ENE_OUT_OF_MEMORY;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/intonations", path_home);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "errno.h"
|
||||
#include "stdio.h"
|
||||
#include "ctype.h"
|
||||
#include "string.h"
|
||||
@@ -224,13 +225,13 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE
|
||||
outbuf_size = (buffer_length * samplerate)/500;
|
||||
outbuf = (unsigned char *)realloc(outbuf, outbuf_size);
|
||||
if ((out_start = outbuf) == NULL)
|
||||
return ENE_OUT_OF_MEMORY;
|
||||
return ENOMEM;
|
||||
|
||||
// allocate space for event list. Allow 200 events per second.
|
||||
// Add a constant to allow for very small buf_length
|
||||
n_event_list = (buffer_length*200)/1000 + 20;
|
||||
if ((event_list = (espeak_EVENT *)realloc(event_list, sizeof(espeak_EVENT) * n_event_list)) == NULL)
|
||||
return ENE_OUT_OF_MEMORY;
|
||||
return ENOMEM;
|
||||
|
||||
return ENS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user