Fix uninitialized variables and other problems found by the compiler.

git-svn-id: trunk@48451 -
This commit is contained in:
juha 2015-03-22 10:17:35 +00:00
parent 0923ac9836
commit 708afdf966
63 changed files with 146 additions and 137 deletions

View File

@ -273,7 +273,7 @@ end;
function TCustomLEDNumber.GetAbout : string; function TCustomLEDNumber.GetAbout : string;
begin begin
// Result := VpVersionStr; Result := ''; //VpVersionStr;
end; end;
{=====} {=====}

View File

@ -130,11 +130,11 @@ begin
debugln('Source: =================================================='); debugln('Source: ==================================================');
debugln(Src); debugln(Src);
debugln('=========================================================='); debugln('==========================================================');
exit; exit('');
end; end;
if EndPos<1 then begin if EndPos<1 then begin
debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+EndMarker+'" not found']); debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+EndMarker+'" not found']);
exit; exit('');
end; end;
inc(StartPos,length(StartMarker)); inc(StartPos,length(StartMarker));
Result:=UTF8Trim(copy(Src,StartPos,EndPos-StartPos)); Result:=UTF8Trim(copy(Src,StartPos,EndPos-StartPos));

View File

@ -298,8 +298,9 @@ Var
begin begin
I:=FKnownDicts.IndexOf(ADict); I:=FKnownDicts.IndexOf(ADict);
If (I<>-1) then If (I<>-1) then
Result:=(FKnownDicts.Objects[i] as TDDFile).FFileName; Result:=(FKnownDicts.Objects[i] as TDDFile).FFileName
Else
Result:='';
end; end;
{ TDDFile } { TDDFile }

View File

@ -78,7 +78,7 @@ end;
procedure TfpIDEExtEditorInsertFileNameForm.FillFilesList; procedure TfpIDEExtEditorInsertFileNameForm.FillFilesList;
var var
i:integer; i:integer;
S, Ext:string; S:string;
begin begin
LBFiles.Items.Clear; LBFiles.Items.Clear;
if Assigned(LazarusIDE) and Assigned(LazarusIDE.ActiveProject) then if Assigned(LazarusIDE) and Assigned(LazarusIDE.ActiveProject) then

View File

@ -63,8 +63,6 @@ uses strutils;
{ TfpwebNewHTMLListForm } { TfpwebNewHTMLListForm }
function TfpwebNewHTMLListForm.HtmlText: string; function TfpwebNewHTMLListForm.HtmlText: string;
var
i:integer;
begin begin
Result:=DupeString('<li> </li>'+LineEnding, SERows.Value); Result:=DupeString('<li> </li>'+LineEnding, SERows.Value);
if RGStyle.ItemIndex = 0 then if RGStyle.ItemIndex = 0 then

View File

@ -113,6 +113,7 @@ function LoadFastReport3(Report: TfrReport; aFileName: string; out Log:string):
var var
Reader: Tfr3Reader; Reader: Tfr3Reader;
begin begin
Result := 0;
Reader := Tfr3Reader.Create; Reader := Tfr3Reader.Create;
Reader.Report := Report; Reader.Report := Report;
try try
@ -272,7 +273,6 @@ end;
procedure Tfr3Reader.LoadReport(Node: TDOMNode); procedure Tfr3Reader.LoadReport(Node: TDOMNode);
var var
Attr: TDOMNode; Attr: TDOMNode;
S: string;
begin begin
Report.Clear; Report.Clear;
@ -303,7 +303,6 @@ end;
procedure Tfr3Reader.LoadPages(Node: TDOMNode); procedure Tfr3Reader.LoadPages(Node: TDOMNode);
var var
Page: TfrPage;
i: Integer; i: Integer;
begin begin
Node := Node.FirstChild; Node := Node.FirstChild;

View File

@ -238,7 +238,6 @@ end;
procedure TlrCrossViewDataSetProperty.GetValues(Proc: TGetStrProc); procedure TlrCrossViewDataSetProperty.GetValues(Proc: TGetStrProc);
var var
I: Integer; I: Integer;
Values: TStringList;
var var
Lst : TStringList; Lst : TStringList;
begin begin

View File

@ -2924,7 +2924,6 @@ procedure TfrDesignerForm.GetFontList;
var var
DC: HDC; DC: HDC;
Lf: TLogFont; Lf: TLogFont;
S: String;
{$IFDEF USE_PRINTER_FONTS} {$IFDEF USE_PRINTER_FONTS}
Lst: TStrings; Lst: TStrings;
i: Integer; i: Integer;
@ -3259,7 +3258,6 @@ end;
procedure TfrDesignerForm.FilePreviewExecute(Sender: TObject); // preview procedure TfrDesignerForm.FilePreviewExecute(Sender: TObject); // preview
var var
v1, v2: Boolean;
TestRepStream:TMemoryStream; TestRepStream:TMemoryStream;
Rep, SaveR:TfrReport; Rep, SaveR:TfrReport;
@ -6382,8 +6380,6 @@ end;
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
// menu bitmaps // menu bitmaps
procedure TfrDesignerForm.SetMenuBitmaps; procedure TfrDesignerForm.SetMenuBitmaps;
var
i: Integer;
begin begin
MaxItemWidth := 0; MaxShortCutWidth := 0; MaxItemWidth := 0; MaxShortCutWidth := 0;
@ -7771,7 +7767,6 @@ end;
procedure TfrCustomMemoViewDetailReportProperty.GetValues(Proc: TGetStrProc); procedure TfrCustomMemoViewDetailReportProperty.GetValues(Proc: TGetStrProc);
var var
I: Integer; I: Integer;
Values: TStringList;
begin begin
if Assigned(CurReport) then if Assigned(CurReport) then
begin begin
@ -7821,7 +7816,7 @@ end;
procedure TlrInternalTools.InsertDbFields; procedure TlrInternalTools.InsertDbFields;
var var
i, x, y, dx, dy, pdx, adx, tdx, tdy: Integer; i, x, y, dx, dy, pdx, adx: Integer;
HeaderL, DataL: TFpList; HeaderL, DataL: TFpList;
t, t1: TfrView; t, t1: TfrView;
b: TfrBandView; b: TfrBandView;

View File

@ -137,12 +137,6 @@ procedure TfrDesOptionsForm.FillFonts;
var var
DC: HDC; DC: HDC;
Lf: TLogFont; Lf: TLogFont;
S: String;
{$IFDEF USE_PRINTER_FONTS}
Lst: TStrings;
i: Integer;
j: PtrInt;
{$ENDIF}
begin begin
ComboBox1.Clear; ComboBox1.Clear;
DC := GetDC(0); DC := GetDC(0);

View File

