[fpc-devel] TFileStream problem with bigger file (> GB)?

2010-03-09 Thread Martin
I have a strange issue with TFileStream, just wondering if anything is 
known...


The function below is supposed to read the first (up to) 5000 bytes of a 
file. It works fine on "normal" sized files.


But I have a couple of files between 3 and 8 GB in size, and for those 
files read just returns buf filled with zeros.
The output shows, that fs.read returns 5000, that is it claims that the 
full amount has been read.
Smaller files on the same filesystem do work. there are no spaces in the 
filename or directory.


This happens on windows, fpc from trunc (older and today).


function TFileInfo.GetChecksum: Integer;
const
  PRE_READ_SIZE = 5000;
var
  c, i: Integer;
  fs: TFileStream;
  buf: Array [0..PRE_READ_SIZE] of Byte;
begin
  if FChecksumDone then exit(FChecksum);
  c := 0;
  try
fs := TFileStream.Create(Dir + Name, fmOpenRead);
try
debugln(['## ',
  fs.Read(buf[0], PRE_READ_SIZE)
]);
  for i := 0 to PRE_READ_SIZE - 1 do begin
c := c + buf[i];
if i > 0 then
  c := (c + (buf[i] * buf[i-1])) AND $7f;
  end;
finally
  fs.free;
end;
  except
  end;
debugln(['--- ',Name,' ',c]);
  FChecksum := c;
  FChecksumDone := True;
  Result := FChecksum;
end;


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Trying to do a running implementation of Widget Type "NoGui"

2010-03-09 Thread Jonas Maebe

Michael Schnell wrote on di, 09 mrt 2010:


Now I need to find out how the Widget Type selected in project options
is linked to the code that implements the "controls" and how I can
debug/edit the source code for the "NoGUI" Widget Type.


Such questions are more suited to the Lazarus mailing list. See  
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus for more  
info.



Jonas


This message was sent using IMP, the Internet Messaging Program.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Trying to do a running implementation of Widget Type "NoGui"

2010-03-09 Thread Michael Schnell
As said I do have a running implementation of "NoGUIApplication, that I
did by porting the code from MSEIDE.

Now I am not happy with introducing this huge amount of code into
Lazarus (i.e. a Lazarus "package").

So I took a look what we have in the RTL and the LCL. I did some steps
to do do a "TNoGUIApplication = class(TCustomApplication)", but looking
into the "Forms" code (that implements the LCL "Application =
class(TCustomApplication)", I saw that the link to the underlying
Graphics system is done by kind of dynamically linking to a "Widget
Type", and looking in the project options the Widget Type can be
selected, Here even we already have a widget type "NoGUI (Pre-Alpha)".
Obviously somebody already started such a project.

Now I need to find out how the Widget Type selected in project options
is linked to the code that implements the "controls" and how I can
debug/edit the source code for the "NoGUI" Widget Type.

Thanks for any pointers.
-Michael
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] RTL and Unicode filenames operations.

2010-03-09 Thread Marco van de Voort
In our previous episode, dmitry boyarintsev said:
> 
> The patch has been updated: http://bugs.freepascal.org/view.php?id=15795
> (is it possible to allow the reporter to delete its files in FPC bug tracker?)
> 
> The library is now RTL "encoding" independent. Actually it's
> configurable, so, if RTL string encoding changes, only a 2-3 lines in
> the library should be changed.

I don't know, but I can delete anything but the most recent if you wish?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] RTL and Unicode filenames operations.

2010-03-09 Thread dmitry boyarintsev
On Tue, Mar 9, 2010 at 1:49 PM, Marco van de Voort  wrote:
>> The library is now RTL "encoding" independent. Actually it's
>> configurable, so, if RTL string encoding changes, only a 2-3 lines in
>> the library should be changed.
>
> I don't know, but I can delete anything but the most recent if you wish?

yes, please. just keep: ufiles-03032010-clean.zip

afaik, in Lazarus it's allowed to delete attached files for the reporter.

thanks,
dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] RTL and Unicode filenames operations.

2010-03-09 Thread dmitry boyarintsev
Hello,

The patch has been updated: http://bugs.freepascal.org/view.php?id=15795
(is it possible to allow the reporter to delete its files in FPC bug tracker?)

The library is now RTL "encoding" independent. Actually it's
configurable, so, if RTL string encoding changes, only a 2-3 lines in
the library should be changed.

On Wed, Feb 17, 2010 at 1:10 PM, Mattias Gaertner
 wrote:
>> The implementation is not only about RTL encoding, but system
>> environment as well, since it depends upon Windows *W function to be
>> available. But who cares about 9x these days?! :)
>
> Notes:
> - Comparison is wrong under OS X, see lcl FileUtil.pas
> - missing a note that files with broken UTF8 chars can not be read
>  under Linux. Maybe add a note where the system encoding file routines
>  are.
> - ExtractRelativePath works Delphi compatible, but always case
>  insensitive, so not useful under Linux.

All 3 issues should be fixed by now.

thanks,
dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel