feat/api #46
1 changed files with 0 additions and 91 deletions
|
@ -263,97 +263,6 @@ eas3_init_stream(uchar* memory, uint32 size, char instr)
|
|||
} \
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void *test(void) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
! ------------ !
|
||||
! DESCRIPTION NEEDED !
|
||||
! !
|
||||
! PARAMETERS: !
|
||||
! ----------- !
|
||||
! Variable Type Description !
|
||||
! -------- ---- ----------- !
|
||||
! stream bitstream* - Structure used to assemble a bwc bit- !
|
||||
! bitstream. !
|
||||
! !
|
||||
! size unsigned int(64 bit) - Size of the data block. !
|
||||
! !
|
||||
! RETURN VALUE: !
|
||||
! ------------- !
|
||||
! Type Description !
|
||||
! ---- ----------- !
|
||||
! uchar* - Data chunck requested by the function caller. !
|
||||
! !
|
||||
! DEVELOPMENT HISTORY: !
|
||||
! -------------------- !
|
||||
! !
|
||||
! Date Author Change Id Release Description Of Change !
|
||||
! ---- ------ --------- ------- --------------------- !
|
||||
! 22.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar*
|
||||
eas3_get_chunck(span *const stream, const uint64 size)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE CHAR VARIABLES: !
|
||||
\*-----------------------*/
|
||||
uchar *tmp;
|
||||
|
||||
/*-----------------------*\
|
||||
! DEFINE ASSERTIONS: !
|
||||
\*-----------------------*/
|
||||
assert(stream);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Check if the number of bytes to be read from the stream !
|
||||
! does not exceed the number of bytes still present in its !
|
||||
! memory block. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(eas3_bytes_used(stream) + size <= stream->Lmax)
|
||||
{
|
||||
/*--------------------------------------------------------*\
|
||||
! Allocate a temporary array used to store the bytes that !
|
||||
! are extracted from the stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
tmp = calloc(size, sizeof(uchar));
|
||||
if(!tmp)
|
||||
{
|
||||
// memory allocation error
|
||||
fprintf(stderr, MEMERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Copy the bytes requested from the function caller from !
|
||||
! the stream to the temporary data block. !
|
||||
\*--------------------------------------------------------*/
|
||||
memcpy(tmp, stream->memory + stream->L, size);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Increment the number of bytes read from the bitstream. !
|
||||
\*--------------------------------------------------------*/
|
||||
stream->L += size;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Return the temporary data block to the function caller. !
|
||||
\*--------------------------------------------------------*/
|
||||
return tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*--------------------------------------------------------*\
|
||||
! If the requested block size exceeds the information left !
|
||||
! in the bitstream, set the bitstream error flag and !
|
||||
! return a NULL pointer. !
|
||||
\*--------------------------------------------------------*/
|
||||
stream->error |= 1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
|
Loading…
Reference in a new issue