On Tue, 2015-01-13 at 10:40 +0100, A. Massad wrote: > > I have managed to fix this issue with the following patch to > PdfXRefStreamParserObject.cpp, the if-statement added just before > the switch-statement fixed this bug: > > > =================================================================== > > --- podofo-src-r1665/src/base/PdfXRefStreamParserObject.cpp > > (revision 7630) > > +++ podofo-src-r1665/src/base/PdfXRefStreamParserObject.cpp > > (working copy) > > @@ -228,6 +228,7 @@ > > > > //printf("OBJ=%i nData = [ %i %i %i ]\n", nObjNo, > > static_cast<int>(nData[0]), static_cast<int>(nData[1]), > > static_cast<int>(nData[2]) ); > > (*m_pOffsets)[nObjNo].bParsed = true; > > + if (lW[0]==0) nData[0]=1; // If the first element is zero, > > the type field shall not be present, and shall default to type 1. > > switch( nData[0] ) // nData[0] contains the type information > > of this entry > > { > > case 0: > Without this patch, I could not create a PdfMemDocument for a > certain PDF sample file which contains an XRef with a W-key of the > form [0 3 0]. The symptom looked like this > >
Hi, it seems nobody took an action on your previous request from 2014-11-29. Pity. Anyway, I didn't check the exact code and consequences, but on the first look, does it make sense to modify the nData[0] value? It seems to me that a cleaner solution would be something like this: switch( lW[0] == 0 ? 1 : nData[0] ) thus when you'll save the document it'll still contain the same reference as before it's opened in PoDoFo. Again, I didn't check the actual code and other consequences. It's also possible that such check should be done on more places than just here (which your value overwrite hid). By the way, it's better to attach patches, rather than paste them inline, especially when you compose in an HTML format. This one-liner is not a big problem, still you expect someone to open the editor and apply it manually, instead of just invoking a `patch` command. Once you'd like to provide a patch for something more complicated the garbled patch would be just the main obstacle. It's garbled due to white-spaces (even a tab replacement, which depends on the actual mail agent which would show the message body), indentation and line wrapping. Bye, zyx -- http://www.litePDF.cz i...@litepdf.cz ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users