soprano: remake fe ready reader to parse header

This commit is contained in:
Dmitry Simonenko 2016-11-15 14:27:08 +03:00
parent 2ef1bed4ad
commit eb8a2bb1f3
1 changed files with 8 additions and 2 deletions

View File

@ -14,12 +14,18 @@
#include <so_macro.h> #include <so_macro.h>
#include <so_stream.h> #include <so_stream.h>
#include <so_header.h> #include <so_header.h>
#include <so_read.h>
#include <so_feread.h> #include <so_feread.h>
int so_feread_ready(uint8_t *data, uint32_t size, int *status) int so_feread_ready(uint8_t *data, uint32_t size, int *status)
{ {
if (so_unlikely(size != 1)) soheader_t *header = (soheader_t*)data;
uint32_t len;
int rc = so_read(&len, &data, &size);
if (rc != 0)
return -1; return -1;
*status = data[0]; if (len != 1)
return -1;
*status = header->data[0];
return 0; return 0;
} }