"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/examples/skip.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.

skip.cpp  (bed-3.0.3.src.tar.xz):skip.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 55 skipping to change at line 55
snprintf(label,10,"%d#%d",take,skip); snprintf(label,10,"%d#%d",take,skip);
chbytesback(sb); chbytesback(sb);
} }
Skip(Skip const &rev): Filter(rev), skip(rev.skip), take(rev.take) { Skip(Skip const &rev): Filter(rev), skip(rev.skip), take(rev.take) {
label= new char[10]; label= new char[10];
strcpy(label,rev.label); strcpy(label,rev.label);
} }
~Skip() { ~Skip() {
delete[] label; delete[] label;
} }
virtual char *convstr(void) override{ virtual char *convstr(void) const override{
return label; return label;
} }
virtual Filter *newone(void) const override { virtual Filter *newone(void) const override {
return new Skip(*this); return new Skip(*this);
} }
virtual int chbytes(int b) override { virtual int chbytes(int b) override {
int per=take+skip; int per=take+skip;
if(take>b||take<=0||skip<0||(b%per)){ if(take>b||take<=0||skip<0||(b%per)){
err=1; err=1;
return -1; return -1;
skipping to change at line 100 skipping to change at line 100
} }
virtual int tofile(const unsigned char * const input,unsigned char * cons t output) override { virtual int tofile(const unsigned char * const input,unsigned char * cons t output) override {
int per=skip+take; int per=skip+take;
int oriter; int oriter;
oriter=0; oriter=0;
for(int show=0;show<bytesscreen;oriter+=per,show+=take) { for(int show=0;show<bytesscreen;oriter+=per,show+=take) {
memcpy(output+oriter,input+show,take); memcpy(output+oriter,input+show,take);
} }
return bytesfile; return bytesfile;
} }
int equal(Filter *fil) override { int equal(const Filter *fil) const override {
if(!Filter::equal(fil)) if(!Filter::equal(fil))
return 0; return 0;
Skip *sk=(Skip *) fil; Skip *sk=(Skip *) fil;
if(sk->skip!=skip||sk->take!=take) if(sk->skip!=skip||sk->take!=take)
return 0; return 0;
return 1; return 1;
} }
virtual int screen2filepos(int pos) override { virtual int screen2filepos(int pos) override {
int per=skip+take; int per=skip+take;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

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