Apache OpenOffice (AOO) Bugzilla – Issue 49381
sd: warning: uninitialized variable is used
Last modified: 2017-05-20 10:47:45 UTC
The new gcc-4.0-pre has a better detection of problems with uninitialized variables and prints the new "warning: FOO is used uninitialized". We are going through this warnings because there is a higher chance that the code is really broken. The following problems were found in the module sd: /usr/src/packages/BUILD/ooo-build-1.9.100/build/src680-m100/sd/source/ui/view/ViewShellImplementation.cxx: In member function ‘void sd::ViewShell::Implementation::ProcessModifyPageSlot(SfxRequest&, SdPage*, PageKind)’: /usr/src/packages/BUILD/ooo-build-1.9.100/build/src680-m100/sd/source/ui/view/ViewShellImplementation.cxx:273: warning: ‘aOldAutoLayout’ is used uninitialized in this function The variable 'aOldAutoLayout' is used this way: if(bShowDialog) { sal_Bool bNameChanged(aNewName != aOldName); sal_Bool bLayoutChanged(aNewAutoLayout != aOldAutoLayout); if(bNameChanged && !bLayoutChanged) bShowDialog = sal_False; } but is is never initialized. I think that it could be initialized this way: aOldAutoLayout = pUndoPage->GetAutoLayout(); because the variable "aNewAutoLayout" is used to set the AutoLayout either for pCurrentPage or for pHandoutMPage depending on bHandoutMode. And the variable pUndoPage points to either pCurrentPage or pHandoutMPage depending on the same variable bHandoutMode. So, I think that the commad above could be used to get the old AutoLayout setting. I'll attach a patch for this.
Created attachment 26228 [details] This patch tries to fix the uninitialized variable.
Reassigned. Please handle this.
André, please have a look
This old code certainly is not very beautifull but the compiler could have seen that it is never executed. The code line before the if(bShowDialog) is sal_Bool bShowDialog(sal_False); The aNewAutoLayout variable is correctly initialized when it later is used but that is not detectable by the compiler. So, the code in question should be removed and aNewAutoLayout should be properly initialized to make the compiler happy.
Changing target to OOo 3.0
Target change.
set target from 2.x to 3.x according http://wiki.services.openoffice.org/wiki/Target_3x
Reset assigne to the default "issues@openoffice.apache.org".