[Mew-dist 15566] Re: bug of mewencode -g

Kazu Yamamoto ( 山本和彦 ) kazu at example.com
2000年 12月 19日 (火) 14:11:55 JST


----
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

From: Shun-ichi GOTO <gotoh at example.com>
Subject: [Mew-dist 15530] Re: bug of mewencode -g

> ってので、現状は少なくとも先に報告した成功ファイル/失敗ファイルのいずれ
> もOKになりました。検証してみて下さい。

ありがとうございます。これでどうでしょう? b90 に当てて下さい。

--かず@働きすぎで顔に表情がないと言われている今日このごろ

Index: mewencode.c
===================================================================
RCS file: /usr/home/kazu/cvsroot/Mew/mew/bin/mewencode.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -c -r1.43 -r1.44
*** mewencode.c	2000/11/05 03:18:02	1.43
--- mewencode.c	2000/12/16 14:00:28	1.44
***************
*** 222,227 ****
--- 222,228 ----
  	static uLong total = 0;
  	static z_stream z;
  	int err, size, deflated = 0, old;
+ 	byte *q;
  
  	if (done == YES) return 0;
  
***************
*** 254,290 ****
  	z.next_out = p;
  	z.avail_out = max;
  
! 	if (finalize == YES) {
! 		byte *q;
! 		done = YES;
! 	
! 		do {
! 			err = deflate(&z, Z_FINISH);
! 		} while (err != Z_STREAM_END);
! 		
! 		if (deflateEnd(&z) != Z_OK)
! 			warn_exit("deflateEnd error.\n");
  
- 		deflated = max - z.avail_out;
- 		q = z.next_out;
- 		*q++ = (int)(crc & 0xff);
- 		*q++ = (int)((crc >>= 8) & 0xff);
- 		*q++ = (int)((crc >>= 8) & 0xff);
- 		*q++ = (int)((crc >>= 8) & 0xff);
- 		*q++ = (int)(total & 0xff);
- 		*q++ = (int)((total >>= 8) & 0xff);
- 		*q++ = (int)((total >>= 8) & 0xff);
- 		*q++ = (int)((total >>= 8) & 0xff);
- 		deflated += 8;
- 		return deflated;
- 	}
- 	
  	while (z.avail_out != 0) {
  		if (z.avail_in == 0) {
  			size = (*E_ctx.e_func1)(e_buf1, sizeof(e_buf1));
  			if (size == 0) {
  				finalize = YES;
! 				break;
  			}
  			z.next_in  = e_buf1;
  			z.avail_in = size;
--- 255,269 ----
  	z.next_out = p;
  	z.avail_out = max;
  
! 	if (finalize == YES) goto finalize;
  
  	while (z.avail_out != 0) {
  		if (z.avail_in == 0) {
  			size = (*E_ctx.e_func1)(e_buf1, sizeof(e_buf1));
  			if (size == 0) {
  				finalize = YES;
! 				if (deflated == 0) goto finalize;
! 				return deflated;
  			}
  			z.next_in  = e_buf1;
  			z.avail_in = size;
***************
*** 303,309 ****
--- 282,310 ----
  		if (old == z.avail_out)
  			break;
  	}
+ 	return deflated;
+ 
+  finalize:
+ 	done = YES;
+ 	
+ 	do {
+ 		err = deflate(&z, Z_FINISH);
+ 	} while (err != Z_STREAM_END);
+ 		
+ 	if (deflateEnd(&z) != Z_OK)
+ 		warn_exit("deflateEnd error.\n");
  
+ 	deflated = max - z.avail_out;
+ 	q = z.next_out;
+ 	*q++ = (int)(crc & 0xff);
+ 	*q++ = (int)((crc >>= 8) & 0xff);
+ 	*q++ = (int)((crc >>= 8) & 0xff);
+ 	*q++ = (int)((crc >>= 8) & 0xff);
+ 	*q++ = (int)(total & 0xff);
+ 	*q++ = (int)((total >>= 8) & 0xff);
+ 	*q++ = (int)((total >>= 8) & 0xff);
+ 	*q++ = (int)((total >>= 8) & 0xff);
+ 	deflated += 8;
  	return deflated;
  }
  #endif /* HAVE_LIBZ */






Mew-dist メーリングリストの案内