@ -213,7 +213,7 @@ end;
function THyphen.BreakWord(Word: string): string; function THyphen.BreakWord(Word: string): string;
var var
i, j: cardinal; i: cardinal;
hyphens: PChar; hyphens: PChar;
rep: PPChar; rep: PPChar;
pos: Pointer; pos: Pointer;
@ -234,10 +234,8 @@ begin
pos := nil; pos := nil;
cut := nil; cut := nil;
try try
if hnj_hyphen_hyphenate2(pdict^, PChar(word), Len, hyphens, nil, if hnj_hyphen_hyphenate2(pdict^, PChar(word), Len, hyphens, nil, rep, pos, cut) = 0 then
rep, pos, cut) = 0 then
begin begin
j := 0;
for i := 1 to length(hyphens)-1 do for i := 1 to length(hyphens)-1 do
if Odd(Ord(hyphens[i])) then begin if Odd(Ord(hyphens[i])) then begin
result := result + chr(i+1); result := result + chr(i+1);

View File

@ -53,7 +53,6 @@ implementation
procedure RegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract); procedure RegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract);
var var
C: Integer;
i: Integer; i: Integer;
begin begin
for i:=0 to lrExportFilters.Count - 1 do for i:=0 to lrExportFilters.Count - 1 do
@ -65,7 +64,6 @@ end;
procedure UnRegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract); procedure UnRegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract);
var var
C: Integer;
i: Integer; i: Integer;
begin begin
i:=lrExportFilters.IndexOf(AFilter); i:=lrExportFilters.IndexOf(AFilter);

View File

@ -287,7 +287,7 @@ function TfrShapeView.GetClipRgn(rt: TfrRgnType): HRGN;
const const
Delta = 10; Delta = 10;
var var
x1, y1, xp, yp : Integer; xp : Integer;
Pts : Array[0..6] of TPoint; Pts : Array[0..6] of TPoint;
min, bx, by, bx1, by1, w1, w2, fw: Integer; min, bx, by, bx1, by1, w1, w2, fw: Integer;
begin begin

View File

@ -390,7 +390,7 @@ end;
procedure frGetDataSetAndField(ComplexName: String; var DataSet: TfrTDataSet; procedure frGetDataSetAndField(ComplexName: String; var DataSet: TfrTDataSet;
out Field: TfrTField); out Field: TfrTField);
var var
n, i, j: Integer; n: Integer;
Owner, Component: TComponent; Owner, Component: TComponent;
s1, s2, s3, s4: String; s1, s2, s3, s4: String;
frDS, F:TfrObject; frDS, F:TfrObject;
@ -1049,7 +1049,7 @@ end;
function UTF8CountWords(const str:string; out WordCount,SpcCount,SpcSize:Integer): TArrUTF8Item; function UTF8CountWords(const str:string; out WordCount,SpcCount,SpcSize:Integer): TArrUTF8Item;
var var
b,i,j,n,len: Integer; b,i,j,len: Integer;
spc: boolean; spc: boolean;
begin begin
i := 1; i := 1;

View File

@ -179,6 +179,7 @@ var
HasChanged: boolean; HasChanged: boolean;
li: TListItem; li: TListItem;
begin begin
HasChanged:=False;
NewEncoding:=NormalizeEncoding(NewEncodingComboBox.Text); NewEncoding:=NormalizeEncoding(NewEncodingComboBox.Text);
PreviewListView.BeginUpdate; PreviewListView.BeginUpdate;
PreviewListView.Items.Clear; PreviewListView.Items.Clear;

View File

@ -475,6 +475,7 @@ var
CommChBeg, CommBeg, CommEnd, i: Integer; // Start and end of comment. CommChBeg, CommBeg, CommEnd, i: Integer; // Start and end of comment.
begin begin
Result:=''; Result:='';
CommBeg:=0;
CommEnd:=Length(aStr); CommEnd:=Length(aStr);
CommChBeg:=PosEx('//', aStr, aPossibleStartPos); CommChBeg:=PosEx('//', aStr, aPossibleStartPos);
if CommChBeg<>0 then if CommChBeg<>0 then

View File

@ -1400,7 +1400,9 @@ begin
else else
AddToProjectLater(aFileName); // Add to project later. AddToProjectLater(aFileName); // Add to project later.
end; end;
end; end
else
Result:=False;
end; end;
function TConvertDelphiProjPack.CheckPackageDep(AUnitName: string): Boolean; function TConvertDelphiProjPack.CheckPackageDep(AUnitName: string): Boolean;

View File

@ -277,7 +277,9 @@ begin
fGrid.Cells[0,GridEndInd]:=AOldIdent; fGrid.Cells[0,GridEndInd]:=AOldIdent;
fGrid.Cells[1,GridEndInd]:=Result; fGrid.Cells[1,GridEndInd]:=Result;
Inc(GridEndInd); Inc(GridEndInd);
end; end
else
Result:='';
end; end;

View File

@ -874,6 +874,7 @@ begin
case ABreakpoint.WatchScope of case ABreakpoint.WatchScope of
wpsGlobal: s:= lisWatchScopeGlobal; wpsGlobal: s:= lisWatchScopeGlobal;
wpsLocal: s:= lisWatchScopeLocal; wpsLocal: s:= lisWatchScopeLocal;
else s := '';
end; end;
s := s +' / '; s := s +' / ';
case ABreakpoint.WatchKind of case ABreakpoint.WatchKind of

View File

@ -1862,7 +1862,7 @@ end;
function TIDEBreakPointGroupList.Add(const AGroup: TIDEBreakPointGroup): Integer; function TIDEBreakPointGroupList.Add(const AGroup: TIDEBreakPointGroup): Integer;
begin begin
if (AGroup = nil) or (IndexOf(AGroup) >= 0) then exit; if (AGroup = nil) or (IndexOf(AGroup) >= 0) then exit(-1);
Result := FList.Add(AGroup); Result := FList.Add(AGroup);
AGroup.AddReference(Self); AGroup.AddReference(Self);
FOwner.DoChanged; FOwner.DoChanged;

View File

@ -95,7 +95,7 @@ begin
case ShowModal of case ShowModal of
mrOk: Result := frOk; mrOk: Result := frOk;
mrCancel: Result := frStop; else {mrCancel:} Result := frStop;
end; end;
end; end;

View File

@ -161,6 +161,7 @@ begin
dcRun: Result := ProcessRun; dcRun: Result := ProcessRun;
dcStop: Result := ProcessStop; dcStop: Result := ProcessStop;
dcEnvironment: Result := ProcessEnvironment(String(APArams[0].VAnsiString), AParams[1].VBoolean); dcEnvironment: Result := ProcessEnvironment(String(APArams[0].VAnsiString), AParams[1].VBoolean);
else Result := False;
end; end;
end; end;

View File

@ -888,6 +888,7 @@ function TSelectedControl.GetWidth: integer;
var var
r: TRect; r: TRect;
begin begin
Result := 0;
if FUseCache then if FUseCache then
Result := FCachedWidth Result := FCachedWidth
else else

View File

