ext/RMagick/rmimage.cpp in rmagick-5.4.0 vs ext/RMagick/rmimage.cpp in rmagick-5.4.1

- old
+ new

@@ -2804,18 +2804,18 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); BEGIN_CHANNEL_MASK(image, channels); GVL_STRUCT_TYPE(ClutImage) args = { image, clut, image->interpolate, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ClutImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); END_CHANNEL_MASK(image); CHECK_EXCEPTION(); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(ClutImageChannel) args = { image, channels, clut }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ClutImageChannel), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(image, RetainOnError); rm_check_image_exception(clut, RetainOnError); #endif if (!okay) { @@ -4309,17 +4309,17 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(CompressImageColormap) args = { image, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompressImageColormap), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); CHECK_EXCEPTION(); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(CompressImageColormap) args = { image }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompressImageColormap), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(image, RetainOnError); #endif if (!okay) { rb_warning("CompressImageColormap failed (probably DirectClass image)"); @@ -5247,11 +5247,11 @@ new_image = rm_clone_image(image); GVL_STRUCT_TYPE(DecipherImage) args = { new_image, pf, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DecipherImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_exception(exception, new_image, DestroyOnError); if (!okay) { DestroyImage(new_image); rb_raise(rb_eRuntimeError, "DecipherImage failed for unknown reason."); @@ -5716,11 +5716,11 @@ TypedData_Get_Struct(self, Image, &rm_image_data_type, image); exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x, y, columns, rows, map, stg_type, (void *)pixels.v, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); if (!okay) { goto exit; } @@ -6312,11 +6312,11 @@ new_image = rm_clone_image(image); GVL_STRUCT_TYPE(EncipherImage) args = { new_image, pf, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EncipherImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_exception(exception, new_image, DestroyOnError); if (!okay) { DestroyImage(new_image); rb_raise(rb_eRuntimeError, "EncipherImage failed for unknown reason."); @@ -6663,11 +6663,11 @@ exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x_off, y_off, cols, rows, map, QuantumPixel, (void *)pixels, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); if (!okay) { xfree((void *)pixels); CHECK_EXCEPTION(); @@ -6856,11 +6856,11 @@ exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x_off, y_off, cols, rows, map, type, (void *)RSTRING_PTR(string), exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); if (!okay) { // Let GC have the string buffer. rb_str_resize(string, 0); CHECK_EXCEPTION(); @@ -7005,11 +7005,11 @@ void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(IsEquivalentImage), &args); #else GVL_STRUCT_TYPE(IsImageSimilar) args = { image, target, &x, &y, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(IsImageSimilar), &args); #endif - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); CHECK_EXCEPTION(); DestroyExceptionInfo(exception); if (!okay) { @@ -8207,11 +8207,11 @@ GVL_STRUCT_TYPE(ImportImagePixels) args = { image, x_off, y_off, cols, rows, map, stg_type, buffer, exception }; #else GVL_STRUCT_TYPE(ImportImagePixels) args = { image, x_off, y_off, cols, rows, map, stg_type, buffer }; #endif void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImportImagePixels), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); // Free pixel array before checking for errors. if (pixels) { xfree((void *)pixels); @@ -8694,18 +8694,18 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); BEGIN_CHANNEL_MASK(new_image, channels); GVL_STRUCT_TYPE(LevelImageColors) args = { new_image, &black_color, &white_color, invert, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImageColors), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); END_CHANNEL_MASK(new_image); rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(LevelColorsImageChannel) args = { new_image, channels, &black_color, &white_color, invert }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelColorsImageChannel), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(new_image, DestroyOnError); #endif if (!okay) { rb_raise(rb_eRuntimeError, "LevelImageColors failed for unknown reason."); @@ -8773,18 +8773,18 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); BEGIN_CHANNEL_MASK(new_image, channels); GVL_STRUCT_TYPE(LevelizeImage) args = { new_image, black_point, white_point, gamma, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelizeImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); END_CHANNEL_MASK(new_image); rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(LevelizeImageChannel) args = { new_image, channels, black_point, white_point, gamma }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelizeImageChannel), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(new_image, DestroyOnError); #endif if (!okay) { @@ -10200,17 +10200,17 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(OpaquePaintImage) args = { new_image, &target_pp, &fill_pp, MagickFalse, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(OpaquePaintImageChannel) args = { new_image, DefaultChannels, &target_pp, &fill_pp, MagickFalse }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImageChannel), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(new_image, DestroyOnError); #endif if (!okay) { @@ -10294,19 +10294,19 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); BEGIN_CHANNEL_MASK(new_image, channels); GVL_STRUCT_TYPE(OpaquePaintImage) args = { new_image, &target_pp, &fill_pp, invert, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); END_CHANNEL_MASK(new_image); new_image->fuzz = keep; rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(OpaquePaintImageChannel) args = { new_image, channels, &target_pp, &fill_pp, invert }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImageChannel), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); new_image->fuzz = keep; rm_check_image_exception(new_image, DestroyOnError); #endif @@ -10530,18 +10530,18 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, (const MagickPixel *)&color, alpha, invert, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); new_image->fuzz = keep; rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, (const MagickPixel *)&color, (Quantum)(QuantumRange - alpha), invert }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); new_image->fuzz = keep; // Is it possible for TransparentPaintImage to silently fail? rm_check_image_exception(new_image, DestroyOnError); #endif @@ -10702,21 +10702,21 @@ if (image->storage_class == PseudoClass) { #if defined(IMAGEMAGICK_7) GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); CHECK_EXCEPTION(); if (!okay) { DestroyExceptionInfo(exception); rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't set pixel color."); } #else GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(image, RetainOnError); if (!okay) { rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't set pixel color."); } @@ -13923,21 +13923,21 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); CHECK_EXCEPTION(); if (!okay) { DestroyExceptionInfo(exception); rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't store pixels."); } #else GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(image, RetainOnError); if (!okay) { rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't store pixels."); } @@ -14723,17 +14723,17 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, &color, alpha, MagickFalse, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, &color, (Quantum)(QuantumRange - alpha), MagickFalse }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(new_image, DestroyOnError); #endif if (!okay) { // Force exception @@ -14801,16 +14801,16 @@ #if defined(IMAGEMAGICK_7) exception = AcquireExceptionInfo(); GVL_STRUCT_TYPE(TransparentPaintImageChroma) args = { new_image, &low, &high, alpha, invert, exception }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImageChroma), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_exception(exception, new_image, DestroyOnError); DestroyExceptionInfo(exception); #else GVL_STRUCT_TYPE(TransparentPaintImageChroma) args = { new_image, &low, &high, (Quantum)(QuantumRange - alpha), invert }; void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImageChroma), &args); - okay = reinterpret_cast<MagickBooleanType &>(ret); + okay = static_cast<MagickBooleanType>(reinterpret_cast<intptr_t &>(ret)); rm_check_image_exception(new_image, DestroyOnError); #endif if (!okay) { // Force exception