Compile warning in baseprovider.cpp
src\tiles\providers\baseprovider.cpp(108): warning C4244: 'initializing': conversion from 'std::streamoff' to 'int', possible loss of data
I’ve made the changes as recommended by
Here's the current code segment:
Looking this over, the fl.tellg() method returns a streamoff, which is actually a long long value. This is why the compiler warns of a possible loss of data. However, a couple lines down, the sz value is used to initialize the size of the vector, which wants a size_t,which is an unsigned int value. So no matter what, we're going to have to deal with the size change.
What I recommend is the following, rather than assigning the streamoff value to an int, assign it into a size_t, and cast the streamoff value to a size_t:
It’s true that we will have a problem if the stream length is ever greater than an unsigned int can hold, but that’s a separate problem, if we’re just addressing the compiler warning.