@ -3958,7 +3958,6 @@ begin
if ShowAlignComponentsDialog(HorizAlignID,VertAlignID)=mrOk then if ShowAlignComponentsDialog(HorizAlignID,VertAlignID)=mrOk then
begin begin
case HorizAlignID of case HorizAlignID of
0: HorizAlignment:=csaNone;
1: HorizAlignment:=csaSides1; 1: HorizAlignment:=csaSides1;
2: HorizAlignment:=csaCenters; 2: HorizAlignment:=csaCenters;
3: HorizAlignment:=csaSides2; 3: HorizAlignment:=csaSides2;
@ -3966,9 +3965,9 @@ begin
5: HorizAlignment:=csaSpaceEqually; 5: HorizAlignment:=csaSpaceEqually;
6: HorizAlignment:=csaSide1SpaceEqually; 6: HorizAlignment:=csaSide1SpaceEqually;
7: HorizAlignment:=csaSide2SpaceEqually; 7: HorizAlignment:=csaSide2SpaceEqually;
else HorizAlignment:=csaNone; // value=0, this prevents compiler warning.
end; end;
case VertAlignID of case VertAlignID of
0: VertAlignment:=csaNone;
1: VertAlignment:=csaSides1; 1: VertAlignment:=csaSides1;
2: VertAlignment:=csaCenters; 2: VertAlignment:=csaCenters;
3: VertAlignment:=csaSides2; 3: VertAlignment:=csaSides2;
@ -3976,6 +3975,7 @@ begin
5: VertAlignment:=csaSpaceEqually; 5: VertAlignment:=csaSpaceEqually;
6: VertAlignment:=csaSide1SpaceEqually; 6: VertAlignment:=csaSide1SpaceEqually;
7: VertAlignment:=csaSide2SpaceEqually; 7: VertAlignment:=csaSide2SpaceEqually;
else VertAlignment:=csaNone; // value=0, this prevents compiler warning.
end; end;
ControlSelection.AlignComponents(HorizAlignment,VertAlignment); ControlSelection.AlignComponents(HorizAlignment,VertAlignment);
Modified; Modified;
@ -4014,16 +4014,16 @@ begin
if ShowSizeComponentsDialog(HorizSizingID,AWidth,VertSizingID,AHeight) = mrOk then if ShowSizeComponentsDialog(HorizSizingID,AWidth,VertSizingID,AHeight) = mrOk then
begin begin
case HorizSizingID of case HorizSizingID of
0: HorizSizing:=cssNone;
1: HorizSizing:=cssShrinkToSmallest; 1: HorizSizing:=cssShrinkToSmallest;
2: HorizSizing:=cssGrowToLargest; 2: HorizSizing:=cssGrowToLargest;
3: HorizSizing:=cssFixed; 3: HorizSizing:=cssFixed;
else HorizSizing:=cssNone; // value=0, this prevents compiler warning.
end; end;
case VertSizingID of case VertSizingID of
0: VertSizing:=cssNone;
1: VertSizing:=cssShrinkToSmallest; 1: VertSizing:=cssShrinkToSmallest;
2: VertSizing:=cssGrowToLargest; 2: VertSizing:=cssGrowToLargest;
3: VertSizing:=cssFixed; 3: VertSizing:=cssFixed;
else VertSizing:=cssNone; // value=0, this prevents compiler warning.
end; end;
ControlSelection.SizeComponents(HorizSizing,AWidth,VertSizing,AHeight); ControlSelection.SizeComponents(HorizSizing,AWidth,VertSizing,AHeight);
Modified; Modified;

View File

@ -733,7 +733,9 @@ begin
temp_coord:=GetMaxCoordinates(DMenuItem.SubMenu, Max_Width, Max_Height); temp_coord:=GetMaxCoordinates(DMenuItem.SubMenu, Max_Width, Max_Height);
Max_Width:=temp_coord.Right; Max_Width:=temp_coord.Right;
Max_Height:=temp_coord.Bottom; Max_Height:=temp_coord.Bottom;
end; end
else
temp_coord:=Rect(0,0,0,0);
if (DMenuItem.NextItem <> nil) then if (DMenuItem.NextItem <> nil) then
temp_coord:=GetMaxCoordinates(DMenuItem.NextItem, Max_Width, Max_Height); temp_coord:=GetMaxCoordinates(DMenuItem.NextItem, Max_Width, Max_Height);
@ -1779,6 +1781,7 @@ var
DesignerMenuItem: TDesignerMenuItem; DesignerMenuItem: TDesignerMenuItem;
begin begin
if not (Sender is TPropertyEditor) then Exit; if not (Sender is TPropertyEditor) then Exit;
InvalidateNeeded := False;
for i := 0 to TPropertyEditor(Sender).PropCount - 1 do for i := 0 to TPropertyEditor(Sender).PropCount - 1 do
begin begin
Instance := TPropertyEditor(Sender).GetComponent(i); Instance := TPropertyEditor(Sender).GetComponent(i);
@ -2251,6 +2254,7 @@ var
i: Integer; i: Integer;
temp_menuitem: TMenuItem; temp_menuitem: TMenuItem;
begin begin
Result := Nil;
case TheAction of case TheAction of
// Insert new AMenuItem after selected AMenuItem // Insert new AMenuItem after selected AMenuItem
1: begin 1: begin

View File

@ -252,6 +252,7 @@ function TMainMenuComponentEditor.GetVerb(Index: Integer): string;
begin begin
case Index of case Index of
0: Result := lisMenuEditor; 0: Result := lisMenuEditor;
else Result := '';;
end; end;
end; end;

View File

@ -1630,6 +1630,8 @@ var BackupFilename, CounterFilename: string;
IsPartOfProject: boolean; IsPartOfProject: boolean;
begin begin
Result:=mrOk; Result:=mrOk;
SubDir:='';
BackupFilename:='';
if not (FileExistsUTF8(Filename)) then exit; if not (FileExistsUTF8(Filename)) then exit;
// check if file in lpi // check if file in lpi
IsPartOfProject:=(Project1<>nil) IsPartOfProject:=(Project1<>nil)

View File

@ -517,8 +517,10 @@ begin
CurMode:=fBuildModes[i]; CurMode:=fBuildModes[i];
Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1]; Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1];
end end
else else begin
CurMode:=nil; CurMode:=nil;
Identifier:='';
end;
// Dialog caption // Dialog caption
if Project1<>nil then if Project1<>nil then
Caption:=Format(dlgProjectOptionsFor,[Project1.GetTitleOrName]) Caption:=Format(dlgProjectOptionsFor,[Project1.GetTitleOrName])

View File

