v1: introduce INVALID_FILEPOS_T to return error values when trying to read/write (only in EbmlVoid::ReplaceWidth for now)

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@121 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
Steve Lhomme 2010-04-15 09:36:30 +00:00
parent 8bff224319
commit be6a37df06
2 changed files with 6 additions and 2 deletions

View File

@ -238,6 +238,10 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
#define EBML_CTX_IDX_INFO(c,i) (c).MyTable[(i)].GetCallbacks
#endif
#if !defined(INVALID_FILEPOS_T)
#define INVALID_FILEPOS_T 0
#endif
#define EBML_DEF_CONS
#define EBML_DEF_SEP
#define EBML_DEF_PARAM

View File

@ -65,11 +65,11 @@ uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output
EltToReplaceWith.UpdateSize(bKeepIntact);
if (HeadSize() + GetSize() < EltToReplaceWith.GetSize() + EltToReplaceWith.HeadSize()) {
// the element can't be written here !
return 0;
return INVALID_FILEPOS_T;
}
if (HeadSize() + GetSize() - EltToReplaceWith.GetSize() - EltToReplaceWith.HeadSize() == 1) {
// there is not enough space to put a filling element
return 0;
return INVALID_FILEPOS_T;
}
uint64 CurrentPosition = output.getFilePointer();