mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
code cleanup: move strncpy0 to common.c
This commit is contained in:
@@ -51,4 +51,10 @@ int GetFileLength(const char *filename)
|
||||
return statbuf.st_size;
|
||||
}
|
||||
|
||||
void strncpy0(char *to, const char *from, int size)
|
||||
{
|
||||
// strcpy with limit, ensures a zero terminator
|
||||
strncpy(to, from, size);
|
||||
to[size-1] = 0;
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "espeak-ng/espeak_ng.h"
|
||||
|
||||
extern ESPEAK_NG_API int GetFileLength(const char *filename);
|
||||
extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
#include <espeak-ng/speak_lib.h>
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "common.h" // for GetFileLength
|
||||
#include "dictionary.h" // for 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
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
#include <espeak-ng/speak_lib.h>
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "common.h" // for strncpy0
|
||||
#include "compiledict.h"
|
||||
#include "dictionary.h" // for EncodePhonemes, strncpy0, HashDicti...
|
||||
#include "dictionary.h" // for EncodePhonemes, HashDicti...
|
||||
#include "error.h" // for create_file_error_context
|
||||
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB
|
||||
#include "phoneme.h" // for PHONEME_TAB_LIST, phonSWITCH, phone...
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <espeak-ng/speak_lib.h>
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "common.h" // for GetFileLength
|
||||
#include "common.h" // for GetFileLength, strncpy0
|
||||
#include "dictionary.h"
|
||||
#include "numbers.h" // for LookupAccentedLetter, Look...
|
||||
#include "phoneme.h" // for PHONEME_TAB, phVOWEL, phon...
|
||||
@@ -91,15 +91,6 @@ static unsigned char remove_accent[N_REMOVE_ACCENT] = {
|
||||
'a', 'a', 'a', 'b', 'o', 'c', 'd', 'd', 'e', 'e', 'e', 'e', 'e', 'e'
|
||||
};
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
void strncpy0(char *to, const char *from, int size)
|
||||
{
|
||||
// strcpy with limit, ensures a zero terminator
|
||||
strncpy(to, from, size);
|
||||
to[size-1] = 0;
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
static int Reverse4Bytes(int word)
|
||||
{
|
||||
// reverse the order of bytes from little-endian to big-endian
|
||||
|
||||
@@ -31,7 +31,6 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size);
|
||||
int LoadDictionary(Translator *tr, const char *name, int no_error);
|
||||
int HashDictionary(const char *string);
|
||||
const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <espeak-ng/espeak_ng.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "dictionary.h" // for strncpy0
|
||||
#include "common.h" // for strncpy0
|
||||
|
||||
espeak_ng_STATUS
|
||||
create_file_error_context(espeak_ng_ERROR_CONTEXT *context,
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <ucd/ucd.h>
|
||||
|
||||
#include "readclause.h"
|
||||
#include "common.h" // for GetFileLength
|
||||
#include "common.h" // for GetFileLength, strncpy0
|
||||
#include "config.h" // for HAVE_MKSTEMP
|
||||
#include "dictionary.h" // for LookupDictList, DecodePhonemes, Set...
|
||||
#include "error.h" // for create_file_error_context
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <ucd/ucd.h>
|
||||
|
||||
#include "ssml.h"
|
||||
#include "dictionary.h" // for strncpy0
|
||||
#include "common.h" // for strncpy0
|
||||
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB,
|
||||
#include "readclause.h" // for PARAM_STACK, param_stack, AddNameData
|
||||
#include "soundicon.h" // for LoadSoundFile2
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "translate.h"
|
||||
#include "translateword.h"
|
||||
#include "common.h" // for strncpy0
|
||||
#include "dictionary.h" // for TranslateRules, LookupDictList, Cha...
|
||||
#include "numbers.h" // for SetSpellingStress, ...
|
||||
#include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonPAUSE_...
|
||||
@@ -41,7 +43,7 @@
|
||||
#include "synthdata.h" // for SelectPhonemeTable, LookupPhonemeTable
|
||||
#include "ucd/ucd.h" // for ucd_toupper
|
||||
#include "voice.h" // for voice, voice_t
|
||||
#include "translateword.h"
|
||||
|
||||
|
||||
static void addPluralSuffixes(int flags, Translator *tr, char last_char, char *word_phonemes);
|
||||
static int CheckDottedAbbrev(char *word1);
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include <espeak-ng/encoding.h>
|
||||
|
||||
#include "voice.h" // for voice_t, DoVoiceChange, N_PEAKS
|
||||
#include "common.h" // for GetFileLength
|
||||
#include "dictionary.h" // for strncpy0, LoadDictionary
|
||||
#include "common.h" // for GetFileLength, strncpy0
|
||||
#include "dictionary.h" // for LoadDictionary
|
||||
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB
|
||||
#include "phoneme.h" // for REPLACE_PHONEMES, n_replace_pho...
|
||||
#include "speech.h" // for PATHSEP
|
||||
|
||||
Reference in New Issue
Block a user