Pavel Dovgalyuk <pavel.dovga...@ispras.ru> writes: > This patch adds functions to perform read and write operations > with replay log. > > Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> <snip> > + > +/* File for replay writing */ > +FILE *replay_file; > + > +void replay_put_byte(unsigned char byte) > +{ > + if (replay_file) { > + fwrite(&byte, sizeof(byte), 1, replay_file); > + } > +} > + > +void replay_put_event(unsigned char event) > +{ > + replay_put_byte(event); > +} > + > + <snip> > +void replay_put_dword(unsigned int dword) > +{ > + if (replay_file) { > + fwrite(&dword, sizeof(dword), 1, replay_file); > + } > +}
Given you use the unambiguous types bellow shouldn't you use uint8_t and uint32_t here to be safe? <snip> > + > +unsigned char replay_get_byte(void) > +{ > + unsigned char byte; > + if (replay_file) { > + fread(&byte, sizeof(byte), 1, replay_file); > + } > + return byte; > +} > + > +uint16_t replay_get_word(void) > +{ > + uint16_t word; > + if (replay_file) { > + fread(&word, sizeof(word), 1, replay_file); > + } > + > + return word; > +} > + > +unsigned int replay_get_dword(void) > +{ > + unsigned int dword; > + if (replay_file) { > + fread(&dword, sizeof(dword), 1, replay_file); > + } > + > + return dword; > +} Ditto for the fetchers <snip> -- Alex Bennée