diff --git a/components/IndustrialStuff/source/lednumber.pas b/components/IndustrialStuff/source/lednumber.pas index e0dcfcde67..4bbbaa63b6 100644 --- a/components/IndustrialStuff/source/lednumber.pas +++ b/components/IndustrialStuff/source/lednumber.pas @@ -273,7 +273,7 @@ end; function TCustomLEDNumber.GetAbout : string; begin -// Result := VpVersionStr; + Result := ''; //VpVersionStr; end; {=====} diff --git a/components/codetools/ide/newidewnddlg.pas b/components/codetools/ide/newidewnddlg.pas index 49769401cb..86c93e77d0 100644 --- a/components/codetools/ide/newidewnddlg.pas +++ b/components/codetools/ide/newidewnddlg.pas @@ -130,11 +130,11 @@ begin debugln('Source: =================================================='); debugln(Src); debugln('=========================================================='); - exit; + exit(''); end; if EndPos<1 then begin debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+EndMarker+'" not found']); - exit; + exit(''); end; inc(StartPos,length(StartMarker)); Result:=UTF8Trim(copy(Src,StartPos,EndPos-StartPos)); diff --git a/components/datadict/idedatadict.pp b/components/datadict/idedatadict.pp index be68b65e26..77e66e6e5a 100644 --- a/components/datadict/idedatadict.pp +++ b/components/datadict/idedatadict.pp @@ -298,8 +298,9 @@ Var begin I:=FKnownDicts.IndexOf(ADict); If (I<>-1) then - Result:=(FKnownDicts.Objects[i] as TDDFile).FFileName; - + Result:=(FKnownDicts.Objects[i] as TDDFile).FFileName + Else + Result:=''; end; { TDDFile } diff --git a/components/fpweb/fpideexteditorinsertfilenameunit.pas b/components/fpweb/fpideexteditorinsertfilenameunit.pas index 003c3e961f..c514b760ec 100644 --- a/components/fpweb/fpideexteditorinsertfilenameunit.pas +++ b/components/fpweb/fpideexteditorinsertfilenameunit.pas @@ -78,7 +78,7 @@ end; procedure TfpIDEExtEditorInsertFileNameForm.FillFilesList; var i:integer; - S, Ext:string; + S:string; begin LBFiles.Items.Clear; if Assigned(LazarusIDE) and Assigned(LazarusIDE.ActiveProject) then diff --git a/components/fpweb/fpwebnewhtmllistunit.pas b/components/fpweb/fpwebnewhtmllistunit.pas index 56d7ccf4b3..d7aa1e2563 100644 --- a/components/fpweb/fpwebnewhtmllistunit.pas +++ b/components/fpweb/fpwebnewhtmllistunit.pas @@ -63,8 +63,6 @@ uses strutils; { TfpwebNewHTMLListForm } function TfpwebNewHTMLListForm.HtmlText: string; -var - i:integer; begin Result:=DupeString('
  • '+LineEnding, SERows.Value); if RGStyle.ItemIndex = 0 then diff --git a/components/lazreport/source/fr3tolrf.pas b/components/lazreport/source/fr3tolrf.pas index ec6f1000d3..9fd69e6e75 100644 --- a/components/lazreport/source/fr3tolrf.pas +++ b/components/lazreport/source/fr3tolrf.pas @@ -113,6 +113,7 @@ function LoadFastReport3(Report: TfrReport; aFileName: string; out Log:string): var Reader: Tfr3Reader; begin + Result := 0; Reader := Tfr3Reader.Create; Reader.Report := Report; try @@ -272,7 +273,6 @@ end; procedure Tfr3Reader.LoadReport(Node: TDOMNode); var Attr: TDOMNode; - S: string; begin Report.Clear; @@ -303,7 +303,6 @@ end; procedure Tfr3Reader.LoadPages(Node: TDOMNode); var - Page: TfrPage; i: Integer; begin Node := Node.FirstChild; diff --git a/components/lazreport/source/lr_crosstabeditor.pas b/components/lazreport/source/lr_crosstabeditor.pas index 585cc572bd..2af95f2fab 100644 --- a/components/lazreport/source/lr_crosstabeditor.pas +++ b/components/lazreport/source/lr_crosstabeditor.pas @@ -238,7 +238,6 @@ end; procedure TlrCrossViewDataSetProperty.GetValues(Proc: TGetStrProc); var I: Integer; - Values: TStringList; var Lst : TStringList; begin diff --git a/components/lazreport/source/lr_desgn.pas b/components/lazreport/source/lr_desgn.pas index 8978a6d722..3b580c922e 100644 --- a/components/lazreport/source/lr_desgn.pas +++ b/components/lazreport/source/lr_desgn.pas @@ -2924,7 +2924,6 @@ procedure TfrDesignerForm.GetFontList; var DC: HDC; Lf: TLogFont; - S: String; {$IFDEF USE_PRINTER_FONTS} Lst: TStrings; i: Integer; @@ -3259,7 +3258,6 @@ end; procedure TfrDesignerForm.FilePreviewExecute(Sender: TObject); // preview var - v1, v2: Boolean; TestRepStream:TMemoryStream; Rep, SaveR:TfrReport; @@ -6382,8 +6380,6 @@ end; {----------------------------------------------------------------------------} // menu bitmaps procedure TfrDesignerForm.SetMenuBitmaps; -var - i: Integer; begin MaxItemWidth := 0; MaxShortCutWidth := 0; @@ -7771,7 +7767,6 @@ end; procedure TfrCustomMemoViewDetailReportProperty.GetValues(Proc: TGetStrProc); var I: Integer; - Values: TStringList; begin if Assigned(CurReport) then begin @@ -7821,7 +7816,7 @@ end; procedure TlrInternalTools.InsertDbFields; var - i, x, y, dx, dy, pdx, adx, tdx, tdy: Integer; + i, x, y, dx, dy, pdx, adx: Integer; HeaderL, DataL: TFpList; t, t1: TfrView; b: TfrBandView; diff --git a/components/lazreport/source/lr_dsopt.pas b/components/lazreport/source/lr_dsopt.pas index 6ae23d7ca6..c18775f66e 100644 --- a/components/lazreport/source/lr_dsopt.pas +++ b/components/lazreport/source/lr_dsopt.pas @@ -137,12 +137,6 @@ procedure TfrDesOptionsForm.FillFonts; var DC: HDC; Lf: TLogFont; - S: String; - {$IFDEF USE_PRINTER_FONTS} - Lst: TStrings; - i: Integer; - j: PtrInt; - {$ENDIF} begin ComboBox1.Clear; DC := GetDC(0); diff --git a/components/lazreport/source/lr_hyphen.pas b/components/lazreport/source/lr_hyphen.pas index dc7e5308fd..3fdbfc1d76 100644 --- a/components/lazreport/source/lr_hyphen.pas +++ b/components/lazreport/source/lr_hyphen.pas @@ -213,7 +213,7 @@ end; function THyphen.BreakWord(Word: string): string; var - i, j: cardinal; + i: cardinal; hyphens: PChar; rep: PPChar; pos: Pointer; @@ -234,10 +234,8 @@ begin pos := nil; cut := nil; try - if hnj_hyphen_hyphenate2(pdict^, PChar(word), Len, hyphens, nil, - rep, pos, cut) = 0 then + if hnj_hyphen_hyphenate2(pdict^, PChar(word), Len, hyphens, nil, rep, pos, cut) = 0 then begin - j := 0; for i := 1 to length(hyphens)-1 do if Odd(Ord(hyphens[i])) then begin result := result + chr(i+1); diff --git a/components/lazreport/source/lr_previewtoolsabstract.pas b/components/lazreport/source/lr_previewtoolsabstract.pas index 60592df82c..bd22bbb90b 100644 --- a/components/lazreport/source/lr_previewtoolsabstract.pas +++ b/components/lazreport/source/lr_previewtoolsabstract.pas @@ -53,7 +53,6 @@ implementation procedure RegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract); var - C: Integer; i: Integer; begin for i:=0 to lrExportFilters.Count - 1 do @@ -65,7 +64,6 @@ end; procedure UnRegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract); var - C: Integer; i: Integer; begin i:=lrExportFilters.IndexOf(AFilter); diff --git a/components/lazreport/source/lr_shape.pas b/components/lazreport/source/lr_shape.pas index de4bc5bb65..093c6c6f41 100644 --- a/components/lazreport/source/lr_shape.pas +++ b/components/lazreport/source/lr_shape.pas @@ -287,7 +287,7 @@ function TfrShapeView.GetClipRgn(rt: TfrRgnType): HRGN; const Delta = 10; var - x1, y1, xp, yp : Integer; + xp : Integer; Pts : Array[0..6] of TPoint; min, bx, by, bx1, by1, w1, w2, fw: Integer; begin diff --git a/components/lazreport/source/lr_utils.pas b/components/lazreport/source/lr_utils.pas index 2450b6a9d2..4ad4694110 100644 --- a/components/lazreport/source/lr_utils.pas +++ b/components/lazreport/source/lr_utils.pas @@ -390,7 +390,7 @@ end; procedure frGetDataSetAndField(ComplexName: String; var DataSet: TfrTDataSet; out Field: TfrTField); var - n, i, j: Integer; + n: Integer; Owner, Component: TComponent; s1, s2, s3, s4: String; frDS, F:TfrObject; @@ -1049,7 +1049,7 @@ end; function UTF8CountWords(const str:string; out WordCount,SpcCount,SpcSize:Integer): TArrUTF8Item; var - b,i,j,n,len: Integer; + b,i,j,len: Integer; spc: boolean; begin i := 1; diff --git a/converter/chgencodingdlg.pas b/converter/chgencodingdlg.pas index 637b06635d..dc3712ce32 100644 --- a/converter/chgencodingdlg.pas +++ b/converter/chgencodingdlg.pas @@ -179,6 +179,7 @@ var HasChanged: boolean; li: TListItem; begin + HasChanged:=False; NewEncoding:=NormalizeEncoding(NewEncodingComboBox.Text); PreviewListView.BeginUpdate; PreviewListView.Items.Clear; diff --git a/converter/convcodetool.pas b/converter/convcodetool.pas index 9d40968f18..9886577d97 100644 --- a/converter/convcodetool.pas +++ b/converter/convcodetool.pas @@ -475,6 +475,7 @@ var CommChBeg, CommBeg, CommEnd, i: Integer; // Start and end of comment. begin Result:=''; + CommBeg:=0; CommEnd:=Length(aStr); CommChBeg:=PosEx('//', aStr, aPossibleStartPos); if CommChBeg<>0 then diff --git a/converter/convertdelphi.pas b/converter/convertdelphi.pas index b6a986a091..346eee9bbb 100644 --- a/converter/convertdelphi.pas +++ b/converter/convertdelphi.pas @@ -1400,7 +1400,9 @@ begin else AddToProjectLater(aFileName); // Add to project later. end; - end; + end + else + Result:=False; end; function TConvertDelphiProjPack.CheckPackageDep(AUnitName: string): Boolean; diff --git a/converter/replacenamesunit.pas b/converter/replacenamesunit.pas index bc9a181b08..73d4af22a2 100644 --- a/converter/replacenamesunit.pas +++ b/converter/replacenamesunit.pas @@ -277,7 +277,9 @@ begin fGrid.Cells[0,GridEndInd]:=AOldIdent; fGrid.Cells[1,GridEndInd]:=Result; Inc(GridEndInd); - end; + end + else + Result:=''; end; diff --git a/debugger/breakpointsdlg.pp b/debugger/breakpointsdlg.pp index 951aec0d44..9460cad4a9 100644 --- a/debugger/breakpointsdlg.pp +++ b/debugger/breakpointsdlg.pp @@ -874,6 +874,7 @@ begin case ABreakpoint.WatchScope of wpsGlobal: s:= lisWatchScopeGlobal; wpsLocal: s:= lisWatchScopeLocal; + else s := ''; end; s := s +' / '; case ABreakpoint.WatchKind of diff --git a/debugger/debugger.pp b/debugger/debugger.pp index bc70cd48c8..7726a1adf7 100644 --- a/debugger/debugger.pp +++ b/debugger/debugger.pp @@ -1862,7 +1862,7 @@ end; function TIDEBreakPointGroupList.Add(const AGroup: TIDEBreakPointGroup): Integer; begin - if (AGroup = nil) or (IndexOf(AGroup) >= 0) then exit; + if (AGroup = nil) or (IndexOf(AGroup) >= 0) then exit(-1); Result := FList.Add(AGroup); AGroup.AddReference(Self); FOwner.DoChanged; diff --git a/debugger/feedbackdlg.pp b/debugger/feedbackdlg.pp index cbb0345d1a..8308671917 100644 --- a/debugger/feedbackdlg.pp +++ b/debugger/feedbackdlg.pp @@ -95,7 +95,7 @@ begin case ShowModal of mrOk: Result := frOk; - mrCancel: Result := frStop; + else {mrCancel:} Result := frStop; end; end; diff --git a/debugger/processdebugger.pp b/debugger/processdebugger.pp index 7136adb83c..bb78321e14 100644 --- a/debugger/processdebugger.pp +++ b/debugger/processdebugger.pp @@ -161,6 +161,7 @@ begin dcRun: Result := ProcessRun; dcStop: Result := ProcessStop; dcEnvironment: Result := ProcessEnvironment(String(APArams[0].VAnsiString), AParams[1].VBoolean); + else Result := False; end; end; diff --git a/designer/controlselection.pp b/designer/controlselection.pp index 1096f166a3..b97d1263ba 100644 --- a/designer/controlselection.pp +++ b/designer/controlselection.pp @@ -888,6 +888,7 @@ function TSelectedControl.GetWidth: integer; var r: TRect; begin + Result := 0; if FUseCache then Result := FCachedWidth else diff --git a/designer/designer.pp b/designer/designer.pp index b272dd210f..714402a4c9 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -3958,7 +3958,6 @@ begin if ShowAlignComponentsDialog(HorizAlignID,VertAlignID)=mrOk then begin case HorizAlignID of - 0: HorizAlignment:=csaNone; 1: HorizAlignment:=csaSides1; 2: HorizAlignment:=csaCenters; 3: HorizAlignment:=csaSides2; @@ -3966,9 +3965,9 @@ begin 5: HorizAlignment:=csaSpaceEqually; 6: HorizAlignment:=csaSide1SpaceEqually; 7: HorizAlignment:=csaSide2SpaceEqually; + else HorizAlignment:=csaNone; // value=0, this prevents compiler warning. end; case VertAlignID of - 0: VertAlignment:=csaNone; 1: VertAlignment:=csaSides1; 2: VertAlignment:=csaCenters; 3: VertAlignment:=csaSides2; @@ -3976,6 +3975,7 @@ begin 5: VertAlignment:=csaSpaceEqually; 6: VertAlignment:=csaSide1SpaceEqually; 7: VertAlignment:=csaSide2SpaceEqually; + else VertAlignment:=csaNone; // value=0, this prevents compiler warning. end; ControlSelection.AlignComponents(HorizAlignment,VertAlignment); Modified; @@ -4014,16 +4014,16 @@ begin if ShowSizeComponentsDialog(HorizSizingID,AWidth,VertSizingID,AHeight) = mrOk then begin case HorizSizingID of - 0: HorizSizing:=cssNone; 1: HorizSizing:=cssShrinkToSmallest; 2: HorizSizing:=cssGrowToLargest; 3: HorizSizing:=cssFixed; + else HorizSizing:=cssNone; // value=0, this prevents compiler warning. end; case VertSizingID of - 0: VertSizing:=cssNone; 1: VertSizing:=cssShrinkToSmallest; 2: VertSizing:=cssGrowToLargest; 3: VertSizing:=cssFixed; + else VertSizing:=cssNone; // value=0, this prevents compiler warning. end; ControlSelection.SizeComponents(HorizSizing,AWidth,VertSizing,AHeight); Modified; diff --git a/designer/designermenu.pp b/designer/designermenu.pp index 59f473e830..6a85b05dee 100644 --- a/designer/designermenu.pp +++ b/designer/designermenu.pp @@ -733,7 +733,9 @@ begin temp_coord:=GetMaxCoordinates(DMenuItem.SubMenu, Max_Width, Max_Height); Max_Width:=temp_coord.Right; Max_Height:=temp_coord.Bottom; - end; + end + else + temp_coord:=Rect(0,0,0,0); if (DMenuItem.NextItem <> nil) then temp_coord:=GetMaxCoordinates(DMenuItem.NextItem, Max_Width, Max_Height); @@ -1779,6 +1781,7 @@ var DesignerMenuItem: TDesignerMenuItem; begin if not (Sender is TPropertyEditor) then Exit; + InvalidateNeeded := False; for i := 0 to TPropertyEditor(Sender).PropCount - 1 do begin Instance := TPropertyEditor(Sender).GetComponent(i); @@ -2251,6 +2254,7 @@ var i: Integer; temp_menuitem: TMenuItem; begin + Result := Nil; case TheAction of // Insert new AMenuItem after selected AMenuItem 1: begin diff --git a/designer/menueditorform.pas b/designer/menueditorform.pas index 85a6e01f7c..5a5925f924 100644 --- a/designer/menueditorform.pas +++ b/designer/menueditorform.pas @@ -252,6 +252,7 @@ function TMainMenuComponentEditor.GetVerb(Index: Integer): string; begin case Index of 0: Result := lisMenuEditor; + else Result := '';; end; end; diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 5f2dbd58ac..ea398f5b1c 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -1630,6 +1630,8 @@ var BackupFilename, CounterFilename: string; IsPartOfProject: boolean; begin Result:=mrOk; + SubDir:=''; + BackupFilename:=''; if not (FileExistsUTF8(Filename)) then exit; // check if file in lpi IsPartOfProject:=(Project1<>nil) diff --git a/ide/buildmodesmanager.pas b/ide/buildmodesmanager.pas index 4386497db0..ee8d3ebdd4 100644 --- a/ide/buildmodesmanager.pas +++ b/ide/buildmodesmanager.pas @@ -517,8 +517,10 @@ begin CurMode:=fBuildModes[i]; Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1]; end - else + else begin CurMode:=nil; + Identifier:=''; + end; // Dialog caption if Project1<>nil then Caption:=Format(dlgProjectOptionsFor,[Project1.GetTitleOrName]) diff --git a/ide/codehelp.pas b/ide/codehelp.pas index 75715a13ea..a189ac14d1 100644 --- a/ide/codehelp.pas +++ b/ide/codehelp.pas @@ -1548,6 +1548,7 @@ var CurPath: String; p: Integer; begin + Result:=false; if Paths='' then exit; if not IDEMacros.CreateAbsoluteSearchPath(Paths,BaseDir) then exit; //DebugLn(['SearchInPath START ',Paths]); @@ -1566,7 +1567,6 @@ var end; until p>length(Paths); Filename:=''; - Result:=false; end; function CheckUnitOwners(CheckSourceDirectories: boolean; @@ -1987,6 +1987,7 @@ begin Result:=Tool.ExtractSourceName; end else begin while CodeNode<>nil do begin + NodeName:=''; case CodeNode.Desc of ctnVarDefinition: if Tool.NodeIsResultIdentifier(CodeNode) then @@ -2009,7 +2010,6 @@ begin ctnIdentifier: if Tool.NodeIsResultType(CodeNode) then NodeName:='Result'; - else NodeName:=''; end; if NodeName<>'' then begin if Result<>'' then diff --git a/ide/codetoolsdefines.pas b/ide/codetoolsdefines.pas index 939ea5f668..548caec7e9 100644 --- a/ide/codetoolsdefines.pas +++ b/ide/codetoolsdefines.pas @@ -387,7 +387,8 @@ begin else if Sender=InsertAsChildIfDefMenuItem then DefAction:=da_IfDef else if Sender=InsertAsChildIfNotDefMenuItem then DefAction:=da_IfNDef else if Sender=InsertAsChildElseIfMenuItem then DefAction:=da_ElseIf - else if Sender=InsertAsChildElseMenuItem then DefAction:=da_Else; + else if Sender=InsertAsChildElseMenuItem then DefAction:=da_Else + else DefAction:=da_None; InsertNewNode(Behind,DefAction); end; @@ -539,7 +540,8 @@ begin else if Sender=ConvertActionToIfDefMenuItem then NewAction:=da_IfDef else if Sender=ConvertActionToIfNotDefMenuItem then NewAction:=da_IfNDef else if Sender=ConvertActionToElseIfMenuItem then NewAction:=da_ElseIf - else if Sender=ConvertActionToElseMenuItem then NewAction:=da_Else; + else if Sender=ConvertActionToElseMenuItem then NewAction:=da_Else + else NewAction:=da_None; SelDefNode.Action:=NewAction; SetNodeImages(SelTreeNode,false); SetTypeLabel; diff --git a/ide/compiler.pp b/ide/compiler.pp index 501772f6ee..69e1b3e7fd 100644 --- a/ide/compiler.pp +++ b/ide/compiler.pp @@ -898,8 +898,10 @@ begin else Opt1 := ''; end - else + else begin + Opt2 := ''; Opt1 := aDescr; + end; if Opt1 <> '' then // Can be empty when line in help output is split. NewSetElem(Opt1) else if fCompilerOpts.Count > 0 then diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index b182aa06d6..5750784fd6 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -3008,7 +3008,7 @@ begin end; { ------------- Search Paths ---------------- } - + CurOutputDir:=''; if not (ccloNoMacroParams in Flags) then begin // include path @@ -3043,8 +3043,7 @@ begin CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir); if not (ccloAbsolutePaths in Flags) then CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true); - end else - CurOutputDir:=''; + end; if CurOutputDir<>'' then switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir); end; diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index 75c89fabf0..5f320f5095 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -823,6 +823,7 @@ function TCustomFormEditor.CreateNonFormForm(LookupRoot: TComponent): TCustomNon var MediatorClass: TDesignerMediatorClass; begin + Result := Nil; if FindNonFormFormNode(LookupRoot) <> nil then RaiseException(lisCFETCustomFormEditorCreateNonFormFormAlreadyExists); if LookupRoot is TComponent then diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index d3e753708c..4258d5f6ba 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -782,7 +782,7 @@ end; function TDebugManager.DoProjectClose(Sender: TObject; AProject: TLazProject): TModalResult; begin - if AProject<>Project1 then exit; + if AProject<>Project1 then exit(mrCancel); ResetDebugger; Result := mrOK; end; @@ -1368,8 +1368,10 @@ begin end; Editor := nil; - if SourceEditorManager <> nil - then Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename); + if SourceEditorManager <> nil then + Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename) + else + NewSource := Nil; // jump editor to execution line Flags := [jfAddJumpPoint, jfSearchVirtualFullPath]; diff --git a/ide/editormacrolistviewer.pas b/ide/editormacrolistviewer.pas index 9ec2ccf2cc..23d35147fc 100644 --- a/ide/editormacrolistviewer.pas +++ b/ide/editormacrolistviewer.pas @@ -751,9 +751,8 @@ begin then begin FHasError := True; AddError('Wrong amount of param'); - exit; + exit(0); end; - Result := FParams[Index].Num; end; @@ -763,9 +762,8 @@ begin then begin FHasError := True; AddError('Wrong amount of param'); - exit; + exit(''); end; - Result := FParams[Index].Text; end; @@ -774,9 +772,8 @@ begin if (Index < 0) or (Index >= Length(FParams)) then begin FHasError := True; AddError('Wrong amount of param'); - exit; + exit(ptString); // What to return here? end; - Result := FParams[Index].ParamType; end; diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 13c23b9e04..eec98e2936 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -2353,8 +2353,8 @@ var Stream: TLazarusResourceStream; begin FPResource := FindResource(HInstance, PChar(AResName), PChar(RT_RCDATA)); - if FPResource <> 0 then - Stream := TLazarusResourceStream.CreateFromHandle(HInstance, FPResource); + if FPResource = 0 then exit; + Stream := TLazarusResourceStream.CreateFromHandle(HInstance, FPResource); XMLConfig := TRttiXMLConfig.Create(''); XMLConfig.ReadFromStream(Stream); Singleton.RegisterScheme(XMLConfig, ASchemeName, 'Lazarus/ColorSchemes/'); @@ -2568,10 +2568,7 @@ function TEditOptLanguageInfo.SampleLineToAddAttr( Line: Integer): TAdditionalHilightAttribute; begin if Line < 1 then - begin - Result := ahaNone; - exit; - end; + exit(ahaNone); for Result := Low(TAdditionalHilightAttribute) to High(TAdditionalHilightAttribute) do if (Result <> ahaNone) and (AddAttrSampleLines[Result] = Line) then diff --git a/ide/etmessageframe.pas b/ide/etmessageframe.pas index 680018b016..210d7c3591 100644 --- a/ide/etmessageframe.pas +++ b/ide/etmessageframe.pas @@ -1761,6 +1761,7 @@ var begin if GetLineAt(HintInfo^.CursorPos.Y,View,Line) then begin MsgLine:=nil; + s:=''; if Line<0 then s:=GetHeaderText(View) else if Line ignore + exit(nil); // no change => ignore // consistency check if IsCaretInFront(ToPosY,ToPosX,FromPosY,FromPosX) then diff --git a/ide/exttooleditdlg.pas b/ide/exttooleditdlg.pas index 9c807416b9..0c94123899 100644 --- a/ide/exttooleditdlg.pas +++ b/ide/exttooleditdlg.pas @@ -474,7 +474,7 @@ var Src: TExternalUserTools; i: Integer; begin - if Obj=Self then exit; + if Obj=Self then exit(true); if Obj is TExternalUserTools then begin Src:=TExternalUserTools(Obj); Result:=false; diff --git a/ide/findoverloadsdlg.pas b/ide/findoverloadsdlg.pas index c252fe3899..8be1b86e11 100644 --- a/ide/findoverloadsdlg.pas +++ b/ide/findoverloadsdlg.pas @@ -471,7 +471,7 @@ function TFindOverloadsWorker.AddFileToScan(const Filename: string; CheckExtension: boolean): TFOWFile; begin if CheckExtension and (not FilenameIsPascalSource(Filename)) then - exit; + exit(nil); Result:=FindFile(Filename); if Result<>nil then exit; Result:=TFOWFile.Create(Filename); diff --git a/ide/fpdoceditwindow.pas b/ide/fpdoceditwindow.pas index 43eee08c99..0c65d33267 100644 --- a/ide/fpdoceditwindow.pas +++ b/ide/fpdoceditwindow.pas @@ -1056,7 +1056,7 @@ end; function TFPDocEditor.GUIModified: boolean; begin - if fpdefReading in FFlags then exit; + if fpdefReading in FFlags then exit(false); Result:=(ShortEdit.Text<>FOldVisualValues[fpdiShort]) or (LinkEdit.Text<>FOldVisualValues[fpdiElementLink]) or (DescrMemo.Text<>FOldVisualValues[fpdiDescription]) diff --git a/ide/fpdocselectlink.pas b/ide/fpdocselectlink.pas index 8e8205878b..ce3cef95b1 100644 --- a/ide/fpdocselectlink.pas +++ b/ide/fpdocselectlink.pas @@ -441,11 +441,12 @@ begin end; if (ModuleOwner<>nil) and (ModuleOwner<>StartModuleOwner) then begin // different module - if ModuleOwner is TLazProject then begin - ModuleName:=lowercase(ExtractFileNameOnly(TLazProject(ModuleOwner).ProjectInfoFile)); - end else if ModuleOwner is TLazPackage then begin - ModuleName:=TLazPackage(ModuleOwner).Name; - end; + if ModuleOwner is TLazProject then + ModuleName:=lowercase(ExtractFileNameOnly(TLazProject(ModuleOwner).ProjectInfoFile)) + else if ModuleOwner is TLazPackage then + ModuleName:=TLazPackage(ModuleOwner).Name + else + ModuleName:=''; if ModuleName<>'' then ElementName:='#'+ModuleName+'.'+ElementName else diff --git a/ide/frames/compiler_buildmacro_options.pas b/ide/frames/compiler_buildmacro_options.pas index f43a5a80b2..51c9fed9a3 100644 --- a/ide/frames/compiler_buildmacro_options.pas +++ b/ide/frames/compiler_buildmacro_options.pas @@ -399,6 +399,8 @@ function TCompOptBuildMacrosFrame.GetNodeInfo(Node: TTreeNode; case ParentType of cbmntBuildMacro: Result:=cbmntValue; + else + Result:=cbmntNone; end; end; end; diff --git a/ide/frames/editor_color_options.pas b/ide/frames/editor_color_options.pas index 3de4c03ac8..6c5d1bb5bf 100644 --- a/ide/frames/editor_color_options.pas +++ b/ide/frames/editor_color_options.pas @@ -1072,6 +1072,7 @@ begin ColorElementTree.Items.Add(nil, AdditionalHighlightGroupNames[j]); // Fill Attributes in + DefNode := nil; for i := 0 to FCurrentColorScheme.AttributeCount - 1 do begin Attr := FCurrentColorScheme.AttributeAtPos[i]; if Attr.StoredName <> '' then begin diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index a09dcf3d6d..ab71443fa9 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -2603,12 +2603,11 @@ var Count1: Int64; Count2: Int64; begin + Result:=false; if s1.Memory=nil then begin Result:=s2.Memory=nil; end else begin - if s2.Memory=nil then begin - Result:=false; - end else begin + if s2.Memory<>nil then begin p1:=PChar(s1.Memory); p2:=PChar(s2.Memory); Count1:=s1.Size; diff --git a/ide/initialsetupdlgs.pas b/ide/initialsetupdlgs.pas index 451bd43428..c18ae9e98d 100644 --- a/ide/initialsetupdlgs.pas +++ b/ide/initialsetupdlgs.pas @@ -656,6 +656,7 @@ var MsgResult: TModalResult; begin Node:=FirstErrorNode; + s:=''; if Node=TVNodeLazarus then s:=lisWithoutAProperLazarusDirectoryYouWillGetALotOfWarn else if Node=TVNodeCompiler then diff --git a/ide/invertassigntool.pas b/ide/invertassigntool.pas index 63ff6a9802..67e66b54fd 100644 --- a/ide/invertassigntool.pas +++ b/ide/invertassigntool.pas @@ -163,7 +163,7 @@ var HasLinefeed: Boolean; begin if InText = '' then - Exit; + Exit(''); HasLinefeed := InText[Length(InText)] in [#10,#13]; InLines := TStringList.Create; InLines.Text := InText; diff --git a/ide/main.pp b/ide/main.pp index e57af20940..c4353fb5e9 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -1885,7 +1885,7 @@ var begin ActiveSrcEdit:=nil; if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then - Exit; + Exit(False); {$IFDEF IDE_DEBUG} debugln(''); debugln('[TMainIDE.OnPropHookCompatibleMethodExists] ************ ',AMethodName); @@ -11977,7 +11977,7 @@ var begin ActiveSrcEdit:=nil; if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then - Exit; + Exit(False); {$IFDEF IDE_DEBUG} debugln(''); debugln('[TMainIDE.OnPropHookMethodExists] ************ ',AMethodName); diff --git a/ide/mainintf.pas b/ide/mainintf.pas index a4c7bb7676..93b30a00c6 100644 --- a/ide/mainintf.pas +++ b/ide/mainintf.pas @@ -404,6 +404,7 @@ begin else exit(false); end; end; + Result:=true; end; function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY, diff --git a/ide/procedurelist.pas b/ide/procedurelist.pas index 6e6a9c31e5..a678829289 100644 --- a/ide/procedurelist.pas +++ b/ide/procedurelist.pas @@ -171,11 +171,8 @@ var c: Char; i: Integer; begin - if SubStr='' then - begin - Result := true; - end - else + Result := SubStr=''; + if not Result then begin Src := PChar(Str); PFilter := PChar(SubStr); diff --git a/ide/project.pp b/ide/project.pp index 76899267b0..708279da09 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -2271,7 +2271,9 @@ end; function TUnitInfo.AddBookmark(X, Y, ID: integer): integer; begin if FSetBookmarLock = 0 then - Result := Bookmarks.Add(X, Y, ID); + Result := Bookmarks.Add(X, Y, ID) + else + Result := -1; SessionModified := True; Project1.AddBookmark(X, Y, ID, Self); end; @@ -3983,7 +3985,7 @@ var CodeBuf: TCodeBuffer; begin CodeBuf:=GetResourceFile(AnUnitInfo,1); if CodeBuf=nil then begin - if AnUnitInfo.Filename='' then exit; + if AnUnitInfo.Filename='' then exit(''); Result:=ChangeFileExt(AnUnitInfo.Filename,ResourceFileExt); exit; end else @@ -6095,7 +6097,9 @@ var begin MainUnitInfo:=FProject.MainUnitInfo; if (MainUnitInfo<>nil) then - Result:=ExtractFileName(MainUnitInfo.Filename); + Result:=ExtractFileName(MainUnitInfo.Filename) + else + Result:=''; if Result='' then Result:=inherited GetDefaultMainSourceFileName; end; diff --git a/ide/projectdefs.pas b/ide/projectdefs.pas index 6c65c9ad6d..3a9a85d8bb 100644 --- a/ide/projectdefs.pas +++ b/ide/projectdefs.pas @@ -1481,7 +1481,9 @@ function TProjectManualProgramDescriptor.CreateStartFiles(AProject: TLazProject begin if AProject.MainFile<>nil then Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1, - [ofProjectLoading,ofRegularFile]); + [ofProjectLoading,ofRegularFile]) + else + Result:=mrCancel; end; { TProjectEmptyProgramDescriptor } diff --git a/ide/projectresources.pas b/ide/projectresources.pas index 7b1bf77af5..edbbbc1eb3 100644 --- a/ide/projectresources.pas +++ b/ide/projectresources.pas @@ -778,13 +778,12 @@ function TProjectResources.Save(SaveToTestDir: string): Boolean; CodeBuf: TCodeBuffer; TestFilename: String; begin + Result := True; CodeBuf := CodeToolBoss.FindFile(Filename); - if (CodeBuf = nil) or CodeBuf.IsDeleted then - Exit(True); + if (CodeBuf = nil) or CodeBuf.IsDeleted then Exit; if not CodeBuf.IsVirtual then - begin - Result := SaveCodeBuffer(CodeBuf) in [mrOk,mrIgnore]; - end else if SaveToTestDir<>'' then + Result := SaveCodeBuffer(CodeBuf) in [mrOk,mrIgnore] + else if SaveToTestDir<>'' then begin TestFilename := AppendPathDelim(SaveToTestDir) + CodeBuf.Filename; Result := SaveCodeBufferToFile(CodeBuf, TestFilename) in [mrOk, mrIgnore]; diff --git a/ide/searchresultview.pp b/ide/searchresultview.pp index facb3f97a9..d5d3a94700 100644 --- a/ide/searchresultview.pp +++ b/ide/searchresultview.pp @@ -752,16 +752,16 @@ begin PopupMenu := popList; NewTreeView.Canvas.Brush.Color:= clWhite; end;//with + SearchObj:=NewTreeView.SearchObject; + if SearchObj<>nil then begin + SearchObj.SearchString:= SearchText; + SearchObj.ReplaceText := ReplaceText; + SearchObj.SearchDirectories:= ADirectories; + SearchObj.SearchMask:= AMask; + SearchObj.SearchOptions:= TheOptions; + end; + NewTreeView.Skipped:=0; end;//if - SearchObj:=NewTreeView.SearchObject; - if SearchObj<>nil then begin - SearchObj.SearchString:= SearchText; - SearchObj.ReplaceText := ReplaceText; - SearchObj.SearchDirectories:= ADirectories; - SearchObj.SearchMask:= AMask; - SearchObj.SearchOptions:= TheOptions; - end; - NewTreeView.Skipped:=0; Result:= Pages[PageIndex]; SearchInListEdit.Text:=''; SearchInListEdit.Filter:=''; diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas index 4635859847..815a7981fd 100644 --- a/ide/sourcefilemanager.pas +++ b/ide/sourcefilemanager.pas @@ -1226,6 +1226,7 @@ begin CurPath:=AppendPathDelim(ExtractFilePath(FActiveUnitInfo.Filename))+CurPath; end; for c:=0 to 2 do begin + TempFile:=''; // FPC searches first lowercase, then keeping case, then uppercase case c of 0: TempFile:=LowerCase(FFileName); @@ -1755,6 +1756,7 @@ begin // syntax highlighter type NewUnitInfo.DefaultSyntaxHighlighter := FilenameToLazSyntaxHighlighter(NewFilename); + NewSrcEdit := Nil; if nfOpenInEditor in NewFlags then begin // open a new sourceeditor SrcNoteBook := SourceEditorManager.ActiveOrNewSourceWindow; @@ -2101,6 +2103,7 @@ begin end; // b) do actual save + DestFilename := ''; if (sfSaveToTestDir in Flags) or AnUnitInfo.IsVirtual then begin // save source to test directory @@ -2484,7 +2487,7 @@ var SearchPath: String; SearchFile: String; begin - if CompiledSrcExt='' then exit; + if CompiledSrcExt='' then exit(''); // get unit path for compiled units UnitPath:=BaseDir+';'+StartUnitPath; UnitPath:=TrimSearchPath(UnitPath,BaseDir); @@ -3551,7 +3554,7 @@ var begin //debugln('[TLazSourceFileManager.CreateProjectForProgram] A ',ProgramBuf.Filename); if (Project1 <> nil) - and (not MainIDE.DoResetToolStatus([rfInteractive, rfSuccessOnTrigger])) then exit; + and (not MainIDE.DoResetToolStatus([rfInteractive, rfSuccessOnTrigger])) then exit(mrAbort); Result:=SaveProjectIfChanged; if Result=mrAbort then exit; @@ -6989,6 +6992,7 @@ var DestFilename: String; SkipSavingMainSource: Boolean; begin + Result:=mrOk; Project1.ActiveWindowIndexAtStart := SourceEditorManager.ActiveSourceWindowIndex; // update source notebook page names @@ -7023,7 +7027,6 @@ begin AddRecentProjectFileToEnvironment(Project1.ProjectInfoFile); MainIDE.SaveIncludeLinks; MainIDE.UpdateCaption; - if Result=mrAbort then exit; end; // save main source @@ -7062,8 +7065,6 @@ begin end; end; end; - - Result:=mrOk; end; procedure TLazSourceFileManager.GetMainUnit(out MainUnitInfo: TUnitInfo; out diff --git a/ide/sourcesyneditor.pas b/ide/sourcesyneditor.pas index 67d6666082..c2bf4421d5 100644 --- a/ide/sourcesyneditor.pas +++ b/ide/sourcesyneditor.pas @@ -815,6 +815,8 @@ var NewBounds: TSynSearchTermOptsBounds; begin NewTerm := ''; + B1 := False; + B2 := False; if syn.SelAvail and (syn.BlockBegin.y = syn.BlockEnd.y) then begin NewTerm := syn.SelText; LineTxt := syn.Lines[syn.CaretY-1]; diff --git a/ide/unitdependencies.pas b/ide/unitdependencies.pas index 2b63bf6d28..6cd1b7f437 100644 --- a/ide/unitdependencies.pas +++ b/ide/unitdependencies.pas @@ -1043,7 +1043,7 @@ var CurUnit: TUGUnit; ProjFile: TLazProjectFile; begin - if AProject=nil then exit; + if AProject=nil then exit(nil); Result:=Groups.GetGroup(GroupPrefixProject,true); Result.BaseDir:=ExtractFilePath(AProject.ProjectInfoFile); if not FilenameIsAbsolute(Result.BaseDir) then @@ -1070,7 +1070,7 @@ var Filename: String; CurUnit: TUGUnit; begin - if APackage=nil then exit; + if APackage=nil then exit(nil); Result:=Groups.GetGroup(APackage.Name,true); Result.BaseDir:=APackage.DirectoryExpanded; if not FilenameIsAbsolute(Result.BaseDir) then diff --git a/ide/unusedunitsdlg.pas b/ide/unusedunitsdlg.pas index 8da298e7de..a79b78c0d1 100644 --- a/ide/unusedunitsdlg.pas +++ b/ide/unusedunitsdlg.pas @@ -85,6 +85,7 @@ var Code: TCodeBuffer; begin // get cursor position + Result:=mrAbort; SrcEdit:=SourceEditorManagerIntf.ActiveEditor; if SrcEdit=nil then exit; Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); diff --git a/packager/cleanpkgdeps.pas b/packager/cleanpkgdeps.pas index b1fcc4fb76..0a51f94e1f 100644 --- a/packager/cleanpkgdeps.pas +++ b/packager/cleanpkgdeps.pas @@ -369,7 +369,9 @@ begin Result:=TLazPackage(DepOwner).IDAsString else Result:=TLazPackage(DepOwner).Name; - end; + end + else + Result:=''; end; function TCleanPkgDepsDlg.FetchDeletes: TObjectList; diff --git a/packager/oldcustomcompdlg.pas b/packager/oldcustomcompdlg.pas index 63d12d39b9..bf0ba4f41c 100644 --- a/packager/oldcustomcompdlg.pas +++ b/packager/oldcustomcompdlg.pas @@ -430,10 +430,8 @@ var Count: Integer; begin Count := 0; - if MyFile.Count < 0 then begin - Result := 0; - exit; - end; + if MyFile.Count < 0 then + exit(0); for I := 0 to MyFile.Count -1 do begin // find start of TYPE if pos('TYPE', uppercase(MyFile[i])) > 0 then begin @@ -448,12 +446,10 @@ begin if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin // that's it //messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0); - Result := Count; - exit; + exit(Count); end; end; // For J - Result := Count; - exit; + exit(Count); end; // if pos('TYPE'); end; // for I @@ -465,11 +461,10 @@ var TempStr: String; Count: Integer; begin + Result := ''; Count := 0; - if MyFile.Count < 0 then begin - Result := ''; + if MyFile.Count < 0 then exit; - end; for K := 0 to MyFile.Count -1 do begin // find start of TYPE if pos('TYPE', uppercase(MyFile[K])) > 0 then begin @@ -478,20 +473,15 @@ begin (pos('=CLASS', uppercase(MyFile[j])) > 0)) then begin // found one! Count := Count + 1; - if Count = I then begin - TempStr := Trim(copy(MyFile[J],1,pos('=',MyFile[j])-1)); - Result := TempStr; - exit; - end; + if Count = I then + exit(Trim(copy(MyFile[J],1,pos('=',MyFile[j])-1))); end; // if class if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin // that's it //messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0); - Result := ''; exit; end; end; // For J - Result := ''; exit; end; // if pos('TYPE'); end; // for I @@ -503,14 +493,14 @@ var I: Integer; TempStr: String; begin + Result := ''; if MyFile.Count < 1 then exit; for I := 0 to MyFile.Count - 1 do begin if uppercase(copy(MyFile[i],1,4)) = 'UNIT' then begin TempStr := copy(MyFile[i],5,64); TempStr := trim(TempStr); if copy(TempStr,length(TempStr),1) = ';' then TempStr := copy(TempStr,1,length(TempStr)-1); - Result := TempStr; - exit; + exit(TempStr); end; // if UNIT found end; // for I end; diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index 8c282c57fc..bcadedcfab 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -4140,7 +4140,9 @@ end; function TPkgCompilerOptions.GetOwnerName: string; begin if LazPackage<>nil then - Result:=LazPackage.IDAsString; + Result:=LazPackage.IDAsString + else + Result:=''; end; procedure TPkgCompilerOptions.InvalidateOptions; diff --git a/packager/packageeditor.pas b/packager/packageeditor.pas index 02653a3eaf..b717401839 100644 --- a/packager/packageeditor.pas +++ b/packager/packageeditor.pas @@ -2910,6 +2910,7 @@ begin ShortDirectory:=NewDirectory; LazPackage.ShortenFilename(ShortDirectory,true); if ShortDirectory='' then exit; + ShortIncDirectory:=''; LazPackage.LongenFilename(NewDirectory); NewDirectory:=ChompPathDelim(NewDirectory); @@ -3031,6 +3032,7 @@ begin else exit(false); end; end; + Result:=true; end; function TPackageEditorForm.FilesEditTreeView: TTreeView; diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index eb9aeb47e3..b1baa0f14f 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -713,7 +713,7 @@ end; function TLazPkgGraphBuildItem.Add(Tool: TAbstractExternalTool): integer; begin - if Tool=nil then exit; + if Tool=nil then exit(-1); Tool.Reference(Self,'TLazPkgGraphBuildItem.Add'); if Tool.Data is TLazPkgGraphExtToolData then TLazPkgGraphExtToolData(Tool.Data).BuildItem:=Self; diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index 0412d45b41..17cebc51ec 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -3285,6 +3285,7 @@ function TPkgManager.OpenProjectDependencies(AProject: TProject; var BrokenDependencies: TFPList; begin + Result:=mrOk; PackageGraph.OpenRequiredDependencyList(AProject.FirstRequiredDependency); if ReportMissing then begin BrokenDependencies:=PackageGraph.FindAllBrokenDependencies(nil, @@ -3293,8 +3294,7 @@ begin Result:=ShowBrokenDependenciesReport(BrokenDependencies); BrokenDependencies.Free; end; - end else - Result:=mrOk; + end; PkgLinks.SaveUserLinks; end; @@ -5016,6 +5016,7 @@ begin else begin APackage.LPKSource:=nil; APackage.Missing:=true; + Result:=mrCancel; end; debugln(['Hint: (lazarus) [TPkgManager.RevertPackages] AFTER ',PackageGraph.FindPackageWithFilename(Filename)<>nil]); if Result=mrAbort then exit; @@ -5033,7 +5034,7 @@ var HasRegisterProc: Boolean; begin MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo); - if ActiveSourceEditor=nil then exit; + if ActiveSourceEditor=nil then exit(mrAbort); Filename:=ActiveUnitInfo.Filename;