Issue 14865 - return type mismatch - return by value assigned to reference
Summary: return type mismatch - return by value assigned to reference
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 1.1 Beta2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: khendricks
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks: 13400
  Show dependency tree
 
Reported: 2003-05-25 19:32 UTC by khendricks
Modified: 2013-08-07 14:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description khendricks 2003-05-25 19:34:03 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. 
sw/source/filter/xml/xmltexti.cxx 
@@ -827,7 
 void SwXMLTextImportHelper::RedlineAdjustStartNodeCursor( 
        sal_Bool bStart) 
 { 
(fixme?) OUString& rId = GetOpenRedlineId(); 
        if ((NULL != pRedlineHelper) && (rId.getLength() > 0)) 
        { 
         Reference<XTextRange> xTextRange( GetCursor()->getStart() ); 
 
 
 
sw/source/ui/dbui/dbtree.cxx 
@@ -349,8 
        const OUString* pDBNames = aDBNames.getConstArray(); 
        long nCount = aDBNames.getLength(); 
 
(fixme?)    Image& rImg = aImageList.GetImage(IMG_DB); 
(fixme?)    Image& rHCImg = aImageListHC.GetImage(IMG_DB); 
     for(long i = 0; i < nCount; i++) 
        { 
                String sDBName(pDBNames[i]); 
 
 
 
sw/source/ui/dbui/dbtree.cxx 
@@ -499,8 
                         String sTableName; 
                         long nCount = aTblNames.getLength(); 
                         const OUString* pTblNames = aTblNames.getConstArray(); 
(fixme?)                 Image& rImg = aImageList.GetImage(IMG_DBTABLE); 
(fixme?)                 Image& rHCImg = aImageListHC.GetImage(IMG_DBTABLE); 
                         for (long i = 0; i < nCount; i++) 
                         { 
                             sTableName = pTblNames[i]; 
 
 
 
sw/source/ui/dbui/dbtree.cxx 
@@ -520,8 
                         String sQueryName; 
                         long nCount = aQueryNames.getLength(); 
                         const OUString* pQueryNames = aQueryNames.getConstArray(); 
(fixme?)                 Image& rImg = aImageList.GetImage(IMG_DBQUERY); 
(fixme?)                 Image& rHCImg = aImageListHC.GetImage(IMG_DBQUERY); 
                         for (long i = 0; i < nCount; i++) 
                         { 
                             sQueryName = pQueryNames[i]; 
 
 
 
sw/source/ui/uno/SwXDocumentSettings.cxx 
@@ -471,21 
                break; 
                case HANDLE_CURRENT_DATABASE_DATA_SOURCE: 
                { 
(fixme?)                SwDBData& rData = mpDoc->GetDBData(); 
                        if ( rValue >>= rData.sDataSource ) 
                                mpDoc->ChgDBData( rData ); 
                } 
                break; 
                case HANDLE_CURRENT_DATABASE_COMMAND: 
                { 
(fixme?)                SwDBData& rData = mpDoc->GetDBData(); 
                        if ( rValue >>= rData.sCommand ) 
                                mpDoc->ChgDBData( rData ); 
                } 
                break; 
                case HANDLE_CURRENT_DATABASE_COMMAND_TYPE: 
                { 
(fixme?)                SwDBData& rData = mpDoc->GetDBData(); 
                        if ( rValue >>= rData.nCommandType ) 
                                mpDoc->ChgDBData( rData ); 
                } 
 
 
 
sw/source/ui/fldui/changedb.cxx 
@@ -258,14 
        USHORT nParent = 0; 
        USHORT nChild = 0; 
 
(fixme?)    Image& rTableImg = aImageList.GetImage(IMG_DBTABLE); 
(fixme?)    Image& rDBImg = aImageList.GetImage(IMG_DB); 
(fixme?)    Image& rQueryImg = aImageList.GetImage(IMG_DBQUERY); 
(fixme?)    Image& rHCTableImg = aImageListHC.GetImage(IMG_DBTABLE); 
(fixme?)    Image& rHCDBImg = aImageListHC.GetImage(IMG_DB); 
(fixme?)    Image& rHCQueryImg = aImageListHC.GetImage(IMG_DBQUERY); 
(fixme?)    Image& rToInsert = nCommandType ? rQueryImg : rTableImg; 
(fixme?)    Image& rHCToInsert = nCommandType ? rHCQueryImg : rHCTableImg; 
     while ((pParent = aUsedDBTLB.GetEntry(nParent++)) != NULL) 
        { 
                if (sDBName == aUsedDBTLB.GetEntryText(pParent)) 
 
 
 
sw/source/ui/shells/basesh.cxx 
@@ -752,7 
        { 
                case FN_REPAGINATE: 
                        { 
(fixme?)                        Reference < XModel > & xModel = GetView().GetDocShell()->GetModel(); 
                                Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY ); 
                                SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( 
xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) ); 
                                pDoc->notifyRefreshListeners();
Comment 1 Martin Hollmichel 2003-05-26 10:02:52 UTC
reassigned and reset prio
Comment 2 andreas.martens 2003-05-27 12:24:01 UTC
Please have a look at this.
Comment 3 openoffice 2003-05-27 15:14:15 UTC
dvo: Changed priority to sane value.
Comment 4 openoffice 2003-05-27 15:26:38 UTC
dvo->khendricks: This is useful diagnostics! I think the cases I
looked at so far (this and a different bug) all where genuine bugs,
even if we usually get away with it. Thanks.

dvo: I changed the following two instances in sw016:
sw/source/filter/xml/xmltexti.cxx 
sw/source/ui/shells/basesh.cxx 

The other problems are in files:
sw/source/ui/dbui/dbtree.cxx 
sw/source/ui/uno/SwXDocumentSettings.cxx 
sw/source/ui/fldui/changedb.cxx 
They occur with Image and SwDBData elements. I suspect that these
should not be copied without need, so the proper solution maybe to
change the method signature rather than the call site. OS should know
more about this...

dvo->os: Please look at the remaining problems.
Comment 5 openoffice 2003-05-27 16:39:53 UTC
dvo->os: Nee, don't look.

After discussion with other developers, I've changed the other problem
cases as well:
sw/source/ui/dbui/dbtree.cxx 
sw/source/ui/uno/SwXDocumentSettings.cxx 
sw/source/ui/fldui/changedb.cxx 

In all cases, a copy should be made; so the fix consists basically of
remiving the ampersand in the local variable declaration.
Comment 6 openoffice 2003-06-11 10:24:41 UTC
dvo: Verified in sw016 instset.

dvo->khendricks: Please verify & close issue after fixes are
integrated into main tree.
Comment 7 openoffice 2003-06-11 10:25:59 UTC
dvo->khendricks: Please verify & close issue after fixes have been
integrated into main tree.
Comment 8 stefan.baltzer 2003-06-11 16:37:44 UTC
SBA: According to Daniel, there is nothing to test for QA.
Comment 9 stefan.baltzer 2003-06-11 16:38:59 UTC
Set to verified in CWS sw016.
-> Kevin: Please check and close after CWS sw016 got integrated. Thx.
Comment 10 Martin Hollmichel 2004-02-15 07:31:51 UTC
close issue