LCL: raise exception if bitmap is not completely written to disk (bug #8260)

git-svn-id: trunk@11392 -
This commit is contained in:
vincents 2007-06-27 11:01:23 +00:00
parent ea4b652818
commit 296e81dda3
20 changed files with 77 additions and 7 deletions

View File

@ -34,8 +34,9 @@ interface
uses uses
SysUtils, Math, Types, Classes, Contnrs, FPCAdds, SysUtils, Math, Types, Classes, Contnrs, FPCAdds,
FPImage, FPReadPNG, FPWritePNG, FPReadBMP, FPWriteBMP, FPReadPNM, FPWritePNM, FPImgCmn, FPImage, FPCanvas,
IntfGraphics, FPCanvas, FPReadPNG, FPWritePNG, FPReadBMP, FPWriteBMP, FPReadPNM, FPWritePNM,
IntfGraphics,
AvgLvlTree, AvgLvlTree,
LCLStrConsts, LCLType, LCLProc, LMessages, LCLIntf, LResources, LCLResCache, LCLStrConsts, LCLType, LCLProc, LMessages, LCLIntf, LResources, LCLResCache,
GraphType, GraphMath, InterfaceBase; GraphType, GraphMath, InterfaceBase;

View File

@ -814,12 +814,16 @@ procedure TBitmap.WriteStreamWithFPImage(Stream: TStream; WriteSize: boolean;
end; end;
procedure DoWriteOriginal; procedure DoWriteOriginal;
var
BytesWritten: Int64;
begin begin
DoWriteStreamSize(Stream, NtoLE(LongInt(FImage.SaveStream.Size))); DoWriteStreamSize(Stream, NtoLE(LongInt(FImage.SaveStream.Size)));
FImage.SaveStream.Position:=0; FImage.SaveStream.Position:=0;
if Stream is TMemoryStream then if Stream is TMemoryStream then
TMemoryStream(Stream).SetSize(Stream.Position+FImage.SaveStream.Size); TMemoryStream(Stream).SetSize(Stream.Position+FImage.SaveStream.Size);
Stream.CopyFrom(FImage.SaveStream,FImage.SaveStream.Size); BytesWritten:=Stream.CopyFrom(FImage.SaveStream,FImage.SaveStream.Size);
if BytesWritten<>FImage.SaveStream.Size then
raise FPImageException.Create(rsErrorWhileSavingBitmap);
end; end;
var var

View File

@ -482,22 +482,22 @@ end;
procedure NotifyUser(const DialogMessage : String; DialogType : longint); procedure NotifyUser(const DialogMessage : String; DialogType : longint);
begin begin
PromptUser(DialogMessage, DialogType, [idButtonOK], -1, -1); PromptUser(DialogMessage, DialogType, [idButtonOK], 0, -1);
end; end;
procedure NotifyUser(const DialogCaption, DialogMessage : String; DialogType : longint); procedure NotifyUser(const DialogCaption, DialogMessage : String; DialogType : longint);
begin begin
PromptUser(DialogCaption, DialogMessage, DialogType, [idButtonOK], -1, -1); PromptUser(DialogCaption, DialogMessage, DialogType, [idButtonOK], 0, -1);
end; end;
procedure NotifyUserAtXY(const DialogMessage : String; DialogType : longint; X, Y : Longint); procedure NotifyUserAtXY(const DialogMessage : String; DialogType : longint; X, Y : Longint);
begin begin
PromptUserAtXY(DialogMessage, DialogType, [idButtonOK], -1, -1, X, Y); PromptUserAtXY(DialogMessage, DialogType, [idButtonOK], 0, -1, X, Y);
end; end;
procedure NotifyUserAtXY(const DialogCaption, DialogMessage : String; DialogType : longint; X, Y : Longint); procedure NotifyUserAtXY(const DialogCaption, DialogMessage : String; DialogType : longint; X, Y : Longint);
begin begin
PromptUserAtXY(DialogCaption, DialogMessage, DialogType, [idButtonOK], -1, -1, X, Y); PromptUserAtXY(DialogCaption, DialogMessage, DialogType, [idButtonOK], 0, -1, X, Y);
end; end;
function PromptUser(const DialogMessage : String; DialogType : longint; Buttons : Array of Longint; function PromptUser(const DialogMessage : String; DialogType : longint; Buttons : Array of Longint;

View File

@ -289,6 +289,10 @@ msgstr ""
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "" msgstr ""

View File

@ -292,6 +292,10 @@ msgstr "Fehler beim Lesen %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Fehler beim Ausführen von %s%s%s:%s%s" msgstr "Fehler beim Ausführen von %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Fehler:" msgstr "Fehler:"

View File

@ -288,6 +288,10 @@ msgstr "Error leyendo %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Error:" msgstr "Error:"

View File

@ -278,6 +278,10 @@ msgstr ""
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Virhe:" msgstr "Virhe:"

View File

@ -290,6 +290,10 @@ msgstr "Erreur de lecture %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Erreur en exécutant %s%s%s:%s%s" msgstr "Erreur en exécutant %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Erreur:" msgstr "Erreur:"

View File

@ -291,6 +291,10 @@ msgstr "Kesalahan pembacaan %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Kesalahan saat mengeksekusi %s%s%s:%s%s" msgstr "Kesalahan saat mengeksekusi %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Kesalahan:" msgstr "Kesalahan:"

View File

@ -288,6 +288,10 @@ msgstr "Errore nella lettura di %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Errore eseguendo %s%s%s:%s%s" msgstr "Errore eseguendo %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Errore:" msgstr "Errore:"

View File

@ -278,6 +278,10 @@ msgstr "Fout tijdens het lezen %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Fout:" msgstr "Fout:"

View File

@ -278,6 +278,10 @@ msgstr "Erro na leitura %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Erro ao executar %s%s%s:%s%s" msgstr "Erro ao executar %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Erro:" msgstr "Erro:"

View File

@ -293,6 +293,10 @@ msgstr "Błąd odczytu %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Błąd:" msgstr "Błąd:"

View File

@ -289,6 +289,10 @@ msgstr "B
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "B³±d:" msgstr "B³±d:"

View File

@ -289,6 +289,10 @@ msgstr "B
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "B³¹d:" msgstr "B³¹d:"

View File

@ -278,6 +278,10 @@ msgstr ""
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "" msgstr ""

View File

@ -289,6 +289,10 @@ msgstr "Ошибка чтения %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "Ошибка при выполнении %s%s%s:%s%s" msgstr "Ошибка при выполнении %s%s%s:%s%s"
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Ошибка:" msgstr "Ошибка:"

View File

@ -278,6 +278,10 @@ msgstr "Помилка читання %s%s%s: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "" msgstr ""
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "Помилка:" msgstr "Помилка:"

View File

@ -291,6 +291,10 @@ msgstr "读取 %s%s%s 错误: %s"
msgid "Error while executing %s%s%s:%s%s" msgid "Error while executing %s%s%s:%s%s"
msgstr "当执行 %s%s%s 时错误:%s%s " msgstr "当执行 %s%s%s 时错误:%s%s "
#: lclstrconsts:rserrorwhilesavingbitmap
msgid "Error while saving bitmap."
msgstr ""
#: lclstrconsts:rswin32error #: lclstrconsts:rswin32error
msgid "Error:" msgid "Error:"
msgstr "错误:" msgstr "错误:"

View File

@ -184,6 +184,7 @@ ResourceString
rsIsAlreadyAssociatedWith = '%s is already associated with %s'; rsIsAlreadyAssociatedWith = '%s is already associated with %s';
rsCanvasDoesNotAllowDrawing = 'Canvas does not allow drawing'; rsCanvasDoesNotAllowDrawing = 'Canvas does not allow drawing';
rsUnsupportedBitmapFormat = 'Unsupported bitmap format.'; rsUnsupportedBitmapFormat = 'Unsupported bitmap format.';
rsErrorWhileSavingBitmap = 'Error while saving bitmap.';
rsNoWidgetSet = 'No widgetset object. ' rsNoWidgetSet = 'No widgetset object. '
+'Plz check if the unit "interfaces" was added to the programs uses clause.'; +'Plz check if the unit "interfaces" was added to the programs uses clause.';
rsPressOkToIgnoreAndRiskDataCorruptionPressCancelToK = '%s%sPress Ok to ' rsPressOkToIgnoreAndRiskDataCorruptionPressCancelToK = '%s%sPress Ok to '