Opened 15 years ago
Closed 15 years ago
#990 closed Bugs (fixed)
spirit's file_iterator truncates file size value on Windows x64 (VC8.0express)
Reported by: | Owned by: | Hartmut Kaiser | |
---|---|---|---|
Milestone: | Boost 1.34.1 | Component: | spirit |
Version: | Boost 1.34.0 | Severity: | Problem |
Keywords: | file_iterator spirit x64 windows 64bit | Cc: |
Description
I have written a grammar to read in a file. I am using spirit's file_iterator class to enable the parse(...) function to read directly from the file and I get the following warning:
1> XXX\boost\boost_1_34_0\boost/spirit/iterator/impl/file_iterator.ipp(276) : warning C4244: 'return' : conversion from '__w64 int' to 'long', possible loss of data 1> XXX\boost\boost_1_34_0\boost/spirit/iterator/impl/file_iterator.ipp(276) : while compiling class template member function 'long boost::spirit::fileiter_impl::mmap_file_iterator<CharT>::distance(const boost::spirit::fileiter_impl::mmap_file_iterator<CharT> &) const' 1> with 1> [ 1> CharT=char 1> ] 1> XXX\boost\boost_1_34_0\boost/spirit/iterator/file_iterator.hpp(118) : see reference to class template instantiation 'boost::spirit::fileiter_impl::mmap_file_iterator<CharT>' being compiled 1> with 1> [ 1> CharT=char 1> ] 1> XXX\boost\boost_1_34_0\boost/spirit/iterator/file_iterator.hpp(152) : see reference to class template instantiation 'boost::spirit::fileiter_impl::file_iter_generator<CharT,BaseIteratorT>' being compiled 1> with 1> [ 1> CharT=char, 1> BaseIteratorT=boost::spirit::fileiter_impl::mmap_file_iterator<char> 1> ] 1> .\myfile.cpp(121) : see reference to class template instantiation 'boost::spirit::file_iterator<>' being compiled
This would be a problem for me if my file's were large, but they are not. Essentially in the file_iterator.ipp function the
long distance(const mmap_file_iterator& iter) const
is wrong as the difference between pointers on a 64bit windows computer is not a long. I think this needs to change to:
ptrdiff_t distance(const mmap_file_iterator& iter) const
I have tried this in my copy of the file, but the warning moves to the files/classes that use the function. I am also not sure about the other considerations for this function's return type, so I haven't proposed a patch.
I am compiling on Windows XP Pro x64, using MSVC++ 8.0 express edition (with SP1) on Xeon CPUs. I'm pretty sure the problem was also present without SP1.
Attachments (2)
Change History (6)
comment:1 by , 15 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 15 years ago
Milestone: | → Boost 1.34.1 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Reopened for consideration in 1.34.1.
by , 15 years ago
Attachment: | file_iterator.hpp.patch added |
---|
Patch for boost/spirit/iterator/file_iterator.hpp
by , 15 years ago
Attachment: | file_iterator.ipp.patch added |
---|
patch for boost/spirit/iterator/impl/file_iterator.ipp
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Patch applied to RC_1_34_0.
Fixed in Boost CVS::HEAD.