diff options
| author | milla <marc.illa@dolby.com> | 2021-05-28 11:12:49 +0200 |
|---|---|---|
| committer | milla <marc.illa@dolby.com> | 2021-06-03 14:26:19 +0200 |
| commit | 88508be0b2c0f916e348019eabf12b469eb7b9a1 (patch) | |
| tree | 47bc64086b075eae0ba4e5aa39be2900ea09d25e /src | |
| parent | f9d7fbc33aa571c547d916b145712469efd9f4b8 (diff) | |
Add KM logs and remove semicolon from pre-processor directive
Diffstat (limited to 'src')
| -rwxr-xr-x | src/Index.cpp | 13 | ||||
| -rwxr-xr-x | src/KM_error.h | 2 | ||||
| -rw-r--r-- | src/KM_xml.cpp | 18 |
3 files changed, 29 insertions, 4 deletions
diff --git a/src/Index.cpp b/src/Index.cpp index 0815f25..81ee5b4 100755 --- a/src/Index.cpp +++ b/src/Index.cpp @@ -30,9 +30,11 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "MXF.h" -const ui32_t kl_length = ASDCP::SMPTE_UL_LENGTH + ASDCP::MXF_BER_LENGTH; +#include "KM_log.h" +const ui32_t kl_length = ASDCP::SMPTE_UL_LENGTH + ASDCP::MXF_BER_LENGTH; +using Kumu::DefaultLogSink; // ASDCP::MXF::IndexTableSegment::IndexTableSegment(const Dictionary* d) : InterchangeObject(d), RtFileOffset(0), RtEntryOffset(0), @@ -118,10 +120,15 @@ ASDCP::MXF::IndexTableSegment::InitFromTLVSet(TLVReader& TLVSet) if ( decoder_item_size < item_size ) { - TLVSet.SkipOffset(item_size - decoder_item_size); + rc = TLVSet.SkipOffset(item_size - decoder_item_size); } } } + if (IndexEntryArray.size() != item_count) + { + DefaultLogSink().Error("Malformed index table segment, could not decode all IndexEntries.\n"); + return RESULT_FAIL; + } } } } @@ -196,7 +203,7 @@ ASDCP::MXF::IndexTableSegment::Dump(FILE* stream) } else { - fprintf(stream, " IndexEntryArray: %zu entries\n", IndexEntryArray.size()); + fprintf(stream, " IndexEntryArray: %lu entries\n", IndexEntryArray.size()); } } diff --git a/src/KM_error.h b/src/KM_error.h index 8270cc0..ad94f6c 100755 --- a/src/KM_error.h +++ b/src/KM_error.h @@ -36,7 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string> -#define KM_DECLARE_RESULT(sym, i, l) const Result_t RESULT_##sym = Result_t(i, #sym, l); +#define KM_DECLARE_RESULT(sym, i, l) const Result_t RESULT_##sym = Result_t(i, #sym, l) namespace Kumu { diff --git a/src/KM_xml.cpp b/src/KM_xml.cpp index 5037391..31bb04d 100644 --- a/src/KM_xml.cpp +++ b/src/KM_xml.cpp @@ -612,6 +612,9 @@ Kumu::XMLElement::ParseFirstFromString(const char* document, ui32_t doc_len) if ( ! XML_Parse(Parser, document, doc_len, 1) ) { + DefaultLogSink().Error("XML Parse error on line %d: %s\n", + XML_GetCurrentLineNumber(Parser), + XML_ErrorString(XML_GetErrorCode(Parser))); XML_ParserFree(Parser); return false; } @@ -1022,8 +1025,23 @@ Kumu::XMLElement::ParseFirstFromString(const char* document, ui32_t doc_len) ++errorCount; } } + catch (const XMLException& e) + { + char* message = XMLString::transcode(e.getMessage()); + DefaultLogSink().Error("Parser error: %s\n", message); + XMLString::release(&message); + errorCount++; + } + catch (const SAXParseException& e) + { + char* message = XMLString::transcode(e.getMessage()); + DefaultLogSink().Error("Parser error: %s at line %d\n", message, e.getLineNumber()); + XMLString::release(&message); + errorCount++; + } catch (...) { + DefaultLogSink().Error("Unexpected XML parser error\n"); errorCount++; } |
