Skip to content

Commit

Permalink
support for Element 0x0000
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/osirix/code/osirix@6949 4e9e6e3d-4551-47eb-9dbe-a6127f9400a1
  • Loading branch information
rossetantoine committed Mar 24, 2010
1 parent 5e93b81 commit 8f55724
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions Papyrus3/PapyRead3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2947,24 +2947,29 @@ PutBufferInGroup3 (PapyShort inFileNb, unsigned char *ioBuffP, SElement *ioGroup
return -1;
}

if( *ioBufPosP - theInitialBufPos + theElemLength > inBytesToRead)
if( theArrElemP [theStructPos].element == 0x0000) // Retired attribute - UL Group Length
*ioBufPosP += theElemLength;
else
{
printf("****** err length : *ioBufPosP - theInitialBufPos + theElemLength > inBytesToRead -- BAD GROUP LENGTH - CORRUPTED DICOM FILE, %s\n", gPapyFilePath [inFileNb]);
RETURN (papReadGroup);
if( *ioBufPosP - theInitialBufPos + theElemLength > inBytesToRead)
{
printf("****** err length : *ioBufPosP - theInitialBufPos + theElemLength > inBytesToRead -- BAD GROUP LENGTH - CORRUPTED DICOM FILE, %s\n", gPapyFilePath [inFileNb]);
RETURN (papReadGroup);
}

/* extract the element depending on the value representation */
if ((theErr = PutBufferInElement3 (inFileNb, ioBuffP, theElemLength, &theArrElemP [theStructPos], ioBufPosP, theInitialFilePos)) < 0)
{
printf("****** err PutBufferInElement3, %s\n", gPapyFilePath [inFileNb]);
RETURN (theErr);
}

/* if it was a sequence with an undefined length, move the buffer accordingly */
if (theIsUndefSeqLen)
*ioBufPosP += 8L; //ANTOINE - au lieu de + !!!

*ioBufPosP = ccval + theElemLength; //ANTOINE
}

/* extract the element depending on the value representation */
if ((theErr = PutBufferInElement3 (inFileNb, ioBuffP, theElemLength, &theArrElemP [theStructPos], ioBufPosP, theInitialFilePos)) < 0)
{
printf("****** err PutBufferInElement3, %s\n", gPapyFilePath [inFileNb]);
RETURN (theErr);
}

/* if it was a sequence with an undefined length, move the buffer accordingly */
if (theIsUndefSeqLen)
*ioBufPosP += 8L; //ANTOINE - au lieu de + !!!

*ioBufPosP = ccval + theElemLength; //ANTOINE
} /* if ...theElemLength > 0 */
} /* else ...element found */

Expand Down

0 comments on commit 8f55724

Please sign in to comment.