summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-12-01 22:37:25 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-12-01 22:37:25 +0100
commit0b6ab870592194e67dff5cba013d9d32acdf2d48 (patch)
tree654f869a9c69228c16eb8f79292bb3bb97b648b8
parent529fbd9a94fc1c87fe5198066c2ecf34004af356 (diff)
downloadtuxcmd-0b6ab870592194e67dff5cba013d9d32acdf2d48.tar.xz
A better way to escape format string
-rw-r--r--UGnome.pas2
-rw-r--r--UMain.pas2
-rw-r--r--libgtk_kylix/GTKForms.pas2
-rw-r--r--libgtk_kylix/GTKUtils.pas17
4 files changed, 3 insertions, 20 deletions
diff --git a/UGnome.pas b/UGnome.pas
index c0f93b1..adc2fc1 100644
--- a/UGnome.pas
+++ b/UGnome.pas
@@ -1210,7 +1210,7 @@ begin
Exit;
end;
Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
- GTK_BUTTONS_NONE, StringToPgchar(EscapeFormatStr(Text)));
+ GTK_BUTTONS_NONE, '%s', StringToPgchar(Text));
CheckBox := PGtkCheckButton(gtk_check_button_new_with_mnemonic(StringToPgchar(DontShowAgainText)));
gtk_widget_show(PGtkWidget(CheckBox));
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(Dialog).vbox), PGtkWidget(CheckBox), False, False, 12);
diff --git a/UMain.pas b/UMain.pas
index 0950b83..8066949 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -2484,7 +2484,7 @@ begin
else s := Format(LANGFileS, [string(Data^.FDisplayName)]);
smsg := Format(LANGDoYouReallyWantToDeleteTheS, [s]);
end;
- if Application.MessageBox(EscapeFormatStr(smsg), [mbYes, mbNo], mbQuestion, mbNone, mbNo) <> mbYes then Exit;
+ if Application.MessageBox(smsg, [mbYes, mbNo], mbQuestion, mbNone, mbNo) <> mbYes then Exit;
FindNextSelected(ListView, DataList, NextItem1, NextItem2);
AWorkingThread := TWorkerThread.Create;
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index ad623b3..e35357f 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -747,7 +747,7 @@ begin
Exit;
end;
Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
- GTK_BUTTONS_NONE, StringToPgchar(EscapeFormatStr(Text)));
+ GTK_BUTTONS_NONE, '%s', StringToPgchar(Text));
for i := 1 to NumMessageButtons do
if TMessageButton(i - 1) in Buttons
then gtk_dialog_add_button(PGtkDialog(Dialog), MessageButtonID[i], i);
diff --git a/libgtk_kylix/GTKUtils.pas b/libgtk_kylix/GTKUtils.pas
index 288aee3..acc30ca 100644
--- a/libgtk_kylix/GTKUtils.pas
+++ b/libgtk_kylix/GTKUtils.pas
@@ -45,7 +45,6 @@ function GDKColorToPGdkColor(Color: TGDKColor): PGdkColor;
function PGdkColorToGDKColor(Color: PGdkColor): TGDKColor;
function GDKColorToString(Color: TGDKColor): string;
function StringToGDKColor(Str: string; var Color: TGDKColor): boolean;
-function EscapeFormatStr(const Str: string): string;
(********************************************************************************************************************************)
implementation
@@ -208,21 +207,5 @@ begin
end;
(********************************************************************************************************************************)
-function EscapeFormatStr(const Str: string): string;
-var i: integer;
- src: string;
-begin
- src := Str;
- Result := '';
- repeat
- i := Pos('%', src);
- if i > 0 then begin
- Result := Result + Copy(src, 1, i - 1) + '%%';
- src := Copy(src, i + 1, MaxInt);
- end else Result := Result + src;
- until i <= 0;
-end;
-
-(********************************************************************************************************************************)
end.