fix gcc8 complaining about stringop-truncation

This commit is contained in:
derselbst 2018-12-14 19:42:08 +01:00
parent 4f1f7349db
commit a9662bf331
2 changed files with 4 additions and 3 deletions

View file

@ -1902,7 +1902,7 @@ fluid_synth_sysex_midi_tuning(fluid_synth_t *synth, const char *data, int len,
int bank = 0, prog, channels;
double tunedata[128];
int keys[128];
char name[17];
char name[17]={0};
int note, frac, frac2;
uint8_t chksum;
int i, count, index;
@ -1973,7 +1973,8 @@ fluid_synth_sysex_midi_tuning(fluid_synth_t *synth, const char *data, int len,
}
*resptr++ = prog;
FLUID_STRNCPY(resptr, name, 16);
/* copy 16 ASCII characters (potentially not null terminated) to the sysex buffer */
FLUID_MEMCPY(resptr, name, 16);
resptr += 16;
for(i = 0; i < 128; i++)

View file

@ -261,7 +261,7 @@ typedef FILE *fluid_file;
#define FLUID_STRNCPY(_dst,_src,_n) \
do { strncpy(_dst,_src,_n); \
(_dst)[(_n)-1]=0; \
(_dst)[(_n)-1]='\0'; \
}while(0)
#define FLUID_STRCHR(_s,_c) strchr(_s,_c)