@ -1548,6 +1548,7 @@ var
CurPath: String; CurPath: String;
p: Integer; p: Integer;
begin begin
Result:=false;
if Paths='' then exit; if Paths='' then exit;
if not IDEMacros.CreateAbsoluteSearchPath(Paths,BaseDir) then exit; if not IDEMacros.CreateAbsoluteSearchPath(Paths,BaseDir) then exit;
//DebugLn(['SearchInPath START ',Paths]); //DebugLn(['SearchInPath START ',Paths]);
@ -1566,7 +1567,6 @@ var
end; end;
until p>length(Paths); until p>length(Paths);
Filename:=''; Filename:='';
Result:=false;
end; end;
function CheckUnitOwners(CheckSourceDirectories: boolean; function CheckUnitOwners(CheckSourceDirectories: boolean;
@ -1987,6 +1987,7 @@ begin
Result:=Tool.ExtractSourceName; Result:=Tool.ExtractSourceName;
end else begin end else begin
while CodeNode<>nil do begin while CodeNode<>nil do begin
NodeName:='';
case CodeNode.Desc of case CodeNode.Desc of
ctnVarDefinition: ctnVarDefinition:
if Tool.NodeIsResultIdentifier(CodeNode) then if Tool.NodeIsResultIdentifier(CodeNode) then
@ -2009,7 +2010,6 @@ begin
ctnIdentifier: ctnIdentifier:
if Tool.NodeIsResultType(CodeNode) then if Tool.NodeIsResultType(CodeNode) then
NodeName:='Result'; NodeName:='Result';
else NodeName:='';
end; end;
if NodeName<>'' then begin if NodeName<>'' then begin
if Result<>'' then if Result<>'' then

View File

@ -387,7 +387,8 @@ begin
else if Sender=InsertAsChildIfDefMenuItem then DefAction:=da_IfDef else if Sender=InsertAsChildIfDefMenuItem then DefAction:=da_IfDef
else if Sender=InsertAsChildIfNotDefMenuItem then DefAction:=da_IfNDef else if Sender=InsertAsChildIfNotDefMenuItem then DefAction:=da_IfNDef
else if Sender=InsertAsChildElseIfMenuItem then DefAction:=da_ElseIf 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); InsertNewNode(Behind,DefAction);
end; end;
@ -539,7 +540,8 @@ begin
else if Sender=ConvertActionToIfDefMenuItem then NewAction:=da_IfDef else if Sender=ConvertActionToIfDefMenuItem then NewAction:=da_IfDef
else if Sender=ConvertActionToIfNotDefMenuItem then NewAction:=da_IfNDef else if Sender=ConvertActionToIfNotDefMenuItem then NewAction:=da_IfNDef
else if Sender=ConvertActionToElseIfMenuItem then NewAction:=da_ElseIf 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; SelDefNode.Action:=NewAction;
SetNodeImages(SelTreeNode,false); SetNodeImages(SelTreeNode,false);
SetTypeLabel; SetTypeLabel;

View File

@ -898,8 +898,10 @@ begin
else else
Opt1 := ''; Opt1 := '';
end end
else else begin
Opt2 := '';
Opt1 := aDescr; Opt1 := aDescr;
end;
if Opt1 <> '' then // Can be empty when line in help output is split. if Opt1 <> '' then // Can be empty when line in help output is split.
NewSetElem(Opt1) NewSetElem(Opt1)
else if fCompilerOpts.Count > 0 then else if fCompilerOpts.Count > 0 then

View File

@ -3008,7 +3008,7 @@ begin
end; end;
{ ------------- Search Paths ---------------- } { ------------- Search Paths ---------------- }
CurOutputDir:='';
if not (ccloNoMacroParams in Flags) then if not (ccloNoMacroParams in Flags) then
begin begin
// include path // include path
@ -3043,8 +3043,7 @@ begin
CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir); CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir);
if not (ccloAbsolutePaths in Flags) then if not (ccloAbsolutePaths in Flags) then
CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true); CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true);
end else end;
CurOutputDir:='';
if CurOutputDir<>'' then if CurOutputDir<>'' then
switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir); switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir);
end; end;

View File

@ -823,6 +823,7 @@ function TCustomFormEditor.CreateNonFormForm(LookupRoot: TComponent): TCustomNon
var var
MediatorClass: TDesignerMediatorClass; MediatorClass: TDesignerMediatorClass;
begin begin
Result := Nil;
if FindNonFormFormNode(LookupRoot) <> nil then if FindNonFormFormNode(LookupRoot) <> nil then
RaiseException(lisCFETCustomFormEditorCreateNonFormFormAlreadyExists); RaiseException(lisCFETCustomFormEditorCreateNonFormFormAlreadyExists);
if LookupRoot is TComponent then if LookupRoot is TComponent then

View File

@ -782,7 +782,7 @@ end;
function TDebugManager.DoProjectClose(Sender: TObject; AProject: TLazProject): TModalResult; function TDebugManager.DoProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
begin begin
if AProject<>Project1 then exit; if AProject<>Project1 then exit(mrCancel);
ResetDebugger; ResetDebugger;
Result := mrOK; Result := mrOK;
end; end;
@ -1368,8 +1368,10 @@ begin
end; end;
Editor := nil; Editor := nil;
if SourceEditorManager <> nil if SourceEditorManager <> nil then
then Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename); Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename)
else
NewSource := Nil;
// jump editor to execution line // jump editor to execution line
Flags := [jfAddJumpPoint, jfSearchVirtualFullPath]; Flags := [jfAddJumpPoint, jfSearchVirtualFullPath];

View File

@ -751,9 +751,8 @@ begin
then begin then begin
FHasError := True; FHasError := True;
AddError('Wrong amount of param'); AddError('Wrong amount of param');
exit; exit(0);
end; end;
Result := FParams[Index].Num; Result := FParams[Index].Num;
end; end;
@ -763,9 +762,8 @@ begin
then begin then begin
FHasError := True; FHasError := True;
AddError('Wrong amount of param'); AddError('Wrong amount of param');
exit; exit('');
end; end;
Result := FParams[Index].Text; Result := FParams[Index].Text;
end; end;
@ -774,9 +772,8 @@ begin
if (Index < 0) or (Index >= Length(FParams)) then begin if (Index < 0) or (Index >= Length(FParams)) then begin
FHasError := True; FHasError := True;
AddError('Wrong amount of param'); AddError('Wrong amount of param');
exit; exit(ptString); // What to return here?
end; end;
Result := FParams[Index].ParamType; Result := FParams[Index].ParamType;
end; end;

View File

