X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocument.cxx;h=d89207dd94097aea20b18bc77ec6e7a595b783cf;hb=7059f7f1ad9d1466d7b752a40cfeb95ba81aa3d8;hp=a202aca00541268f770c3c858b0ffe2693be4f99;hpb=e1d59b9033b0e40ae040ad8f6a66892a7157ba99;p=gdcm.git diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index a202aca0..d89207dd 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2005/01/10 03:09:07 $ - Version: $Revision: 1.169 $ + Date: $Date: 2005/01/10 17:17:52 $ + Version: $Revision: 1.171 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -47,7 +47,7 @@ namespace gdcm static const char *TransferSyntaxStrings[] = { // Implicit VR Little Endian "1.2.840.10008.1.2", - // Implicit VR Big Endian DLX G.E? + // Implicit VR Big Endian DLX (G.E Private) "1.2.840.113619.5.2", // Explicit VR Little Endian "1.2.840.10008.1.2.1", @@ -1906,14 +1906,12 @@ void Document::SkipDocEntry(DocEntry *entry) /** * \brief Skips to the begining of the next Header Entry * \warning NOT end user intended method ! - * @param offset start of skipping - * @param readLgth length to skip - + * @param currentDocEntry entry to skip */ -void Document::SkipToNextDocEntry(DocEntry *newDocEntry) +void Document::SkipToNextDocEntry(DocEntry *currentDocEntry) { - Fp->seekg((long)(newDocEntry->GetOffset()), std::ios::beg); - Fp->seekg( (long)(newDocEntry->GetReadLength()),std::ios::cur); + Fp->seekg((long)(currentDocEntry->GetOffset()), std::ios::beg); + Fp->seekg( (long)(currentDocEntry->GetReadLength()),std::ios::cur); } /** @@ -1921,7 +1919,7 @@ void Document::SkipToNextDocEntry(DocEntry *newDocEntry) * the parser went Jabberwocky) one can hope improving things by * applying some heuristics. * @param entry entry to check - * @param foundLength fist assumption about length + * @param foundLength first assumption about length */ void Document::FixDocEntryFoundLength(DocEntry *entry, uint32_t foundLength) @@ -1997,7 +1995,7 @@ void Document::FixDocEntryFoundLength(DocEntry *entry, */ bool Document::IsDocEntryAnInteger(DocEntry *entry) { - uint16_t element = entry->GetElement(); + uint16_t elem = entry->GetElement(); uint16_t group = entry->GetGroup(); const std::string &vr = entry->GetVR(); uint32_t length = entry->GetLength(); @@ -2005,7 +2003,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry) // When we have some semantics on the element we just read, and if we // a priori know we are dealing with an integer, then we shall be // able to swap it's element value properly. - if ( element == 0 ) // This is the group length of the group + if ( elem == 0 ) // This is the group length of the group { if ( length == 4 ) { @@ -2022,7 +2020,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry) // message and proceed on parsing (while crossing fingers). long filePosition = Fp->tellg(); gdcmVerboseMacro( "Erroneous Group Length element length on : (" - << std::hex << group << " , " << element + << std::hex << group << " , " << elem << ") -before- position x(" << filePosition << ")" << "lgt : " << length ); } @@ -2060,8 +2058,8 @@ uint32_t Document::FindDocEntryLengthOBOrOW() } catch ( FormatError ) { - throw FormatError("Document::FindDocEntryLengthOBOrOW()", - " group or element not present."); + throw FormatError("Unexpected end of file encountered during ", + "Document::FindDocEntryLengthOBOrOW()"); } // We have to decount the group and element we just read @@ -2069,7 +2067,11 @@ uint32_t Document::FindDocEntryLengthOBOrOW() if ( group != 0xfffe || ( ( elem != 0xe0dd ) && ( elem != 0xe000 ) ) ) { - gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag."); + long filePosition = Fp->tellg(); + gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag on :" + << std::hex << group << " , " << elem + << ") -before- position x(" << filePosition << ")" ); + Fp->seekg(positionOnEntry, std::ios::beg); throw FormatUnexpected( "Neither an Item tag nor a Sequence delimiter tag."); }