Apache OpenOffice (AOO) Bugzilla – Issue 14865
return type mismatch - return by value assigned to reference
Last modified: 2013-08-07 14:44:28 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();
reassigned and reset prio
Please have a look at this.
dvo: Changed priority to sane value.
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.
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.
dvo: Verified in sw016 instset. dvo->khendricks: Please verify & close issue after fixes are integrated into main tree.
dvo->khendricks: Please verify & close issue after fixes have been integrated into main tree.
SBA: According to Daniel, there is nothing to test for QA.
Set to verified in CWS sw016. -> Kevin: Please check and close after CWS sw016 got integrated. Thx.
close issue