@ -2353,8 +2353,8 @@ var
Stream: TLazarusResourceStream; Stream: TLazarusResourceStream;
begin begin
FPResource := FindResource(HInstance, PChar(AResName), PChar(RT_RCDATA)); FPResource := FindResource(HInstance, PChar(AResName), PChar(RT_RCDATA));
if FPResource <> 0 then if FPResource = 0 then exit;
Stream := TLazarusResourceStream.CreateFromHandle(HInstance, FPResource); Stream := TLazarusResourceStream.CreateFromHandle(HInstance, FPResource);
XMLConfig := TRttiXMLConfig.Create(''); XMLConfig := TRttiXMLConfig.Create('');
XMLConfig.ReadFromStream(Stream); XMLConfig.ReadFromStream(Stream);
Singleton.RegisterScheme(XMLConfig, ASchemeName, 'Lazarus/ColorSchemes/'); Singleton.RegisterScheme(XMLConfig, ASchemeName, 'Lazarus/ColorSchemes/');
@ -2568,10 +2568,7 @@ function TEditOptLanguageInfo.SampleLineToAddAttr(
Line: Integer): TAdditionalHilightAttribute; Line: Integer): TAdditionalHilightAttribute;
begin begin
if Line < 1 then if Line < 1 then
begin exit(ahaNone);
Result := ahaNone;
exit;
end;
for Result := Low(TAdditionalHilightAttribute) for Result := Low(TAdditionalHilightAttribute)
to High(TAdditionalHilightAttribute) do to High(TAdditionalHilightAttribute) do
if (Result <> ahaNone) and (AddAttrSampleLines[Result] = Line) then if (Result <> ahaNone) and (AddAttrSampleLines[Result] = Line) then

View File

@ -1761,6 +1761,7 @@ var
begin begin
if GetLineAt(HintInfo^.CursorPos.Y,View,Line) then begin if GetLineAt(HintInfo^.CursorPos.Y,View,Line) then begin
MsgLine:=nil; MsgLine:=nil;
s:='';
if Line<0 then if Line<0 then
s:=GetHeaderText(View) s:=GetHeaderText(View)
else if Line<View.Lines.Count then begin else if Line<View.Lines.Count then begin
@ -3140,7 +3141,7 @@ begin
MinUrgency:=mluHint MinUrgency:=mluHint
else if Sender=MsgFilterDebugMenuItem then else if Sender=MsgFilterDebugMenuItem then
MinUrgency:=mluVerbose3 MinUrgency:=mluVerbose3
else if Sender=MsgFilterNoneMenuItem then else {if Sender=MsgFilterNoneMenuItem then}
MinUrgency:=mluNone; MinUrgency:=mluNone;
MessagesCtrl.ActiveFilter.MinUrgency:=MinUrgency; MessagesCtrl.ActiveFilter.MinUrgency:=MinUrgency;
//debugln(['TMessagesFrame.FilterUrgencyMenuItemClick ',MessageLineUrgencyNames[MinUrgency]]); //debugln(['TMessagesFrame.FilterUrgencyMenuItemClick ',MessageLineUrgencyNames[MinUrgency]]);

View File

@ -883,7 +883,7 @@ begin
{$ENDIF} {$ENDIF}
if (FromPosY=ToPosY) and (FromPosX=ToPosX) then if (FromPosY=ToPosY) and (FromPosX=ToPosX) then
exit; // no change => ignore exit(nil); // no change => ignore
// consistency check // consistency check
if IsCaretInFront(ToPosY,ToPosX,FromPosY,FromPosX) then if IsCaretInFront(ToPosY,ToPosX,FromPosY,FromPosX) then

View File

@ -474,7 +474,7 @@ var
Src: TExternalUserTools; Src: TExternalUserTools;
i: Integer; i: Integer;
begin begin
if Obj=Self then exit; if Obj=Self then exit(true);
if Obj is TExternalUserTools then begin if Obj is TExternalUserTools then begin
Src:=TExternalUserTools(Obj); Src:=TExternalUserTools(Obj);
Result:=false; Result:=false;

View File

@ -471,7 +471,7 @@ function TFindOverloadsWorker.AddFileToScan(const Filename: string;
CheckExtension: boolean): TFOWFile; CheckExtension: boolean): TFOWFile;
begin begin
if CheckExtension and (not FilenameIsPascalSource(Filename)) then if CheckExtension and (not FilenameIsPascalSource(Filename)) then
exit; exit(nil);
Result:=FindFile(Filename); Result:=FindFile(Filename);
if Result<>nil then exit; if Result<>nil then exit;
Result:=TFOWFile.Create(Filename); Result:=TFOWFile.Create(Filename);

View File

@ -1056,7 +1056,7 @@ end;
function TFPDocEditor.GUIModified: boolean; function TFPDocEditor.GUIModified: boolean;
begin begin
if fpdefReading in FFlags then exit; if fpdefReading in FFlags then exit(false);
Result:=(ShortEdit.Text<>FOldVisualValues[fpdiShort]) Result:=(ShortEdit.Text<>FOldVisualValues[fpdiShort])
or (LinkEdit.Text<>FOldVisualValues[fpdiElementLink]) or (LinkEdit.Text<>FOldVisualValues[fpdiElementLink])
or (DescrMemo.Text<>FOldVisualValues[fpdiDescription]) or (DescrMemo.Text<>FOldVisualValues[fpdiDescription])

View File

@ -441,11 +441,12 @@ begin
end; end;
if (ModuleOwner<>nil) and (ModuleOwner<>StartModuleOwner) then begin if (ModuleOwner<>nil) and (ModuleOwner<>StartModuleOwner) then begin
// different module // different module
if ModuleOwner is TLazProject then begin if ModuleOwner is TLazProject then
ModuleName:=lowercase(ExtractFileNameOnly(TLazProject(ModuleOwner).ProjectInfoFile)); ModuleName:=lowercase(ExtractFileNameOnly(TLazProject(ModuleOwner).ProjectInfoFile))
end else if ModuleOwner is TLazPackage then begin else if ModuleOwner is TLazPackage then
ModuleName:=TLazPackage(ModuleOwner).Name; ModuleName:=TLazPackage(ModuleOwner).Name
end; else
ModuleName:='';
if ModuleName<>'' then if ModuleName<>'' then
ElementName:='#'+ModuleName+'.'+ElementName ElementName:='#'+ModuleName+'.'+ElementName
else else

View File

