"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/memory.cpp" between
bed-3.1.0.src.tar.xz and bed-3.1.1.src.tar.xz

About: bed is an adjustable data format binary editor.

memory.cpp  (bed-3.1.0.src.tar.xz):memory.cpp  (bed-3.1.1.src.tar.xz)
skipping to change at line 74 skipping to change at line 74
#define databufalloc(size) (char *)alignedalloc(BLOCKSIZE, size) #define databufalloc(size) (char *)alignedalloc(BLOCKSIZE, size)
int userblocksize=-1; int userblocksize=-1;
OFFTYPE setfilepos(FILEHANDLE file,OFFTYPE offset) ; OFFTYPE setfilepos(FILEHANDLE file,OFFTYPE offset) ;
#ifdef NEEDS_BLOCKMODE #ifdef NEEDS_BLOCKMODE
inline BOOL Memory::sizehigher(OFFTYPE sizefile) { inline BOOL Memory::sizehigher(OFFTYPE sizefile) {
if(blockreadonly>1) { if(blockreadonly>1) {
char *blk=alignedalloc(blocksize(),BLOCKSIZE); char *blk=alignedalloc(blocksize(),BLOCKSIZE);
BEDS_SIZE_T got=readat(blk,BLOCKSIZE,sizefile); OFFTYPE offunder=(sizefile/blockreadonly)*blockreadonly;
BEDS_SIZE_T got=realblockreadat(blk,BLOCKSIZE,offunder);
alignedfree(blk); alignedfree(blk);
return (got>=1); return (offunder+got)>sizefile;
} }
else { else {
char readtestchar; char readtestchar;
return (readat(&readtestchar,1,(sizefile))>=1); return (realblockreadat(&readtestchar,1,(sizefile))>=1);
} }
} }
#else #else
inline BOOL Memory::sizehigher(OFFTYPE sizefile) { inline BOOL Memory::sizehigher(OFFTYPE sizefile) {
char readtestchar; char readtestchar;
return (readat(&readtestchar,1,(sizefile))>=1); return (realblockreadat(&readtestchar,1,(sizefile))>=1);
} }
#endif #endif
//#define sizehigher(sizefile) (readat(&readtestchar,1,(sizefile))>=1) //#define sizehigher(sizefile) (readat(&readtestchar,1,(sizefile))>=1)
/*slaat nergens op in blocks*/ /*slaat nergens op in blocks*/
inline BOOL Memory::testsize(OFFTYPE sizetest) { inline BOOL Memory::testsize(OFFTYPE sizetest) {
return (sizehigher((sizetest))?0:((sizehigher(((sizetest)-1)))?1:0)); return (sizehigher((sizetest))?0:((sizehigher(((sizetest)-1)))?1:0));
} }
#define MAXCDSIZEDEF (20LL*1024*1024*1024LL) #define MAXCDSIZEDEF (20LL*1024*1024*1024LL)
extern OFFTYPE MAXCDSIZE; extern OFFTYPE MAXCDSIZE;
skipping to change at line 1005 skipping to change at line 1006
openfile(); openfile();
#ifdef BIOSDISK #ifdef BIOSDISK
if(infodisk) if(infodisk)
setregistrysize(infodisk,filesize); setregistrysize(infodisk,filesize);
#endif #endif
diskfilesize=filesize; diskfilesize=filesize;
useddiskfilesize=diskfilesize; useddiskfilesize=diskfilesize;
#if defined(USETHREADS) && !defined(INTSEARCH) #if defined(USETHREADS) && !defined(INTSEARCH)
if(filesize>(OFFTYPE)40000000L) //if(filesize>(OFFTYPE)40000000L)
// lastforward|=0x10; // lastforward|=0x10;
#endif #endif
} }
int newfilesize=1024; int newfilesize=1024;
extern int newfilesize; extern int newfilesize;
Memory::Memory(const char *name): Memory::Memory(const char *name):
#ifdef USE_WINFILE #ifdef USE_WINFILE
used_dasd_io(false), used_dasd_io(false),
skipping to change at line 1834 skipping to change at line 1835
BEDS_SIZE_T Memory::blockreadat(char *ptr,BEDS_SIZE_T size,OFFTYPE offset) { BEDS_SIZE_T Memory::blockreadat(char *ptr,BEDS_SIZE_T size,OFFTYPE offset) {
if(offset>=useddiskfilesize) { if(offset>=useddiskfilesize) {
#ifdef HAVE_BZERO #ifdef HAVE_BZERO
bzero(ptr,size); bzero(ptr,size);
#else #else
memset(ptr,'\0',size); memset(ptr,'\0',size);
#endif #endif
return size; return size;
} }
return realblockreadat(ptr,size,offset);
}
BEDS_SIZE_T Memory::realblockreadat(char *ptr,BEDS_SIZE_T size,OFFTYPE offset) {
#ifdef NEEDS_BLOCKMODE #ifdef NEEDS_BLOCKMODE
assert(((blockreadonly>1)?(((intptr_t)ptr)%BLOCKSIZE==0):true)); assert(((blockreadonly>1)?(((intptr_t)ptr)%BLOCKSIZE==0):true));
#endif #endif
BEDS_SIZE_T ret; BEDS_SIZE_T ret;
#ifdef BIOSDISK #ifdef BIOSDISK
if(infodisk) { if(infodisk) {
BEDS_SIZE_T count=size/blockreadonly; BEDS_SIZE_T count=size/blockreadonly;
if(count<=0) { if(count<=0) {
fprintf(stderr,"Memory::blockreadat " SIZE_TPRINT " is not a mu ltiple of %d ( disk blocksize)\n",size,blockreadonly); fprintf(stderr,"Memory::blockreadat " SIZE_TPRINT " is not a mu ltiple of %d ( disk blocksize)\n",size,blockreadonly);
return -5; return -5;
 End of changes. 7 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)