Issue 14862

Summary: return type mismatch - return by value assigned to reference
Product: gsl Reporter: khendricks
Component: codeAssignee: philipp.lohmann
Status: CLOSED FIXED QA Contact: issues@gsl <issues>
Severity: Trivial    
Priority: P1 (highest) CC: issues
Version: OOo 1.1 Beta2   
Target Milestone: OOo 1.1 RC   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 13400    

Description khendricks 2003-05-25 19:25:24 UTC
gcc 3.3 now provides error messages when there are return type 
mismatches such as when a method returns an object by value 
that is assigned to a reference which is a bug since the 
reference points to a temporary variable created to hold 
the return by value. 
 
An occurrence of this type occurred here see ... (fixme?) 
 
Please evaluate that line and fix the code in question 
to prevent the bug if needed. 
 
vcl/unx/source/gdi/salgdi2.cxx 
@@ -573,7 
 SalPrinterBmp::GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const 
 { 
        Scanline pScan = mpScanAccess + nRow * mnScanOffset; 
(fixme?)BitmapColor& aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask); 
 
        return ColorOf (aColor); 
 } 
 
 
vcl/unx/source/gdi/salgdi2.cxx 
@@ -582,7 
 SalPrinterBmp::GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const 
 { 
        Scanline pScan = mpScanAccess + nRow * mnScanOffset; 
(fixme?)BitmapColor& aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask); 
 
        return GrayOf (aColor); 
 } 
 
 
 
vcl/unx/source/gdi/salgdi2.cxx 
@@ -591,7 
 SalPrinterBmp::GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const 
 { 
        Scanline pScan = mpScanAccess + nRow * mnScanOffset; 
(fixme?)BitmapColor& aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask); 
 
        if (aColor.IsIndex()) 
                return aColor.GetIndex();
Comment 1 Martin Hollmichel 2003-05-26 09:58:47 UTC
re set prio
Comment 2 christof.pintaske 2003-05-26 11:46:54 UTC
cp->pl: indeed seems to be a problem of copying from stack to
reference. please have a look. shouldn't harm too much to create a
copy since BitmapColor asssigments are all inline.
Comment 3 philipp.lohmann 2003-05-26 13:19:58 UTC
This is prio 1 exactly why ? And why is the compiler suddenly not more
capable of creating the necessary temporary itself as all its
predecessors did ?
Comment 4 philipp.lohmann 2003-05-26 14:02:18 UTC
ok, forget the last comment, i looked at the wrong line. I do not
really understand how any compiler was able to grok that.
Comment 5 philipp.lohmann 2003-05-26 14:27:36 UTC
fixed in CWS vcl11
Comment 6 philipp.lohmann 2003-06-04 12:52:08 UTC
verified in vcl11
Comment 7 philipp.lohmann 2003-06-12 10:39:59 UTC
fix is in srx645m5, closing issue