mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
code cleanup: move Read4Bytes()
This commit is contained in:
@@ -176,6 +176,20 @@ int is_str_totally_null(const char* str, int size) {
|
||||
return (*str == 0 && memcmp(str, str+1, size-1) == 0);
|
||||
}
|
||||
|
||||
int Read4Bytes(FILE *f)
|
||||
{
|
||||
// Read 4 bytes (least significant first) into a word
|
||||
int ix;
|
||||
unsigned char c;
|
||||
int acc = 0;
|
||||
|
||||
for (ix = 0; ix < 4; ix++) {
|
||||
c = fgetc(f) & 0xff;
|
||||
acc += (c << (ix*8));
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
int towlower2(unsigned int c, Translator *translator)
|
||||
{
|
||||
// check for non-standard upper to lower case conversions
|
||||
|
||||
@@ -27,6 +27,7 @@ extern ESPEAK_NG_API int GetFileLength(const char *filename);
|
||||
extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size);
|
||||
|
||||
int is_str_totally_null(const char* str, int size); // Tests if all bytes of str up to size are null
|
||||
int Read4Bytes(FILE *f);
|
||||
int towlower2(unsigned int c, Translator *translator); // Supports Turkish I
|
||||
|
||||
ESPEAK_NG_API int utf8_in(int *c, const char *buf);
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
#include <espeak-ng/speak_lib.h>
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "common.h" // for GetFileLength, strncpy0
|
||||
#include "common.h" // for GetFileLength, strncpy0, ...
|
||||
#include "error.h" // for create_file_error_context
|
||||
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB
|
||||
#include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
|
||||
#include "readclause.h" // for Read4Bytes
|
||||
#include "spect.h" // for SpectFrame, peak_t, SpectSeq
|
||||
#include "speech.h" // for path_home, GetFileLength
|
||||
#include "synthdata.h" // for LoadPhData
|
||||
|
||||
@@ -271,20 +271,6 @@ static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
return buf;
|
||||
}
|
||||
|
||||
int Read4Bytes(FILE *f)
|
||||
{
|
||||
// Read 4 bytes (least significant first) into a word
|
||||
int ix;
|
||||
unsigned char c;
|
||||
int acc = 0;
|
||||
|
||||
for (ix = 0; ix < 4; ix++) {
|
||||
c = fgetc(f) & 0xff;
|
||||
acc += (c << (ix*8));
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output, int *bufix, int end_clause)
|
||||
{
|
||||
// announce punctuation names
|
||||
|
||||
@@ -37,7 +37,6 @@ extern PARAM_STACK param_stack[];
|
||||
int clause_type_from_codepoint(uint32_t c);
|
||||
int Eof(void);
|
||||
const char *WordToString2(unsigned int word);
|
||||
int Read4Bytes(FILE *f);
|
||||
int AddNameData(const char *name,
|
||||
int wide);
|
||||
int ReadClause(Translator *tr,
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "soundicon.h"
|
||||
#include "common.h" // for GetFileLength
|
||||
#include "error.h" // for create_file_error_context
|
||||
#include "readclause.h" // for Read4Bytes
|
||||
#include "speech.h" // for path_home, PATHSEP
|
||||
#include "synthesize.h" // for samplerate
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "dictionary.h"
|
||||
#include "mbrola.h"
|
||||
#include "readclause.h"
|
||||
#include "setlengths.h"
|
||||
#include "synthdata.h"
|
||||
#include "wavegen.h"
|
||||
|
||||
Reference in New Issue
Block a user