Browse Source

Add espeak_ng_STATUS error code return values to ReadPhondataManifest.

master
Reece H. Dunn 9 years ago
parent
commit
5453616ec9
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      src/libespeak-ng/compiledata.c

+ 9
- 4
src/libespeak-ng/compiledata.c View File

USHORT *prog_out_max; USHORT *prog_out_max;
USHORT prog_buf[MAX_PROG_BUF+20]; USHORT prog_buf[MAX_PROG_BUF+20];


static void ReadPhondataManifest()
static espeak_ng_STATUS ReadPhondataManifest(espeak_ng_ERROR_CONTEXT *context)
{ {
// Read the phondata-manifest file // Read the phondata-manifest file
FILE *f; FILE *f;


sprintf(buf, "%s%c%s", path_home, PATHSEP, "phondata-manifest"); sprintf(buf, "%s%c%s", path_home, PATHSEP, "phondata-manifest");
if ((f = fopen(buf, "r")) == NULL) if ((f = fopen(buf, "r")) == NULL)
return;
return create_file_error_context(context, errno, buf);


while (fgets(buf, sizeof(buf), f) != NULL) while (fgets(buf, sizeof(buf), f) != NULL)
n_lines++; n_lines++;


if ((manifest = (NAMETAB *)realloc(manifest, n_lines * sizeof(NAMETAB))) == NULL) { if ((manifest = (NAMETAB *)realloc(manifest, n_lines * sizeof(NAMETAB))) == NULL) {
fclose(f); fclose(f);
return;
return ENOMEM;
} }


n_manifest = 0; n_manifest = 0;
} }
} }
fclose(f); fclose(f);

return ENS_OK;
} }


static const char *KeyToMnem(keywtab_t *ktab, int type, int value) static const char *KeyToMnem(keywtab_t *ktab, int type, int value)
if (f_errors != stderr && f_errors != stdout) if (f_errors != stderr && f_errors != stdout)
fclose(f_errors); fclose(f_errors);


ReadPhondataManifest();
espeak_ng_STATUS status = ReadPhondataManifest(context);
if (status != ENS_OK)
return status;

return error_count > 0 ? ENS_COMPILE_ERROR : ENS_OK; return error_count > 0 ? ENS_COMPILE_ERROR : ENS_OK;
} }



Loading…
Cancel
Save