@ -399,6 +399,8 @@ function TCompOptBuildMacrosFrame.GetNodeInfo(Node: TTreeNode;
case ParentType of case ParentType of
cbmntBuildMacro: cbmntBuildMacro:
Result:=cbmntValue; Result:=cbmntValue;
else
Result:=cbmntNone;
end; end;
end; end;
end; end;

View File

@ -1072,6 +1072,7 @@ begin
ColorElementTree.Items.Add(nil, AdditionalHighlightGroupNames[j]); ColorElementTree.Items.Add(nil, AdditionalHighlightGroupNames[j]);
// Fill Attributes in // Fill Attributes in
DefNode := nil;
for i := 0 to FCurrentColorScheme.AttributeCount - 1 do begin for i := 0 to FCurrentColorScheme.AttributeCount - 1 do begin
Attr := FCurrentColorScheme.AttributeAtPos[i]; Attr := FCurrentColorScheme.AttributeAtPos[i];
if Attr.StoredName <> '' then begin if Attr.StoredName <> '' then begin

View File

@ -2603,12 +2603,11 @@ var
Count1: Int64; Count1: Int64;
Count2: Int64; Count2: Int64;
begin begin
Result:=false;
if s1.Memory=nil then begin if s1.Memory=nil then begin
Result:=s2.Memory=nil; Result:=s2.Memory=nil;
end else begin end else begin
if s2.Memory=nil then begin if s2.Memory<>nil then begin
Result:=false;
end else begin
p1:=PChar(s1.Memory); p1:=PChar(s1.Memory);
p2:=PChar(s2.Memory); p2:=PChar(s2.Memory);
Count1:=s1.Size; Count1:=s1.Size;

View File

@ -656,6 +656,7 @@ var
MsgResult: TModalResult; MsgResult: TModalResult;
begin begin
Node:=FirstErrorNode; Node:=FirstErrorNode;
s:='';
if Node=TVNodeLazarus then if Node=TVNodeLazarus then
s:=lisWithoutAProperLazarusDirectoryYouWillGetALotOfWarn s:=lisWithoutAProperLazarusDirectoryYouWillGetALotOfWarn
else if Node=TVNodeCompiler then else if Node=TVNodeCompiler then

View File

@ -163,7 +163,7 @@ var
HasLinefeed: Boolean; HasLinefeed: Boolean;
begin begin
if InText = '' then if InText = '' then
Exit; Exit('');
HasLinefeed := InText[Length(InText)] in [#10,#13]; HasLinefeed := InText[Length(InText)] in [#10,#13];
InLines := TStringList.Create; InLines := TStringList.Create;
InLines.Text := InText; InLines.Text := InText;

View File

@ -1885,7 +1885,7 @@ var
begin begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
Exit; Exit(False);
{$IFDEF IDE_DEBUG} {$IFDEF IDE_DEBUG}
debugln(''); debugln('');
debugln('[TMainIDE.OnPropHookCompatibleMethodExists] ************ ',AMethodName); debugln('[TMainIDE.OnPropHookCompatibleMethodExists] ************ ',AMethodName);
@ -11977,7 +11977,7 @@ var
begin begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
Exit; Exit(False);
{$IFDEF IDE_DEBUG} {$IFDEF IDE_DEBUG}
debugln(''); debugln('');
debugln('[TMainIDE.OnPropHookMethodExists] ************ ',AMethodName); debugln('[TMainIDE.OnPropHookMethodExists] ************ ',AMethodName);

View File

@ -404,6 +404,7 @@ begin
else exit(false); else exit(false);
end; end;
end; end;
Result:=true;
end; end;
function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY, function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY,

View File

@ -171,11 +171,8 @@ var
c: Char; c: Char;
i: Integer; i: Integer;
begin begin
if SubStr='' then Result := SubStr='';
begin if not Result then
Result := true;
end
else
begin begin
Src := PChar(Str); Src := PChar(Str);
PFilter := PChar(SubStr); PFilter := PChar(SubStr);

View File

@ -2271,7 +2271,9 @@ end;
function TUnitInfo.AddBookmark(X, Y, ID: integer): integer; function TUnitInfo.AddBookmark(X, Y, ID: integer): integer;
begin begin
if FSetBookmarLock = 0 then if FSetBookmarLock = 0 then
Result := Bookmarks.Add(X, Y, ID); Result := Bookmarks.Add(X, Y, ID)
else
Result := -1;
SessionModified := True; SessionModified := True;
Project1.AddBookmark(X, Y, ID, Self); Project1.AddBookmark(X, Y, ID, Self);
end; end;
@ -3983,7 +3985,7 @@ var CodeBuf: TCodeBuffer;
begin begin
CodeBuf:=GetResourceFile(AnUnitInfo,1); CodeBuf:=GetResourceFile(AnUnitInfo,1);
if CodeBuf=nil then begin if CodeBuf=nil then begin
if AnUnitInfo.Filename='' then exit; if AnUnitInfo.Filename='' then exit('');
Result:=ChangeFileExt(AnUnitInfo.Filename,ResourceFileExt); Result:=ChangeFileExt(AnUnitInfo.Filename,ResourceFileExt);
exit; exit;
end else end else
@ -6095,7 +6097,9 @@ var
begin begin
MainUnitInfo:=FProject.MainUnitInfo; MainUnitInfo:=FProject.MainUnitInfo;
if (MainUnitInfo<>nil) then if (MainUnitInfo<>nil) then
Result:=ExtractFileName(MainUnitInfo.Filename); Result:=ExtractFileName(MainUnitInfo.Filename)
else
Result:='';
if Result='' then if Result='' then
Result:=inherited GetDefaultMainSourceFileName; Result:=inherited GetDefaultMainSourceFileName;
end; end;

View File

@ -1481,7 +1481,9 @@ function TProjectManualProgramDescriptor.CreateStartFiles(AProject: TLazProject
begin begin
if AProject.MainFile<>nil then if AProject.MainFile<>nil then
Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1, Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1,
[ofProjectLoading,ofRegularFile]); [ofProjectLoading,ofRegularFile])
else
Result:=mrCancel;
end; end;
{ TProjectEmptyProgramDescriptor } { TProjectEmptyProgramDescriptor }

View File

@ -778,13 +778,12 @@ function TProjectResources.Save(SaveToTestDir: string): Boolean;
CodeBuf: TCodeBuffer; CodeBuf: TCodeBuffer;
TestFilename: String; TestFilename: String;
begin begin
Result := True;
CodeBuf := CodeToolBoss.FindFile(Filename); CodeBuf := CodeToolBoss.FindFile(Filename);
if (CodeBuf = nil) or CodeBuf.IsDeleted then if (CodeBuf = nil) or CodeBuf.IsDeleted then Exit;
Exit(True);
if not CodeBuf.IsVirtual then if not CodeBuf.IsVirtual then
begin Result := SaveCodeBuffer(CodeBuf) in [mrOk,mrIgnore]
Result := SaveCodeBuffer(CodeBuf) in [mrOk,mrIgnore]; else if SaveToTestDir<>'' then
end else if SaveToTestDir<>'' then
begin begin
TestFilename := AppendPathDelim(SaveToTestDir) + CodeBuf.Filename; TestFilename := AppendPathDelim(SaveToTestDir) + CodeBuf.Filename;
Result := SaveCodeBufferToFile(CodeBuf, TestFilename) in [mrOk, mrIgnore]; Result := SaveCodeBufferToFile(CodeBuf, TestFilename) in [mrOk, mrIgnore];

View File

@ -752,16 +752,16 @@ begin
PopupMenu := popList; PopupMenu := popList;
NewTreeView.Canvas.Brush.Color:= clWhite; NewTreeView.Canvas.Brush.Color:= clWhite;
end;//with 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 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]; Result:= Pages[PageIndex];
SearchInListEdit.Text:=''; SearchInListEdit.Text:='';
SearchInListEdit.Filter:=''; SearchInListEdit.Filter:='';

View File

@ -1226,6 +1226,7 @@ begin
CurPath:=AppendPathDelim(ExtractFilePath(FActiveUnitInfo.Filename))+CurPath; CurPath:=AppendPathDelim(ExtractFilePath(FActiveUnitInfo.Filename))+CurPath;
end; end;
for c:=0 to 2 do begin for c:=0 to 2 do begin
TempFile:='';
// FPC searches first lowercase, then keeping case, then uppercase // FPC searches first lowercase, then keeping case, then uppercase
case c of case c of
0: TempFile:=LowerCase(FFileName); 0: TempFile:=LowerCase(FFileName);
@ -1755,6 +1756,7 @@ begin
// syntax highlighter type // syntax highlighter type
NewUnitInfo.DefaultSyntaxHighlighter := FilenameToLazSyntaxHighlighter(NewFilename); NewUnitInfo.DefaultSyntaxHighlighter := FilenameToLazSyntaxHighlighter(NewFilename);
NewSrcEdit := Nil;
if nfOpenInEditor in NewFlags then begin if nfOpenInEditor in NewFlags then begin
// open a new sourceeditor // open a new sourceeditor
SrcNoteBook := SourceEditorManager.ActiveOrNewSourceWindow; SrcNoteBook := SourceEditorManager.ActiveOrNewSourceWindow;
@ -2101,6 +2103,7 @@ begin
end; end;
// b) do actual save // b) do actual save
DestFilename := '';
if (sfSaveToTestDir in Flags) or AnUnitInfo.IsVirtual then if (sfSaveToTestDir in Flags) or AnUnitInfo.IsVirtual then
begin begin
// save source to test directory // save source to test directory
@ -2484,7 +2487,7 @@ var
SearchPath: String; SearchPath: String;
SearchFile: String; SearchFile: String;
begin begin
if CompiledSrcExt='' then exit; if CompiledSrcExt='' then exit('');
// get unit path for compiled units // get unit path for compiled units
UnitPath:=BaseDir+';'+StartUnitPath; UnitPath:=BaseDir+';'+StartUnitPath;
UnitPath:=TrimSearchPath(UnitPath,BaseDir); UnitPath:=TrimSearchPath(UnitPath,BaseDir);
@ -3551,7 +3554,7 @@ var
begin begin
//debugln('[TLazSourceFileManager.CreateProjectForProgram] A ',ProgramBuf.Filename); //debugln('[TLazSourceFileManager.CreateProjectForProgram] A ',ProgramBuf.Filename);
if (Project1 <> nil) if (Project1 <> nil)
and (not MainIDE.DoResetToolStatus([rfInteractive, rfSuccessOnTrigger])) then exit; and (not MainIDE.DoResetToolStatus([rfInteractive, rfSuccessOnTrigger])) then exit(mrAbort);
Result:=SaveProjectIfChanged; Result:=SaveProjectIfChanged;
if Result=mrAbort then exit; if Result=mrAbort then exit;
@ -6989,6 +6992,7 @@ var
DestFilename: String; DestFilename: String;
SkipSavingMainSource: Boolean; SkipSavingMainSource: Boolean;
begin begin
Result:=mrOk;
Project1.ActiveWindowIndexAtStart := SourceEditorManager.ActiveSourceWindowIndex; Project1.ActiveWindowIndexAtStart := SourceEditorManager.ActiveSourceWindowIndex;
// update source notebook page names // update source notebook page names
@ -7023,7 +7027,6 @@ begin
AddRecentProjectFileToEnvironment(Project1.ProjectInfoFile); AddRecentProjectFileToEnvironment(Project1.ProjectInfoFile);
MainIDE.SaveIncludeLinks; MainIDE.SaveIncludeLinks;
MainIDE.UpdateCaption; MainIDE.UpdateCaption;
if Result=mrAbort then exit;
end; end;
// save main source // save main source
@ -7062,8 +7065,6 @@ begin
end; end;
end; end;
end; end;
Result:=mrOk;
end; end;
procedure TLazSourceFileManager.GetMainUnit(out MainUnitInfo: TUnitInfo; out procedure TLazSourceFileManager.GetMainUnit(out MainUnitInfo: TUnitInfo; out

View File

@ -815,6 +815,8 @@ var
NewBounds: TSynSearchTermOptsBounds; NewBounds: TSynSearchTermOptsBounds;
begin begin
NewTerm := ''; NewTerm := '';
B1 := False;
B2 := False;
if syn.SelAvail and (syn.BlockBegin.y = syn.BlockEnd.y) then begin if syn.SelAvail and (syn.BlockBegin.y = syn.BlockEnd.y) then begin
NewTerm := syn.SelText; NewTerm := syn.SelText;
LineTxt := syn.Lines[syn.CaretY-1]; LineTxt := syn.Lines[syn.CaretY-1];

View File

@ -1043,7 +1043,7 @@ var
CurUnit: TUGUnit; CurUnit: TUGUnit;
ProjFile: TLazProjectFile; ProjFile: TLazProjectFile;
begin begin
if AProject=nil then exit; if AProject=nil then exit(nil);
Result:=Groups.GetGroup(GroupPrefixProject,true); Result:=Groups.GetGroup(GroupPrefixProject,true);
Result.BaseDir:=ExtractFilePath(AProject.ProjectInfoFile); Result.BaseDir:=ExtractFilePath(AProject.ProjectInfoFile);
if not FilenameIsAbsolute(Result.BaseDir) then if not FilenameIsAbsolute(Result.BaseDir) then
@ -1070,7 +1070,7 @@ var
Filename: String; Filename: String;
CurUnit: TUGUnit; CurUnit: TUGUnit;
begin begin
if APackage=nil then exit; if APackage=nil then exit(nil);
Result:=Groups.GetGroup(APackage.Name,true); Result:=Groups.GetGroup(APackage.Name,true);
Result.BaseDir:=APackage.DirectoryExpanded; Result.BaseDir:=APackage.DirectoryExpanded;
if not FilenameIsAbsolute(Result.BaseDir) then if not FilenameIsAbsolute(Result.BaseDir) then

View File

@ -85,6 +85,7 @@ var
Code: TCodeBuffer; Code: TCodeBuffer;
begin begin
// get cursor position // get cursor position
Result:=mrAbort;
SrcEdit:=SourceEditorManagerIntf.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);

View File

@ -369,7 +369,9 @@ begin
Result:=TLazPackage(DepOwner).IDAsString Result:=TLazPackage(DepOwner).IDAsString
else else
Result:=TLazPackage(DepOwner).Name; Result:=TLazPackage(DepOwner).Name;
end; end
else
Result:='';
end; end;
function TCleanPkgDepsDlg.FetchDeletes: TObjectList; function TCleanPkgDepsDlg.FetchDeletes: TObjectList;

View File

@ -430,10 +430,8 @@ var
Count: Integer; Count: Integer;
begin begin
Count := 0; Count := 0;
if MyFile.Count < 0 then begin if MyFile.Count < 0 then
Result := 0; exit(0);
exit;
end;
for I := 0 to MyFile.Count -1 do begin for I := 0 to MyFile.Count -1 do begin
// find start of TYPE // find start of TYPE
if pos('TYPE', uppercase(MyFile[i])) > 0 then begin if pos('TYPE', uppercase(MyFile[i])) > 0 then begin
@ -448,12 +446,10 @@ begin
if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin
// that's it // that's it
//messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0); //messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0);
Result := Count; exit(Count);
exit;
end; end;
end; // For J end; // For J
Result := Count; exit(Count);
exit;
end; // if pos('TYPE'); end; // if pos('TYPE');
end; // for I end; // for I
@ -465,11 +461,10 @@ var
TempStr: String; TempStr: String;
Count: Integer; Count: Integer;
begin begin
Result := '';
Count := 0; Count := 0;
if MyFile.Count < 0 then begin if MyFile.Count < 0 then
Result := '';
exit; exit;
end;
for K := 0 to MyFile.Count -1 do begin for K := 0 to MyFile.Count -1 do begin
// find start of TYPE // find start of TYPE
if pos('TYPE', uppercase(MyFile[K])) > 0 then begin if pos('TYPE', uppercase(MyFile[K])) > 0 then begin
@ -478,20 +473,15 @@ begin
(pos('=CLASS', uppercase(MyFile[j])) > 0)) then begin (pos('=CLASS', uppercase(MyFile[j])) > 0)) then begin
// found one! // found one!
Count := Count + 1; Count := Count + 1;
if Count = I then begin if Count = I then
TempStr := Trim(copy(MyFile[J],1,pos('=',MyFile[j])-1)); exit(Trim(copy(MyFile[J],1,pos('=',MyFile[j])-1)));
Result := TempStr;
exit;
end;
end; // if class end; // if class
if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin
// that's it // that's it
//messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0); //messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0);
Result := '';
exit; exit;
end; end;
end; // For J end; // For J
Result := '';
exit; exit;
end; // if pos('TYPE'); end; // if pos('TYPE');
end; // for I end; // for I
@ -503,14 +493,14 @@ var
I: Integer; I: Integer;
TempStr: String; TempStr: String;
begin begin
Result := '';
if MyFile.Count < 1 then exit; if MyFile.Count < 1 then exit;
for I := 0 to MyFile.Count - 1 do begin for I := 0 to MyFile.Count - 1 do begin
if uppercase(copy(MyFile[i],1,4)) = 'UNIT' then begin if uppercase(copy(MyFile[i],1,4)) = 'UNIT' then begin
TempStr := copy(MyFile[i],5,64); TempStr := copy(MyFile[i],5,64);
TempStr := trim(TempStr); TempStr := trim(TempStr);
if copy(TempStr,length(TempStr),1) = ';' then TempStr := copy(TempStr,1,length(TempStr)-1); if copy(TempStr,length(TempStr),1) = ';' then TempStr := copy(TempStr,1,length(TempStr)-1);
Result := TempStr; exit(TempStr);
exit;
end; // if UNIT found end; // if UNIT found
end; // for I end; // for I
end; end;

