mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-04 23:56:14 +00:00
Use errno codes in place of ENE_(READ|WRITE)_ERROR.
This commit is contained in:
@@ -37,8 +37,6 @@ typedef enum {
|
|||||||
|
|
||||||
/* Error Codes (< 0) */
|
/* Error Codes (< 0) */
|
||||||
|
|
||||||
ENE_READ_ERROR = -1,
|
|
||||||
ENE_WRITE_ERROR = -2,
|
|
||||||
ENE_COMPILE_ERRORS = -4,
|
ENE_COMPILE_ERRORS = -4,
|
||||||
ENE_VERSION_MISMATCH = -5,
|
ENE_VERSION_MISMATCH = -5,
|
||||||
} espeak_ng_STATUS;
|
} espeak_ng_STATUS;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||||
* email: jonsd@users.sourceforge.net
|
* email: jonsd@users.sourceforge.net
|
||||||
* Copyright (C) 2013-2015 Reece H. Dunn
|
* Copyright (C) 2013-2016 Reece H. Dunn
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -2650,7 +2650,7 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
|||||||
|
|
||||||
if (!access(fname, 755)) {
|
if (!access(fname, 755)) {
|
||||||
fprintf(log, "Can't find phoneme source directory: %s\n", fname);
|
fprintf(log, "Can't find phoneme source directory: %s\n", fname);
|
||||||
return ENE_READ_ERROR;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy0(current_fname, source, sizeof(current_fname));
|
strncpy0(current_fname, source, sizeof(current_fname));
|
||||||
@@ -2659,7 +2659,7 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
|||||||
f_in = fopen_log(f_errors, fname, "rb");
|
f_in = fopen_log(f_errors, fname, "rb");
|
||||||
if (f_in == NULL) {
|
if (f_in == NULL) {
|
||||||
fprintf(log, "Can't read master phonemes file: %s\n", fname);
|
fprintf(log, "Can't read master phonemes file: %s\n", fname);
|
||||||
return ENE_READ_ERROR;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname, "%s/../phsource/%s", path_home, "compile_report");
|
sprintf(fname, "%s/../phsource/%s", path_home, "compile_report");
|
||||||
@@ -2695,7 +2695,7 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
|||||||
f_phtab = fopen_log(f_errors, fname, "wb");
|
f_phtab = fopen_log(f_errors, fname, "wb");
|
||||||
|
|
||||||
if (f_phdata == NULL || f_phindex == NULL || f_phtab == NULL)
|
if (f_phdata == NULL || f_phindex == NULL || f_phtab == NULL)
|
||||||
return ENE_WRITE_ERROR;
|
return errno;
|
||||||
|
|
||||||
sprintf(fname, "%s/../phsource/compile_prog_log", path_home);
|
sprintf(fname, "%s/../phsource/compile_prog_log", path_home);
|
||||||
f_prog_log = fopen_log(f_errors, fname, "wb");
|
f_prog_log = fopen_log(f_errors, fname, "wb");
|
||||||
@@ -2814,9 +2814,10 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
|||||||
if ((f_in = fopen(buf, "r")) == NULL) {
|
if ((f_in = fopen(buf, "r")) == NULL) {
|
||||||
sprintf(buf, "%s/../phsource/intonation", path_home);
|
sprintf(buf, "%s/../phsource/intonation", path_home);
|
||||||
if ((f_in = fopen_log(f_errors, buf, "r")) == NULL) {
|
if ((f_in = fopen_log(f_errors, buf, "r")) == NULL) {
|
||||||
|
int error = errno;
|
||||||
fprintf(log, "Can't read file: %s\n", buf);
|
fprintf(log, "Can't read file: %s\n", buf);
|
||||||
fclose(f_errors);
|
fclose(f_errors);
|
||||||
return ENE_READ_ERROR;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2869,10 +2870,11 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
|||||||
sprintf(buf, "%s/intonations", path_home);
|
sprintf(buf, "%s/intonations", path_home);
|
||||||
f_out = fopen_log(f_errors, buf, "wb");
|
f_out = fopen_log(f_errors, buf, "wb");
|
||||||
if (f_out == NULL) {
|
if (f_out == NULL) {
|
||||||
|
int error = errno;
|
||||||
fclose(f_in);
|
fclose(f_in);
|
||||||
fclose(f_errors);
|
fclose(f_errors);
|
||||||
free(tune_data);
|
free(tune_data);
|
||||||
return ENE_WRITE_ERROR;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!feof(f_in)) {
|
while (!feof(f_in)) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||||
* email: jonsd@users.sourceforge.net
|
* email: jonsd@users.sourceforge.net
|
||||||
* Copyright (C) 2015 Reece H. Dunn
|
* Copyright (C) 2015-2016 Reece H. Dunn
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -1549,13 +1550,14 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileDictionary(const char *dsource,
|
|||||||
if ((f_in = fopen(fname_in, "r")) == NULL) {
|
if ((f_in = fopen(fname_in, "r")) == NULL) {
|
||||||
sprintf(fname_in, "%srules", path);
|
sprintf(fname_in, "%srules", path);
|
||||||
if ((f_in = fopen_log(fname_in, "r")) == NULL)
|
if ((f_in = fopen_log(fname_in, "r")) == NULL)
|
||||||
return ENE_READ_ERROR;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name);
|
sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name);
|
||||||
if ((f_out = fopen_log(fname_out, "wb+")) == NULL) {
|
if ((f_out = fopen_log(fname_out, "wb+")) == NULL) {
|
||||||
|
int error = errno;
|
||||||
fclose(f_in);
|
fclose(f_in);
|
||||||
return ENE_WRITE_ERROR;
|
return error;
|
||||||
}
|
}
|
||||||
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP);
|
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||||
* email: jonsd@users.sourceforge.net
|
* email: jonsd@users.sourceforge.net
|
||||||
* Copyright (C) 2013-2015 Reece H. Dunn
|
* Copyright (C) 2013-2016 Reece H. Dunn
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -86,7 +87,7 @@ espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log)
|
|||||||
strcpy(buf, filepath);
|
strcpy(buf, filepath);
|
||||||
if ((f_in = fopen(buf, "r")) == NULL) {
|
if ((f_in = fopen(buf, "r")) == NULL) {
|
||||||
fprintf(log, "Can't read: %s\n", filepath);
|
fprintf(log, "Can't read: %s\n", filepath);
|
||||||
return ENE_READ_ERROR;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(buf, sizeof(phoneme), f_in) != NULL) {
|
while (fgets(buf, sizeof(phoneme), f_in) != NULL) {
|
||||||
@@ -127,7 +128,7 @@ espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log)
|
|||||||
sprintf(buf, "%s/mbrola_ph/%s_phtrans", path_home, mbrola_voice);
|
sprintf(buf, "%s/mbrola_ph/%s_phtrans", path_home, mbrola_voice);
|
||||||
if ((f_out = fopen(buf, "wb")) == NULL) {
|
if ((f_out = fopen(buf, "wb")) == NULL) {
|
||||||
fprintf(log, "Can't write to: %s\n", buf);
|
fprintf(log, "Can't write to: %s\n", buf);
|
||||||
return ENE_WRITE_ERROR;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
data[count].name = 0; // list terminator
|
data[count].name = 0; // list terminator
|
||||||
|
|||||||
Reference in New Issue
Block a user