Christan,
Thanks for looking over my patch.
On Sun, Nov 7, 2010 at 12:39 AM, Nathan Crookston
I have an updated patch which fixes the above problem and also
prevents a few more warnings.
Since I dislike large amounts of code in a single message I'll send
another shortly, describing how to reproduce the warning and with
another patch which should correct it and everything else discussed
thus far.
The following code reveals another place where we GIL can emit
warnings (at an admittedly high warning level):
///BEGIN CODE showing channel conversion problems for large integers///
#include
#include <iostream>
namespace boost { namespace gil {
//////////////////////////////////////////////////////////////////////////
// Byte-aligned 30 bit grayscale
//////////////////////////////////////////////////////////////////////////
const uint64_t bits60_max_val = 1152921504606846976;
struct bits60_min { static uint64_t apply() { return 0; } };
struct bits60_max { static uint64_t apply() { return bits60_max_val; } };
typedef scoped_channel_value bits60;
namespace detail
{
template <>
struct unsigned_integral_max_value<bits60>
: public mpl::integral_c {};
template <>
struct unsigned_integral_num_bits<bits60> : public mpl::int_<60> {};
}//end detail
GIL_DEFINE_BASE_TYPEDEFS(60, gray)
} }//end boost::gil
namespace gil = boost::gil;
int main()
{
gil::gray60_pixel_t g60;
gil::gray8_pixel_t g8(255);
color_convert(g8, g60);
std::cout << "Value: " << g60[0] << std::endl;
std::cout << "Should be: " << gil::bits60_max_val << std::endl;
return 0;
}
///END CODE///
The fix is the same as it's been for the other warnings.
The attached patch corrects this, the original conversion problems and
an actual bug as noted in my previous message. It also fixes the
issue with my original patch (use type, not value_type -- thanks for
catching that, I incorrectly merged my changes from 1.44 to trunk
before generating the patch).
Please let me know if there are any problems, thanks again!
Nate