Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
8f28848d
Commit
8f28848d
authored
22 years ago
by
Andreas Finnman
Browse files
Options
Downloads
Patches
Plain Diff
attempt 2...
Rev: src/post_modules/Bz2/libbzip2mod.cmod:1.7
parent
629880a5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/post_modules/Bz2/libbzip2mod.cmod
+32
-23
32 additions, 23 deletions
src/post_modules/Bz2/libbzip2mod.cmod
with
32 additions
and
23 deletions
src/post_modules/Bz2/libbzip2mod.cmod
+
32
−
23
View file @
8f28848d
#include "global.h"
RCSID("$Id: libbzip2mod.cmod,v 1.
6
2003/01/24 1
0
:2
4:26
finnman Exp $");
RCSID("$Id: libbzip2mod.cmod,v 1.
7
2003/01/24 1
1
:2
8:52
finnman Exp $");
#include "interpret.h"
#include "svalue.h"
#include "stralloc.h"
...
...
@@ -60,8 +60,17 @@ RCSID("$Id: libbzip2mod.cmod,v 1.6 2003/01/24 10:24:26 finnman Exp $");
#define bzWriteOpen BZ2_bzWriteOpen
#define bzWrite BZ2_bzWrite
#define bzWriteClose BZ2_bzWriteClose
/* use 64 bit counting struct */
#define TOTAL_OUT (s->total_out_lo_32 + (s->total_out_hi_32 << 32))
#endif /* HAVE_BZ2_BZCOMPRESSINIT */
#ifndef HAVE_BZ2_BZCOMPRESSINIT
#define TOTAL_OUT s->total_out
#endif
/*! @module Bz2
*!
*! The Bz2 module contains functions to compress and uncompress strings using
...
...
@@ -246,11 +255,11 @@ PIKECLASS Deflate
Pike_error("Error when compressing in Bz2.feed()");
}
if(
s->total_out
- THIS->total_out_previous_buf > 0){
if(
TOTAL_OUT
- THIS->total_out_previous_buf > 0){
/*if something was written to the outbuffer, then buffer it internally*/
low_my_binary_strcat(tmp,
s->total_out
- THIS->total_out_previous_buf,&(THIS->intern_buffer));
low_my_binary_strcat(tmp,
TOTAL_OUT
- THIS->total_out_previous_buf,&(THIS->intern_buffer));
THIS->internbuf = &(THIS->intern_buffer);
THIS->total_out_previous_buf =
s->total_out
;
THIS->total_out_previous_buf =
TOTAL_OUT
;
}
/*free the outbuffer*/
free(tmp);
...
...
@@ -283,7 +292,7 @@ PIKECLASS Deflate
retval = bzCompress(s, mode);
if(tmp != NULL){
low_my_binary_strcat(tmp,
s->total_out
-total_out_old,&retbuf);
low_my_binary_strcat(tmp,
TOTAL_OUT
-total_out_old,&retbuf);
free(tmp);
}
if(retval < 0){
...
...
@@ -307,7 +316,7 @@ PIKECLASS Deflate
}
s->next_out = tmp;
s->avail_out = i * DEFL_BUF_SIZE;
total_out_old =
s->total_out
;
total_out_old =
TOTAL_OUT
;
}
}
return (&retbuf);
...
...
@@ -334,20 +343,20 @@ PIKECLASS Deflate
low_make_buf_space(DEFL_BUF_SIZE, &retbuf);
ret = do_deflate(data, retbuf,BZ_FLUSH, args);
if(
s->total_out
- THIS->total_out_previous_flush > 0){
if(
TOTAL_OUT
- THIS->total_out_previous_flush > 0){
if(THIS->total_out_previous_buf > THIS->total_out_previous_flush){
low_my_binary_strcat(ret->s.str,
s->total_out
- THIS->total_out_previous_buf, &(THIS->intern_buffer));
retstr = make_shared_binary_string(THIS->intern_buffer.s.str,
s->total_out
- THIS->total_out_previous_flush);
low_my_binary_strcat(ret->s.str,
TOTAL_OUT
- THIS->total_out_previous_buf, &(THIS->intern_buffer));
retstr = make_shared_binary_string(THIS->intern_buffer.s.str,
TOTAL_OUT
- THIS->total_out_previous_flush);
}
else{
retstr = make_shared_binary_string(ret->s.str,
s->total_out
-THIS->total_out_previous_flush);
retstr = make_shared_binary_string(ret->s.str,
TOTAL_OUT
-THIS->total_out_previous_flush);
}
if(THIS->internbuf != NULL){
toss_buffer(&THIS->intern_buffer);
THIS->internbuf = NULL;
}
THIS->total_out_previous_flush =
s->total_out
;
THIS->total_out_previous_buf =
s->total_out
;
THIS->total_out_previous_flush =
TOTAL_OUT
;
THIS->total_out_previous_buf =
TOTAL_OUT
;
}
else{
retstr = make_shared_binary_string("",0);
...
...
@@ -383,17 +392,17 @@ PIKECLASS Deflate
ret = do_deflate(data, retbuf,BZ_FINISH, args);
/*use perhaps a better check?*/
if(
s->total_out
- THIS->total_out_previous_flush > 0){
if(
TOTAL_OUT
- THIS->total_out_previous_flush > 0){
if(THIS->total_out_previous_buf > THIS->total_out_previous_flush){
low_my_binary_strcat(ret->s.str,
s->total_out
- THIS->total_out_previous_buf, &(THIS->intern_buffer));
retstr = make_shared_binary_string(THIS->intern_buffer.s.str,
s->total_out
- THIS->total_out_previous_flush);
low_my_binary_strcat(ret->s.str,
TOTAL_OUT
- THIS->total_out_previous_buf, &(THIS->intern_buffer));
retstr = make_shared_binary_string(THIS->intern_buffer.s.str,
TOTAL_OUT
- THIS->total_out_previous_flush);
}
else{
retstr = make_shared_binary_string(ret->s.str,
s->total_out
-THIS->total_out_previous_flush);
retstr = make_shared_binary_string(ret->s.str,
TOTAL_OUT
-THIS->total_out_previous_flush);
}
THIS->total_out_previous_flush =
s->total_out
;
THIS->total_out_previous_buf =
s->total_out
;
THIS->total_out_previous_flush =
TOTAL_OUT
;
THIS->total_out_previous_buf =
TOTAL_OUT
;
}
else{
/* something went wrong*/
...
...
@@ -651,7 +660,7 @@ PIKECLASS Inflate
retval = bzDecompress(s); /* updates next_in, avail_in, total_in, next_out, avail_out, total_out*/
if(tmp != NULL){
low_my_binary_strcat(tmp,
s->total_out
-total_out_old,&ret_buffer);
low_my_binary_strcat(tmp,
TOTAL_OUT
-total_out_old,&ret_buffer);
free(tmp);
}
/* errorcheck*/
...
...
@@ -682,20 +691,20 @@ PIKECLASS Inflate
}
s->next_out = tmp;
s->avail_out = i * INFL_BUF_SIZE;
total_out_old =
s->total_out
;
total_out_old =
TOTAL_OUT
;
}
}
/*return the bytes decompressed since the last time bytes were returned from this stream, in other
words, return a block*/
if((retval == BZ_OK) || (retval==BZ_STREAM_END)){
if(
s->total_out
- THIS->total_out_previous_flush > 0){
retstr = make_shared_binary_string(ret_buffer.s.str,
s->total_out
-THIS->total_out_previous_flush);
if(
TOTAL_OUT
- THIS->total_out_previous_flush > 0){
retstr = make_shared_binary_string(ret_buffer.s.str,
TOTAL_OUT
-THIS->total_out_previous_flush);
}
else{
retstr = make_shared_binary_string("",0);
}
THIS->total_out_previous_flush =
s->total_out
;
THIS->total_out_previous_flush =
TOTAL_OUT
;
if(retval == BZ_STREAM_END){
bzDecompressEnd(s);
toss_buffer(&(THIS->intern_buffer));/*free the final buffer*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment