feat/api #46
1 changed files with 9 additions and 7 deletions
|
@ -1498,6 +1498,7 @@ bwc_set_com(bwc_stream *const data, char const *const com, uint16 size)
|
||||||
! Save the global info structure to a temporary variable !
|
! Save the global info structure to a temporary variable !
|
||||||
! to make the code more readable. !
|
! to make the code more readable. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
|
data->codestream.com = calloc(1, sizeof(bwc_span));
|
||||||
data->codestream.com->memory = calloc(size, sizeof(char));
|
data->codestream.com->memory = calloc(size, sizeof(char));
|
||||||
if(!data->codestream.com->memory)
|
if(!data->codestream.com->memory)
|
||||||
{
|
{
|
||||||
|
@ -1536,18 +1537,19 @@ bwc_set_aux(bwc_stream *const data, char const *const aux, uint32 size)
|
||||||
! Save the global info structure to a temporary variable !
|
! Save the global info structure to a temporary variable !
|
||||||
! to make the code more readable. !
|
! to make the code more readable. !
|
||||||
\*--------------------------------------------------------*/
|
\*--------------------------------------------------------*/
|
||||||
data->codestream.com->memory = calloc(size, sizeof(char));
|
data->codestream.aux = calloc(1, sizeof(bwc_span));
|
||||||
if(!data->codestream.com->memory)
|
data->codestream.aux->memory = calloc(size, sizeof(char));
|
||||||
|
if(!data->codestream.aux->memory)
|
||||||
{
|
{
|
||||||
// memory allocation error
|
// memory allocation error
|
||||||
fprintf(stderr, MEMERROR);
|
fprintf(stderr, MEMERROR);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(data->codestream.com->memory, aux, size * sizeof(char));
|
memcpy(data->codestream.aux->memory, aux, size * sizeof(char));
|
||||||
data->codestream.com->access = data->codestream.com->memory;
|
data->codestream.aux->access = data->codestream.aux->memory;
|
||||||
data->codestream.com->size = size;
|
data->codestream.aux->size = size;
|
||||||
data->codestream.com->position = 0;
|
data->codestream.aux->position = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue