"Fossies" - the Fresh Open Source Software Archive  

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

About: bed is an adjustable data format binary editor.

edit.cpp  (bed-3.0.3.src.tar.xz):edit.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 30 skipping to change at line 30
* v2 2000.09.20 Jim Blackson rename mem.truncate to mem.truncatefile. * v2 2000.09.20 Jim Blackson rename mem.truncate to mem.truncatefile.
*/ */
#include "desturbe.h" #include "desturbe.h"
#include "editor.h" #include "editor.h"
#include "editlimits.cpp" #include "editlimits.cpp"
extern long long getfree(void) ; extern long long getfree(void) ;
#include "main.h" #include "main.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int Editor::extendfile(int len) { int Editor::extendfile(OFFTYPE len) {
if(searchdontedit()) if(searchdontedit())
return -1; return -1;
if((len>MAXEXTEND)&&(useext(len)>getfree())) { /* if((len>MAXEXTEND)&&(useext(len)>getfree())) {
message("Too big. Extend multiple times with save between"); message("Too big. Extend multiple times with save between");
return -1; return -1;
} }
*/
char buf[mem.BLOCKSIZE]; char buf[mem.BLOCKSIZE];
INCDEST(); INCDEST();
memorize(); memorize();
long begin=(mem.filesize%mem.BLOCKSIZE); long begin=(mem.filesize%mem.BLOCKSIZE);
OFFTYPE oldsize=mem.filesize; OFFTYPE oldsize=mem.filesize;
extendtoundo(oldsize); extendtoundo(oldsize);
BLOCKTYPE bl=(oldsize/mem.BLOCKSIZE); BLOCKTYPE bl=(oldsize/mem.BLOCKSIZE);
mem.getblock(bl,buf); mem.getblock(bl,buf);
memset(buf+begin,'\0',mem.BLOCKSIZE-begin); memset(buf+begin,'\0',mem.BLOCKSIZE-begin);
mem.filesize+=len; mem.filesize+=len;
mem.putblock(bl++,buf); mem.putblock(bl++,buf);
BLOCKTYPE blend=mem.filesize/mem.BLOCKSIZE+1; /* BLOCKTYPE blend=mem.filesize/mem.BLOCKSIZE+1;
memset(buf,'\0',mem.BLOCKSIZE); memset(buf,'\0',mem.BLOCKSIZE);
for(;bl<blend;bl++) for(;bl<blend;bl++)
mem.putblock(bl,buf); mem.putblock(bl,buf);
*/
modified++; modified++;
resetnumbase() ; resetnumbase() ;
if(!shouldreinit) if(!shouldreinit)
// dofromfile=1; // dofromfile=1;
fromfile(); fromfile();
message("%s extended with %d bytes",mem.filename,len); message("%s extended with " OFFPRINT " bytes",mem.filename,len);
updated=0; updated=0;
DECDEST(); DECDEST();
return 0; return 0;
} }
/* /*
int Editor::extend(void) { int Editor::extend(void) {
char ant[MAXANT]; char ant[MAXANT];
getinput("How many bytes? ",ant); getinput("How many bytes? ",ant);
return extendfile(atoi(ant)); return extendfile(atoi(ant));
skipping to change at line 139 skipping to change at line 141
};break; };break;
default:break; default:break;
}; };
fileinfo(); fileinfo();
} }
else else
message("Filesize " OFFPRINT "?",news); message("Filesize " OFFPRINT "?",news);
wrefresh(editscreen); wrefresh(editscreen);
goto again; goto again;
}; };
/*
if(ext>INT_MAX) { if(ext>INT_MAX) {
message("Extend in multiple part with save between"); message("Extend in multiple part with save between");
wrefresh(editscreen); wrefresh(editscreen);
goto again; goto again;
} } */
break; break;
} }
int ret=0; int ret=0;
if((ret= extendfile(ext))<0) { if((ret= extendfile(ext))<0) {
wrefresh(editscreen); wrefresh(editscreen);
goto again; goto again;
} }
editup(); editup();
 End of changes. 8 change blocks. 
5 lines changed or deleted 8 lines changed or added

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