Browse Source

Use the ENOMEM errno code instead of ENE_OUT_OF_MEMORY.

master
Reece H. Dunn 9 years ago
parent
commit
74db6dac63

+ 2
- 3
src/include/espeak-ng/espeak_ng.h View File

#endif #endif


typedef enum { typedef enum {
/* Success Codes (>= 0) */

ENS_OK = 0, ENS_OK = 0,


/* 0 to 255 : errno */

/* Error Codes (< 0) */ /* Error Codes (< 0) */


ENE_READ_ERROR = -1, ENE_READ_ERROR = -1,
ENE_WRITE_ERROR = -2, ENE_WRITE_ERROR = -2,
ENE_OUT_OF_MEMORY = -3,
ENE_COMPILE_ERRORS = -4, ENE_COMPILE_ERRORS = -4,
ENE_VERSION_MISMATCH = -5, ENE_VERSION_MISMATCH = -5,
} espeak_ng_STATUS; } espeak_ng_STATUS;

+ 2
- 1
src/libespeak-ng/compiledata.c View File



#include "config.h" #include "config.h"


#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
fprintf(f_errors, "Failed to allocate data for tunes\n"); fprintf(f_errors, "Failed to allocate data for tunes\n");
fclose(f_in); fclose(f_in);
fclose(f_errors); fclose(f_errors);
return ENE_OUT_OF_MEMORY;
return ENOMEM;
} }


sprintf(buf, "%s/intonations", path_home); sprintf(buf, "%s/intonations", path_home);

+ 3
- 2
src/libespeak-ng/speak_lib.c View File



#include "config.h" #include "config.h"


#include "errno.h"
#include "stdio.h" #include "stdio.h"
#include "ctype.h" #include "ctype.h"
#include "string.h" #include "string.h"
outbuf_size = (buffer_length * samplerate)/500; outbuf_size = (buffer_length * samplerate)/500;
outbuf = (unsigned char *)realloc(outbuf, outbuf_size); outbuf = (unsigned char *)realloc(outbuf, outbuf_size);
if ((out_start = outbuf) == NULL) if ((out_start = outbuf) == NULL)
return ENE_OUT_OF_MEMORY;
return ENOMEM;


// allocate space for event list. Allow 200 events per second. // allocate space for event list. Allow 200 events per second.
// Add a constant to allow for very small buf_length // Add a constant to allow for very small buf_length
n_event_list = (buffer_length*200)/1000 + 20; n_event_list = (buffer_length*200)/1000 + 20;
if ((event_list = (espeak_EVENT *)realloc(event_list, sizeof(espeak_EVENT) * n_event_list)) == NULL) 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; return ENS_OK;
} }

Loading…
Cancel
Save