[haiku-commits] haiku: hrev43967 - src/add-ons/media/media-add-ons/mixer src/libs/print/libprint headers/libs/print/libprint

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 7 Apr 2012 12:22:44 +0200 (CEST)

hrev43967 adds 1 changeset to branch 'master'
old head: 7d0f6bd08c6a85222ceb55f49abb1ba805a91e05
new head: 7c369a4b3ff7b9204bb71c039489a82e78d55955

----------------------------------------------------------------------------

7c369a4: Fix gcc2 build on Mac OS X Lion.
  
  The gcc2 cross-compiler built on Mac OS X Lion has a bug in it
  where it is erroring with 'cast specifies signature type' when
  assigning 0 or NULL to a pointer to a member fuction. NULL in this
  instance is correctly converted to 0 since it is illegal to assign
  ((void*)0) to a pointer to a member function. However, it should
  be legal to assign 0 to a pointer to a member function. Thus, there
  is a bug.  Since I can't fix the gcc2 compiler I am working around
  this bug by assigning the pointer to a do nothing function instead.
  
  My host compiler version is
  i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
  
  The same error occurs using the default gcc-llvm compiler and
  a standard gcc 4.61 built from source. This bug does not occur on
  Mac OS X 10.6 gcc2 or gcc4, nor does it occur on Mac OS X 10.7 with
  the gcc4 cross-compiler.
  
  If and when we decide to finally leave gcc2 behind we can revert this
  change.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev43967
Commit:      7c369a4b3ff7b9204bb71c039489a82e78d55955
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7c369a4
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sat Apr  7 10:02:53 2012 UTC

----------------------------------------------------------------------------

4 files changed, 32 insertions(+), 16 deletions(-)
headers/libs/print/libprint/Halftone.h             |    8 +++++
.../media/media-add-ons/mixer/Resampler.cpp        |    4 +-
src/add-ons/media/media-add-ons/mixer/Resampler.h  |    9 +++++
src/libs/print/libprint/Halftone.cpp               |   27 +++++++--------

----------------------------------------------------------------------------

diff --git a/headers/libs/print/libprint/Halftone.h 
b/headers/libs/print/libprint/Halftone.h
index f72691a..4229749 100644
--- a/headers/libs/print/libprint/Halftone.h
+++ b/headers/libs/print/libprint/Halftone.h
@@ -102,6 +102,14 @@ protected:
                        void            SetupErrorBuffer(int x, int y, int 
width);
                        void            DitherFloydSteinberg(uchar* destination,
                                                        const uchar* source, 
int x, int y, int width);
+                                               // Do nothing method to get 
around a bug in
+                                               // the gcc2 cross-compiler 
built on Mac OS X
+                                               // Lion where a compiler error 
occurs when
+                                               // assigning a member function 
pointer to NULL
+                                               // or 0: cast specifies 
signature type.
+                                               // However, this should be 
legal according to
+                                               // the C++03 standard.
+                       void            DitherNone(uchar*, const uchar*, int, 
int, int) {};
 
 private:
        enum {
diff --git a/src/add-ons/media/media-add-ons/mixer/Resampler.cpp 
b/src/add-ons/media/media-add-ons/mixer/Resampler.cpp
index 1a758c2..1b4f987 100644
--- a/src/add-ons/media/media-add-ons/mixer/Resampler.cpp
+++ b/src/add-ons/media/media-add-ons/mixer/Resampler.cpp
@@ -21,7 +21,7 @@
 
 Resampler::Resampler(uint32 src_format, uint32 dst_format)
        :
-       fFunc(0)
+       fFunc(&Resampler::no_conversion)
 {
        if (dst_format == media_raw_audio_format::B_AUDIO_FLOAT) {
                switch (src_format) {
@@ -81,7 +81,7 @@ Resampler::~Resampler()
 status_t
 Resampler::InitCheck() const
 {
-       return fFunc != 0 ? B_OK : B_ERROR;
+       return fFunc != &Resampler::no_conversion ? B_OK : B_ERROR;
 }
 
 
diff --git a/src/add-ons/media/media-add-ons/mixer/Resampler.h 
b/src/add-ons/media/media-add-ons/mixer/Resampler.h
index 9ad1b64..3e6b531 100644
--- a/src/add-ons/media/media-add-ons/mixer/Resampler.h
+++ b/src/add-ons/media/media-add-ons/mixer/Resampler.h
@@ -65,6 +65,15 @@ private:
                                                                        int32 
srcSampleOffset, int32 srcSampleCount,
                                                                        void* 
dest, int32 destSampleOffset,
                                                                        int32 
destSampleCount, float gain);
+                                                               // Do nothing 
method to get around a bug in
+                                                               // the gcc2 
cross-compiler built on Mac OS X
+                                                               // Lion where a 
compiler error occurs when
+                                                               // assigning a 
member function pointer to NULL
+                                                               // or 0: cast 
specifies signature type.
+                                                               // However, 
this should be legal according to
+                                                               // the C++03 
standard.
+                       void                            no_conversion(const 
void*, int32, int32, void*,
+                                                                       int32, 
int32, float) {};
 };
 
 
diff --git a/src/libs/print/libprint/Halftone.cpp 
b/src/libs/print/libprint/Halftone.cpp
index 82b5e6e..10e37c0 100644
--- a/src/libs/print/libprint/Halftone.cpp
+++ b/src/libs/print/libprint/Halftone.cpp
@@ -31,21 +31,21 @@ ToGray(ColorRGB32 c)
 static uint
 GetRedValue(ColorRGB32 c)
 {
-       return c.little.red;    
+       return c.little.red;
 }
 
 
 static uint
 GetGreenValue(ColorRGB32 c)
 {
-       return c.little.green;  
+       return c.little.green;
 }
 
 
 static uint
 GetBlueValue(ColorRGB32 c)
 {
-       return c.little.blue;   
+       return c.little.blue;
 }
 
 
@@ -56,11 +56,11 @@ Halftone::Halftone(color_space colorSpace, double gamma, 
double min,
        fGray       = ToGray;
        SetPlanes(kPlaneMonochrome1);
        SetBlackValue(kHighValueMeansBlack);
-       
+
        InitFloydSteinberg();
-       
+
        CreateGammaTable(gamma, min);
-       
+
        if (ditherType == kTypeFloydSteinberg) {
                fDither = &Halftone::DitherFloydSteinberg;
                return;
@@ -79,13 +79,13 @@ Halftone::Halftone(color_space colorSpace, double gamma, 
double min,
        }
 
        switch (colorSpace) {
-       case B_RGB32:
-       case B_RGB32_BIG:
-               fDither = &Halftone::DitherRGB32;
-               break;
-       default:
-               fDither = NULL;
-               break;
+               case B_RGB32:
+               case B_RGB32_BIG:
+                       fDither = &Halftone::DitherRGB32;
+                       break;
+               default:
+                       fDither = &Halftone::DitherNone;
+                       break;
        }
 }
 
@@ -364,4 +364,3 @@ Halftone::DitherFloydSteinberg(uchar *destination, const 
uchar* source0,
                *destination = ConvertUsingBlackValue(cur);
        }
 }
-


Other related posts:

  • » [haiku-commits] haiku: hrev43967 - src/add-ons/media/media-add-ons/mixer src/libs/print/libprint headers/libs/print/libprint - jscipione