home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.paradox      To crash or not to crash, asks Borland      9,834 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,689 of 9,834   
   Robert Wiltshire to All   
   Re: Unsigned longint to longint and then   
   07 Apr 09 01:43:46   
   
   From: Robert@nospam.com   
      
   In the community file api library,   
   there is a method called apiGetFileSize.   
   This library is great and my sincere thanks to anyone   
   who helped develop it.   
      
   Possibly the library I have is out of date,   
   but I was unsure where to find the newest one.   
      
      
   method apiGetFileSize(hndl longint) number   
   Hndl - search handle, obtained via apiFindFirst/apiFindNext   
   var   
    i1,i2 longint   
    addr longint   
    n number   
   endvar   
   if hndl=0 or (not SearchData.contains(string(hndl))) then return -1 endif   
   addr=SearchData[string(hndl)]+28   
   RtlMoveMemoryInVar(i2,addr,4)   
   addr=addr+4   
   RtlMoveMemoryInVar(i1,addr,4)   
   n=round(number(i1)+4294967296.0*number(i2),0)   
   return n   
      
   endmethod   
      
      
      
   I believe this method returns the wrong size   
   when file size is between 2 and 4 gig.   
      
   I have a home cooked application, called pLocate,   
   which is loosely based on the linux utility slocate,   
   to help me find files in speedy fashion.   
   It is very handy for finding large files, old files,   
   network maintenance, etc...   
      
   However, some of the files were showing up with negative size,   
   and believing that to be impossible,   
   I slightly re-coded this method as follows so that   
   I did not get any negative file sizes.   
      
   after the   
   RtlMoveMemoryInVar(i1,addr,4)   
   I recoded as follows   
      
   if i1 < 0   
      then   
          nAdj = 4294967296.0   
      else   
          nAdj = 0.00   
     endif   
      
   nBytes = round(number(i1) + nAdj + 4294967296.0*number(i2),0)   
   return(nBytes)   
      
      
      
   Perhaps it could even be   
      
   nNum1 = i1   
   if i1 < 0 then   
          nNum1 = i1 + 4294967296.0;   
     endif   
      
   nBytes = round(nNum1 + 4294967296.0*number(i2),0)   
   return(nBytes)   
      
      
      
   Robert Wiltshire   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca