Git Product home page Git Product logo

Comments (3)

synopse avatar synopse commented on May 26, 2024

Your source seems old and outdated, or has been modified from the original.

Current code is :

function FileSize(F: THandle): Int64;
var res: Int64Rec absolute result;
begin
  result := 0;
  if PtrInt(F)>0 then
    res.Lo := GetFileSize(F,@res.Hi); // from WinAPI or SynKylix/SynFPCLinux
end;

from mormot.

mingodad avatar mingodad commented on May 26, 2024

Yes, it's strange because I just did a fossil clone and fossil open a few days ago (3 or 4), I'm puzzled, but after your reply I did a check on my repository and can see that the Lazarus tool when converted the SQLite3/Samples/12 - SynDB Explorer/DBSynLZ.dpr has changed that line.

Sorry it was my fault and thank you again for your help.

fossil status
repository:   /home/mingo/dev/lazarus/mORMot.fossil
local-root:   /home/mingo/dev/lazarus/mORMot/
config-db:    /home/mingo/.fossil
checkout:     d34ccfc62edf0c594ad3afae25c36fa4b1d8c330 2022-02-28 08:01:23 UTC
parent:       91e09aae31fcbc74ac72ca141aa66c5edd2422c3 2022-02-03 11:41:09 UTC
tags:         trunk
comment:      {6366} updated static SQLite3 engine to latest 3.38.0 revision (user: ab)
MISSING    SQLite3/SQLite3UI.RES
MISSING    SQLite3/SQLite3UILogin.RES
EDITED     SQLite3/Samples/01 - In Memory ORM/Project01.res
EDITED     SQLite3/Samples/04 - HTTP Client-Server/Project04Client.res
EDITED     SQLite3/Samples/04 - HTTP Client-Server/Project04Server.res
EDITED     SQLite3/Samples/12 - SynDB Explorer/DBSynLZ.dpr
EDITED     SQLite3/Samples/12 - SynDB Explorer/SynDBExplorer.dpr
EDITED     SQLite3/Samples/12 - SynDB Explorer/SynDBExplorerMain.pas
EDITED     SQLite3/Samples/ThirdPartyDemos/Ondrej/SynTaskDialog4Lazarus/SynTaskDialog.pas
EDITED     SQLite3/mORMotUIEdit.pas
EDITED     SQLite3/mORMotUILogin.pas
EDITED     SQLite3/mORMoti18n.pas
EDITED     SynCommons.pas
EDITED     SynFPCMetaFile.pas
EDITED     SynTaskDialog.pas

Here is the output of fossil diff:

....
Index: SynCommons.pas
==================================================================
--- SynCommons.pas
+++ SynCommons.pas
@@ -1,10 +1,14 @@
 /// common functions used by most Synopse projects
 // - this unit is a part of the freeware Synopse mORMot framework,
 // licensed under a MPL/GPL/LGPL tri-license; version 1.18
 unit SynCommons;
 
+{$IFDEF FPC}
+  {$MODE Delphi}
+{$ENDIF}
+
 (*
     This file is part of Synopse framework.
 
     Synopse framework. Copyright (C) 2022 Arnaud Bouchez
       Synopse Informatique - https://synopse.info
@@ -96,11 +100,11 @@
   {$endif HASINLINE}
 {$endif LVCL}
 {$ifndef NOVARIANTS}
   Variants,
 {$endif NOVARIANTS}
-  SynLZ, // needed for TSynMapFile .mab format
+  SynLZ, FileUtil, // needed for TSynMapFile .mab format
   SysUtils;
 
 
 const
   /// the corresponding version of the freeware Synopse framework
@@ -30602,11 +30606,11 @@
         SetLength(result,Size+Read); // in-place resize
         MoveFast(tmp,PByteArray(result)^[Size],Read);
         inc(Size,Read);
       until false;
     end else begin
-      Size := GetFileSize(F,nil);
+      Size := FileSize(F); { *Converted from GetFileSize* }
       if Size>0 then begin
         SetLength(result,Size);
         P := pointer(result);
         repeat
           Chunk := Size;
@@ -30854,11 +30858,11 @@
     res: Int64Rec absolute result;
 begin
   result := 0;
   f := FileOpen(FileName,fmOpenRead or fmShareDenyNone);
   if PtrInt(f)>0 then begin
-    res.Lo := GetFileSize(f,@res.Hi); // from SynKylix/SynFPCLinux
+    res.Lo := FileSize(f); { *Converted from GetFileSize* } // from SynKylix/SynFPCLinux
     FileClose(f);
   end;
 end;
 {$endif MSWINDOWS}
 
@@ -30865,11 +30869,11 @@
 function FileSize(F: THandle): Int64;
 var res: Int64Rec absolute result;
 begin
   result := 0;
   if PtrInt(F)>0 then
-    res.Lo := GetFileSize(F,@res.Hi); // from WinAPI or SynKylix/SynFPCLinux
+    res.Lo := GetFileSize(F, nil); { *Converted from GetFileSize* } // from WinAPI or SynKylix/SynFPCLinux
 end;
 
 function FileInfoByHandle(aFileHandle: THandle; out FileId, FileSize,
   LastWriteAccess, FileCreateDateTime: Int64): Boolean;
 var
...

from mormot.

synopse avatar synopse commented on May 26, 2024

Don't let the Lazarus conversion wizard change your code or your .res files.
Just let it create the .lpi with the proper kind of application (e.g. console), then stop.

Or - even better - reuse an existing .lpi with some manual search&replace.

from mormot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.