"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/withcontain.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.

withcontain.cpp  (bed-3.0.3.src.tar.xz):withcontain.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 24 skipping to change at line 24
/* */ /* */
/* You should have received a copy of the GNU General Public License */ /* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */ /* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Fri Dec 8 22:14:27 2000 */ /* Fri Dec 8 22:14:27 2000 */
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include "editor.h" #include "editor.h"
#include "contain.h" #include "contain.h"
#include "datatypes.h" #include "datatypes.h"
#include "dialog.h" #include "dialog.h"
#include "screen.h" #include "screen.h"
#include "system.h" #include "system.h"
extern char showfileinfo; extern char showfileinfo;
char showfileinfo=1; char showfileinfo=1;
char emptyshowdefault[2]="#"; char emptyshowdefault[2]="#";
extern void mychdir(const char *path); extern void mychdir(const char *path);
skipping to change at line 158 skipping to change at line 161
forstart+=f; forstart+=f;
binstart+=b; binstart+=b;
} }
if(par==parts[mode]) { if(par==parts[mode]) {
beep(); beep();
parts[mode]->mklabel(); parts[mode]->mklabel();
showfileinfo=1; showfileinfo=1;
return 0; return 0;
} }
else { else {
HasSub *has;
if(!grand) { if(!grand) {
beep();message("System error: no grandparent");return -1; beep();message("System error: no grandparent");return -1;
} }
if(isleaf(grand)) { if(isleaf(grand)) {
beep();message("System error: leaf grandparent??");return -1; beep();message("System error: leaf grandparent??");return -1;
} }
has=(HasSub *)grand; HasSub *has=(HasSub *)grand;
has->active=-1; has->active=-1;
has->mklabel(); has->mklabel();
} }
parts[mode]->mklabel(); parts[mode]->mklabel();
showfileinfo=1; showfileinfo=1;
return 0; return 0;
} }
std::vector<ScreenPart *> Editor::progenitors(void) {
std::vector<ScreenPart *> pro;
if(isleaf(parts[mode])) {
pro.push_back(parts[mode]);
return pro;
}
int forstart=0;
int binstart=0;
int f,b;
ScreenPart *par=parts[mode];
int pos=par->half;
for(ScreenPart *sub; (sub=par->getchild(f,b,pos-forstart));par=sub) {
pro.push_back(par);
forstart+=f;
binstart+=b;
}
pro.push_back(par);
return pro;
}
int Editor::stretchcontain(void) { int Editor::stretchcontain(void) {
ScreenPart *sub=parts[mode]->getsubpart(); ScreenPart *sub=parts[mode]->getsubpart();
HasSub *par=(HasSub *)sub->getparent(); HasSub *par=(HasSub *)sub->getparent();
if(!par) { if(!par) {
message("No parent found");beep();return -1; message("No parent found");beep();return -1;
} }
if(!has_super(par,Contains)) { if(!has_super(par,Contains)) {
message("Parent not composed");beep();return -1; message("Parent not composed");beep();return -1;
} }
int acti=par->active; int acti=par->active;
skipping to change at line 781 skipping to change at line 803
case 'c':; case 'c':;
case 'C':message("Cancelled");return -1; case 'C':message("Cancelled");return -1;
case 'o':; case 'o':;
case 'O':return savecontain(); case 'O':return savecontain();
} }
} }
return savealldatatypes() ; return savealldatatypes() ;
} }
#ifdef HAVE_SYS_MMAN_H
#define endmmap {if(nommap) myfree(gegs);else munmap(gegs, endf+1); close(handle );} #define endmmap {if(nommap) myfree(gegs);else munmap(gegs, endf+1); close(handle );}
#else
#define endmmap {myfree(gegs); close(handle);}
#endif
// message("error reading filters %d",ret); // message("error reading filters %d",ret);
/* /*
Float 10 4 Float 10 4
*/ */
#define errormessage message #define errormessage message
#define filtersfrom(x,y) if((ret=::readfiltersfrom(x,y,end,mes))<0) {\ #define filtersfrom(x,y) if((ret=::readfiltersfrom(x,y,end,mes))<0) {\
return -1;\ return -1;\
} }
extern void skipsep(char *&ptr,size_t &len) ; extern void skipsep(char *&ptr,size_t &len) ;
extern int getuserlabel(ScreenPart *part, char *&ptr) ; extern int getuserlabel(ScreenPart *part, char *&ptr) ;
skipping to change at line 977 skipping to change at line 1003
off_t endf; off_t endf;
endf=lseek(handle, 0L, SEEK_END); endf=lseek(handle, 0L, SEEK_END);
if(endf<0) { if(endf<0) {
message("lseek failed"); message("lseek failed");
return -1; return -1;
} }
if(endf==0) { if(endf==0) {
message("%s is zero",ant); message("%s is zero",ant);
return -1; return -1;
} }
char *gegs= (char *)mmap(NULL, endf+1, PROT_WRITE| PROT_READ , MAP_PR char *gegs
IVATE, handle,0); #ifdef HAVE_SYS_MMAN_H
=(char *)mmap(NULL, endf+1, PROT_WRITE| PROT_READ , MAP_PRIVATE, hand
le,0);
int nommap=0; int nommap=0;
if(gegs==MAP_FAILED) { if(gegs==MAP_FAILED) {
nommap=1; nommap=1;
#else
;{
#endif
gegs=myallocar(char,endf+1); gegs=myallocar(char,endf+1);
lseek(handle, 0L, SEEK_SET); lseek(handle, 0L, SEEK_SET);
ssize_t res; ssize_t res;
if((res=read(handle,gegs,endf))!=endf) { if((res=read(handle,gegs,endf))!=endf) {
message("read(%s..) gives %d instead of %d",ant,res,endf) ; message("read(%s..) gives %d instead of %d",ant,res,endf) ;
endmmap; endmmap;
return -1; return -1;
} }
} }
gegs[endf]='\0'; gegs[endf]='\0';
int addfield=0; int addfield=0;
switch(getkeyinput("(a)ad field/(s)eparate?")) { switch(getkeyinput("(a)ad field/(s)eparate?")) {
case 'a': addfield=1;break; case 'a': addfield=1;break;
case 's': case 's':
default: addfield=0;break; default: addfield=0;break;
}; };
 End of changes. 9 change blocks. 
4 lines changed or deleted 36 lines changed or added

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