Commit d73c4258 authored by Steve Lhomme's avatar Steve Lhomme

libebml2: rename bForceRender into bForceWithoutMandatory for more clarity

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@620 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent a94ce8c5
......@@ -107,11 +107,11 @@ typedef struct ebml_element_vmt
bool_t (*ValidateSize)(const void*);
err_t (*ReadData)(void*, stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC);
#if defined(CONFIG_EBML_WRITING)
err_t (*RenderData)(void*, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered);
err_t (*RenderData)(void*, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered);
#endif
bool_t (*IsDefaultValue)(const void*);
bool_t (*DefaultIsSet)(const void*);
filepos_t (*UpdateDataSize)(void*, bool_t bWithDefault, bool_t bForceRender);
filepos_t (*UpdateDataSize)(void*, bool_t bWithDefault, bool_t bForceWithoutMandatory);
bool_t (*NeedsDataSizeUpdate)(const void*, bool_t bWithDefault);
int (*Cmp)(const void*, const void*);
ebml_element *(*Copy)(const void*, const void *Cookie);
......@@ -171,7 +171,7 @@ EBML_DLL bool_t EBML_ElementIsType(const ebml_element *Element, const ebml_conte
#if defined(CONFIG_EBML_WRITING)
// TODO: replace the list of bools by flags ?
EBML_DLL err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefault, bool_t bKeepPosition, bool_t bForceRender, filepos_t *Rendered);
EBML_DLL err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefault, bool_t bKeepPosition, bool_t bForceWithoutMandatory, filepos_t *Rendered);
EBML_DLL err_t EBML_ElementRenderHead(ebml_element *Element, stream *Output, bool_t bKeepPosition, filepos_t *Rendered);
#endif
......
......@@ -57,7 +57,7 @@ failed:
}
#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_binary *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderData(ebml_binary *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
size_t Written;
err_t Err = Stream_Write(Output,ARRAYBEGIN(Element->Data,uint8_t),ARRAYCOUNT(Element->Data,uint8_t),&Written);
......@@ -77,11 +77,11 @@ static bool_t IsDefaultValue(const ebml_binary *Element)
return 0; // TODO: a default binary value needs a size too (use a structure to set the value in the structure)
}
static filepos_t UpdateDataSize(ebml_binary *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateDataSize(ebml_binary *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
Element->Base.DataSize = ARRAYCOUNT(Element->Data,uint8_t);
return INHERITED(Element,ebml_element_vmt,EBML_BINARY_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_BINARY_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static bool_t ValidateSize(const ebml_element *p)
......
......@@ -174,7 +174,7 @@ static err_t ReadData(ebml_crc *Element, stream *Input, const ebml_parser_contex
}
#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_crc *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderData(ebml_crc *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
err_t Result;
size_t Written = 0;
......
......@@ -49,7 +49,7 @@ static bool_t NeedsDataSizeUpdate(ebml_element *Element, bool_t bWithDefault)
return 1;
}
static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (!bWithDefault && EBML_ElementIsDefaultValue(Element))
return 0;
......@@ -270,7 +270,7 @@ fourcc_t EBML_BufferToID(const uint8_t *Buffer)
}
#if defined(CONFIG_EBML_WRITING)
err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefault, bool_t bKeepPosition, bool_t bForceRender, filepos_t *Rendered)
err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefault, bool_t bKeepPosition, bool_t bForceWithoutMandatory, filepos_t *Rendered)
{
err_t Result;
filepos_t _Rendered,WrittenSize;
......@@ -293,19 +293,19 @@ err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefa
#if !defined(NDEBUG)
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
SupposedSize = EBML_ElementUpdateSize(Element, bWithDefault, bForceRender);
SupposedSize = EBML_ElementUpdateSize(Element, bWithDefault, bForceWithoutMandatory);
else
SupposedSize = Element->DataSize;
#else
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
EBML_ElementUpdateSize(Element, bWithDefault, bForceRender);
EBML_ElementUpdateSize(Element, bWithDefault, bForceWithoutMandatory);
#endif
Result = EBML_ElementRenderHead(Element, Output, bKeepPosition, &WrittenSize);
*Rendered += WrittenSize;
if (Result != ERR_NONE)
return Result;
Result = EBML_ElementRenderData(Element, Output, bForceRender, bWithDefault, &WrittenSize);
Result = EBML_ElementRenderData(Element, Output, bForceWithoutMandatory, bWithDefault, &WrittenSize);
#if !defined(NDEBUG)
if (SupposedSize != INVALID_FILEPOS_T) assert(WrittenSize == SupposedSize);
#endif
......
......@@ -194,7 +194,7 @@ static bool_t NeedsDataSizeUpdate(ebml_element *Element, bool_t bWithDefault)
return 0;
}
static filepos_t UpdateDataSize(ebml_master *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateDataSize(ebml_master *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
{
......@@ -203,7 +203,7 @@ static filepos_t UpdateDataSize(ebml_master *Element, bool_t bWithDefault, bool_
//if (!EBML_ElementIsFiniteSize((ebml_element*)Element))
// return INVALID_FILEPOS_T;
if (!bForceRender) {
if (!bForceWithoutMandatory) {
assert(CheckMandatory((ebml_master*)Element, bWithDefault));
}
......@@ -216,7 +216,7 @@ static filepos_t UpdateDataSize(ebml_master *Element, bool_t bWithDefault, bool_
{
if (!bWithDefault && EBML_ElementIsDefaultValue(i))
continue;
EBML_ElementUpdateSize(i,bWithDefault,bForceRender);
EBML_ElementUpdateSize(i,bWithDefault,bForceWithoutMandatory);
if (i->DataSize == INVALID_FILEPOS_T)
return INVALID_FILEPOS_T;
Element->Base.DataSize += EBML_ElementFullSize(i,bWithDefault);
......@@ -228,7 +228,7 @@ static filepos_t UpdateDataSize(ebml_master *Element, bool_t bWithDefault, bool_
#endif
}
return INHERITED(Element,ebml_element_vmt,EBML_MASTER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_MASTER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
void EBML_MasterAddMandatory(ebml_master *Element, bool_t SetDefault)
......@@ -414,7 +414,7 @@ bool_t EBML_MasterIsChecksumValid(const ebml_master *Element)
}
#if defined(CONFIG_EBML_WRITING)
static err_t InternalRender(ebml_master *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t InternalRender(ebml_master *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
ebml_element *i;
filepos_t ItemRendered;
......@@ -423,7 +423,7 @@ static err_t InternalRender(ebml_master *Element, stream *Output, bool_t bForceR
{
if (!bWithDefault && EBML_ElementIsDefaultValue(i))
continue;
Err = EBML_ElementRender(i,Output, bWithDefault, 0, bForceRender, &ItemRendered);
Err = EBML_ElementRender(i,Output, bWithDefault, 0, bForceWithoutMandatory, &ItemRendered);
if (Err!=ERR_NONE)
return Err;
*Rendered += ItemRendered;
......@@ -431,7 +431,7 @@ static err_t InternalRender(ebml_master *Element, stream *Output, bool_t bForceR
return Err;
}
static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
filepos_t _Rendered;
err_t Err = ERR_NONE;
......@@ -440,12 +440,12 @@ static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceRende
Rendered = &_Rendered;
*Rendered = 0;
if (!bForceRender) {
if (!bForceWithoutMandatory) {
assert(CheckMandatory((ebml_master*)Element, bWithDefault));
}
if (!Element->CheckSumStatus)
Err = InternalRender(Element, Output, bForceRender, bWithDefault, Rendered);
Err = InternalRender(Element, Output, bForceWithoutMandatory, bWithDefault, Rendered);
else
{
// render to memory, compute the CRC, write the CRC and then the virtual data
......@@ -471,14 +471,14 @@ static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceRende
filepos_t Offset = Stream_Seek(Output,0,SEEK_CUR) + 6;
Node_Set(VOutput, MEMSTREAM_DATA, ARRAYBEGIN(TmpBuf,uint8_t), ARRAYCOUNT(TmpBuf,uint8_t));
Node_SET(VOutput, MEMSTREAM_OFFSET, &Offset);
Err = InternalRender(Element, VOutput, bForceRender, bWithDefault, Rendered);
Err = InternalRender(Element, VOutput, bForceWithoutMandatory, bWithDefault, Rendered);
assert(Err!=ERR_NONE || *Rendered == ARRAYCOUNT(TmpBuf,uint8_t));
if (Err==ERR_NONE)
{
filepos_t CrcSize;
EBML_CRCAddBuffer(CrcElt, ARRAYBEGIN(TmpBuf,uint8_t), ARRAYCOUNT(TmpBuf,uint8_t));
EBML_CRCFinalize(CrcElt);
Err = EBML_ElementRender((ebml_element*)CrcElt, Output, bWithDefault, 0, bForceRender, &CrcSize);
Err = EBML_ElementRender((ebml_element*)CrcElt, Output, bWithDefault, 0, bForceWithoutMandatory, &CrcSize);
if (Err==ERR_NONE)
{
size_t Written;
......@@ -493,7 +493,7 @@ static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceRende
else
{
filepos_t VirtualPos = Stream_Seek(Output,6,SEEK_CUR); // pass the CRC for now
Err = InternalRender(Element, Output, bForceRender, bWithDefault, Rendered);
Err = InternalRender(Element, Output, bForceWithoutMandatory, bWithDefault, Rendered);
if (Err==ERR_NONE)
{
filepos_t CrcSize;
......@@ -503,7 +503,7 @@ static err_t RenderData(ebml_master *Element, stream *Output, bool_t bForceRende
EBML_CRCAddBuffer(CrcElt, Data + (VirtualPos - CrcSize), (size_t)Element->Base.DataSize-6);
EBML_CRCFinalize(CrcElt);
Stream_Seek(Output,EBML_ElementPositionData((ebml_element*)Element),SEEK_SET);
Err = EBML_ElementRender((ebml_element*)CrcElt, Output, bWithDefault, 0, bForceRender, &CrcSize);
Err = EBML_ElementRender((ebml_element*)CrcElt, Output, bWithDefault, 0, bForceWithoutMandatory, &CrcSize);
*Rendered = *Rendered + CrcSize;
Stream_Seek(Output,EBML_ElementPositionEnd((ebml_element*)Element),SEEK_SET);
}
......
......@@ -100,7 +100,7 @@ failed:
}
#if defined(CONFIG_EBML_WRITING)
static err_t RenderDataSignedInt(ebml_integer *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderDataSignedInt(ebml_integer *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
uint8_t FinalData[8]; // we don't handle more than 64 bits integers
size_t i;
......@@ -136,7 +136,7 @@ static err_t RenderDataSignedInt(ebml_integer *Element, stream *Output, bool_t b
return Err;
}
static err_t RenderDataInt(ebml_integer *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderDataInt(ebml_integer *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
uint8_t FinalData[8]; // we don't handle more than 64 bits integers
size_t i;
......@@ -172,7 +172,7 @@ static err_t RenderDataInt(ebml_integer *Element, stream *Output, bool_t bForceR
return Err;
}
static err_t RenderDataFloat(ebml_float *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderDataFloat(ebml_float *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
err_t Err;
size_t i = 0;
......@@ -268,7 +268,7 @@ static bool_t IsDefaultValueFloat(const ebml_float *Element)
return Element->Base.Context->HasDefault && (!Element->Base.bValueIsSet || (Element->Value == (double)Element->Base.Context->DefaultValue));
}
static filepos_t UpdateSizeSignedInt(ebml_integer *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateSizeSignedInt(ebml_integer *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
{
......@@ -290,10 +290,10 @@ static filepos_t UpdateSizeSignedInt(ebml_integer *Element, bool_t bWithDefault,
Element->Base.DataSize = 8;
}
return INHERITED(Element,ebml_element_vmt,EBML_SINTEGER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_SINTEGER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static filepos_t UpdateSizeInt(ebml_integer *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateSizeInt(ebml_integer *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
{
......@@ -315,7 +315,7 @@ static filepos_t UpdateSizeInt(ebml_integer *Element, bool_t bWithDefault, bool_
Element->Base.DataSize = 8;
}
return INHERITED(Element,ebml_element_vmt,EBML_INTEGER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_INTEGER_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static void PostCreateInt(ebml_element *Element, bool_t SetDefault)
......
......@@ -105,7 +105,7 @@ failed:
}
#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_string *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderData(ebml_string *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
size_t Written;
err_t Err = Stream_Write(Output,Element->Buffer,(size_t)Element->Base.DataSize,&Written);
......@@ -162,20 +162,20 @@ static void Delete(ebml_string *p)
free((char*)p->Buffer);
}
static filepos_t UpdateDataSize(ebml_string *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateDataSize(ebml_string *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
Element->Base.DataSize = strlen(Element->Buffer);
return INHERITED(Element,ebml_element_vmt,EBML_STRING_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_STRING_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static filepos_t UpdateDataSizeUni(ebml_string *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateDataSizeUni(ebml_string *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
Element->Base.DataSize = strlen(Element->Buffer);
return INHERITED(Element,ebml_element_vmt,EBML_UNISTRING_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_UNISTRING_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static bool_t IsDefaultValue(const ebml_string *Element)
......
......@@ -40,7 +40,7 @@ static err_t ReadData(ebml_element *Element, stream *Input, const ebml_parser_co
}
#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_element *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderData(ebml_element *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
size_t Written, Left = (size_t)Element->DataSize;
err_t Err = ERR_NONE;
......
......@@ -2193,7 +2193,7 @@ static char GetBestLacingType(const matroska_block *Element)
return LACING_EBML;
}
static err_t RenderBlockData(matroska_block *Element, stream *Output, bool_t bForceRender, bool_t bWithDefault, filepos_t *Rendered)
static err_t RenderBlockData(matroska_block *Element, stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, filepos_t *Rendered)
{
err_t Err = ERR_NONE;
uint8_t BlockHead[5], *Cursor;
......@@ -2432,7 +2432,7 @@ static matroska_block *CopyBlockInfo(const matroska_block *Element, const void *
return Result;
}
static filepos_t UpdateBlockSize(matroska_block *Element, bool_t bWithDefault, bool_t bForceRender)
static filepos_t UpdateBlockSize(matroska_block *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory)
{
if (EBML_ElementNeedsDataSizeUpdate(Element, bWithDefault))
{
......@@ -2563,7 +2563,7 @@ static filepos_t UpdateBlockSize(matroska_block *Element, bool_t bWithDefault, b
}
// skip the EBML_BINARY_CLASS version as we have another internal buffer
return INHERITED(Element,ebml_element_vmt,EBML_BINARY_CLASS)->UpdateDataSize(Element, bWithDefault, bForceRender);
return INHERITED(Element,ebml_element_vmt,EBML_BINARY_CLASS)->UpdateDataSize(Element, bWithDefault, bForceWithoutMandatory);
}
static int CmpCuePoint(const matroska_cuepoint* a,const matroska_cuepoint* b)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment