<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi again,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I think I've found what's going on.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Basically the BinaryStreamOperator used to read the osgb format saves the block size currently read with an int - <a href="https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgPlugins/osg/BinaryStreamOperator.h#L282">see here</a> - which is not large enough to express very large blocks.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I've patched the code with unsigned int (both when writing and reading block size, always on 4 bytes) and I can now write and read correctly the files that showed the problem.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Of course unsigned int is not large enough for arbitrarily huge blocks, but at least it doubles the current max size.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">I'll post a pull request with the patch.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Using a type bigger than 4 bytes would make the current files unreadable, so I don't think it's something that can be changed.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Riccardo</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 8, 2017 at 1:15 PM, Riccardo Corsi <span dir="ltr"><<a href="mailto:riccardo.corsi@kairos3d.it" target="_blank">riccardo.corsi@kairos3d.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default"><font face="tahoma, sans-serif">Hi all,</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">I'm getting an error when reading some (pretty big) osgb files and having hard time in finding what's causing the issue. </font></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="tahoma, sans-serif">I'm creating the files myself with osgDB::writeNodeFile, without any error message when writing them.</font></div><div class="gmail_default"><font face="tahoma, sans-serif">The files' contents are only Groups and Geometries with basic data (vertices, normals, stateset).</font></div><div class="gmail_default"><font face="tahoma, sans-serif">The files are created and read with the same osg libraries, version 3.5.3.</font></div><div class="gmail_default"><font face="tahoma, sans-serif">The error message I receive on the console (even at DEBUG level) is only:</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><i><br></i></font></div><div class="gmail_default"><font face="tahoma, sans-serif"><i>Error reading file sample.osgb: read error (InputStream: Failed to read from stream. At osg::Group )</i></font><br></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">with no additional details, as it normally happens when file is not well formatted.</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">Additional info:</font></div><div class="gmail_default"><font face="tahoma, sans-serif">- I've spotted the issue for big file (2GB or more), but not always from a given size up. I have some 4GB files working and some 3GB causing the error.</font></div><div class="gmail_default"><font face="tahoma, sans-serif">- in some cases, if I create foo.osgb and bar.osgb they are both loaded correctly, but if I create foo+bar.osgb (writing works ok) I get the error when reading it.</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">Unfortunately I cannot share example files.</font></div><div class="gmail_default">I'm looking for some pointers on how to investigate further to find the culprit.</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="tahoma, sans-serif">My configuration is:</font></div><div class="gmail_default"><font face="tahoma, sans-serif">- osg 3.5.3</font></div><div class="gmail_default"><font face="tahoma, sans-serif">- windows 10</font></div><div class="gmail_default"><font face="tahoma, sans-serif">- visual studio 2013</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">Thank you,</font></div><div class="gmail_default"><font face="tahoma, sans-serif">Riccardo</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div></div>
</blockquote></div><br></div>