View File

@ -4140,7 +4140,9 @@ end;
function TPkgCompilerOptions.GetOwnerName: string; function TPkgCompilerOptions.GetOwnerName: string;
begin begin
if LazPackage<>nil then if LazPackage<>nil then
Result:=LazPackage.IDAsString; Result:=LazPackage.IDAsString
else
Result:='';
end; end;
procedure TPkgCompilerOptions.InvalidateOptions; procedure TPkgCompilerOptions.InvalidateOptions;

View File

@ -2910,6 +2910,7 @@ begin
ShortDirectory:=NewDirectory; ShortDirectory:=NewDirectory;
LazPackage.ShortenFilename(ShortDirectory,true); LazPackage.ShortenFilename(ShortDirectory,true);
if ShortDirectory='' then exit; if ShortDirectory='' then exit;
ShortIncDirectory:='';
LazPackage.LongenFilename(NewDirectory); LazPackage.LongenFilename(NewDirectory);
NewDirectory:=ChompPathDelim(NewDirectory); NewDirectory:=ChompPathDelim(NewDirectory);
@ -3031,6 +3032,7 @@ begin
else exit(false); else exit(false);
end; end;
end; end;
Result:=true;
end; end;
function TPackageEditorForm.FilesEditTreeView: TTreeView; function TPackageEditorForm.FilesEditTreeView: TTreeView;

