actube/src/cw/lw_put_image_data.c
7u83@mail.ru 673f59a651 Moved some functions from lwapp.h to lw.h, capwap.h to cw.h ...
FossilOrigin-Name: 8b6f76655e93cdb212b833ec890772b57e53723cf30b4fa9635130701890b0f2
2016-03-04 20:01:38 +00:00

27 lines
397 B
C

#include "lwapp.h"
#include "lw.h"
int lw_put_image_data(uint8_t *dst,FILE *infile)
{
if ( feof(infile)){
lw_put_byte(dst+0,1);
return 1;
}
int bytes = fread(dst+3,1,LW_BLOCKSIZE_IMAGE_DATA,infile);
if ( ferror(infile)) {
lw_put_byte(dst+0,5);
return 1;
}
lw_put_byte(dst,3);
uint16_t checksum = lw_checksum(dst+3,bytes);
lw_put_word(dst+1,checksum);
return bytes+3;
}