View File

@ -713,7 +713,7 @@ end;
function TLazPkgGraphBuildItem.Add(Tool: TAbstractExternalTool): integer; function TLazPkgGraphBuildItem.Add(Tool: TAbstractExternalTool): integer;
begin begin
if Tool=nil then exit; if Tool=nil then exit(-1);
Tool.Reference(Self,'TLazPkgGraphBuildItem.Add'); Tool.Reference(Self,'TLazPkgGraphBuildItem.Add');
if Tool.Data is TLazPkgGraphExtToolData then if Tool.Data is TLazPkgGraphExtToolData then
TLazPkgGraphExtToolData(Tool.Data).BuildItem:=Self; TLazPkgGraphExtToolData(Tool.Data).BuildItem:=Self;

View File

@ -3285,6 +3285,7 @@ function TPkgManager.OpenProjectDependencies(AProject: TProject;
var var
BrokenDependencies: TFPList; BrokenDependencies: TFPList;
begin begin
Result:=mrOk;
PackageGraph.OpenRequiredDependencyList(AProject.FirstRequiredDependency); PackageGraph.OpenRequiredDependencyList(AProject.FirstRequiredDependency);
if ReportMissing then begin if ReportMissing then begin
BrokenDependencies:=PackageGraph.FindAllBrokenDependencies(nil, BrokenDependencies:=PackageGraph.FindAllBrokenDependencies(nil,
@ -3293,8 +3294,7 @@ begin
Result:=ShowBrokenDependenciesReport(BrokenDependencies); Result:=ShowBrokenDependenciesReport(BrokenDependencies);
BrokenDependencies.Free; BrokenDependencies.Free;
end; end;
end else end;
Result:=mrOk;
PkgLinks.SaveUserLinks; PkgLinks.SaveUserLinks;
end; end;
@ -5016,6 +5016,7 @@ begin
else begin else begin
APackage.LPKSource:=nil; APackage.LPKSource:=nil;
APackage.Missing:=true; APackage.Missing:=true;
Result:=mrCancel;
end; end;
debugln(['Hint: (lazarus) [TPkgManager.RevertPackages] AFTER ',PackageGraph.FindPackageWithFilename(Filename)<>nil]); debugln(['Hint: (lazarus) [TPkgManager.RevertPackages] AFTER ',PackageGraph.FindPackageWithFilename(Filename)<>nil]);
if Result=mrAbort then exit; if Result=mrAbort then exit;
@ -5033,7 +5034,7 @@ var
HasRegisterProc: Boolean; HasRegisterProc: Boolean;
begin begin
MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo); MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo);
if ActiveSourceEditor=nil then exit; if ActiveSourceEditor=nil then exit(mrAbort);
Filename:=ActiveUnitInfo.Filename; Filename:=ActiveUnitInfo.Filename;