Subversion Repositories Kolibri OS

Rev

Rev 6704 | Rev 6780 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6704 Rev 6741
Line 542... Line 542...
542
	mov dword[ebx+z_stream.total_out],0
542
	mov dword[ebx+z_stream.total_out],0
543
	mov dword[ebx+z_stream.total_in],0
543
	mov dword[ebx+z_stream.total_in],0
544
	mov dword[ebx+z_stream.msg],Z_NULL ;use zfree if we ever allocate msg dynamically
544
	mov dword[ebx+z_stream.msg],Z_NULL ;use zfree if we ever allocate msg dynamically
545
	mov word[ebx+z_stream.data_type],Z_UNKNOWN
545
	mov word[ebx+z_stream.data_type],Z_UNKNOWN
Line 546... Line 546...
546
 
546
 
547
	mov word[edi+deflate_state.pending],0
547
	mov dword[edi+deflate_state.pending],0
548
	mov eax,[edi+deflate_state.pending_buf]
548
	mov eax,[edi+deflate_state.pending_buf]
Line 549... Line 549...
549
	mov [edi+deflate_state.pending_out],eax
549
	mov [edi+deflate_state.pending_out],eax
550
 
550
 
Line 637... Line 637...
637
		jmp .end_f
637
		jmp .end_f
638
	.end0:
638
	.end0:
639
	cmp dword[pending],Z_NULL
639
	cmp dword[pending],Z_NULL
640
	je @f ;if (..!=..)
640
	je @f ;if (..!=..)
641
		mov eax,[pending]
641
		mov eax,[pending]
642
		movzx ebx,word[edi+deflate_state.pending]
642
		mov ebx,[edi+deflate_state.pending]
643
		mov [eax],ebx
643
		mov [eax],ebx
644
	@@:
644
	@@:
645
	cmp dword[bits],Z_NULL
645
	cmp dword[bits],Z_NULL
646
	je @f ;if (..!=..)
646
	je @f ;if (..!=..)
647
		mov eax,[bits]
647
		mov eax,[bits]
Line 890... Line 890...
890
	zlib_debug 'flush_pending'
890
	zlib_debug 'flush_pending'
891
	mov ebx,[strm]
891
	mov ebx,[strm]
892
	mov edx,[ebx+z_stream.state]
892
	mov edx,[ebx+z_stream.state]
Line 893... Line 893...
893
 
893
 
894
	stdcall _tr_flush_bits, edx
894
	stdcall _tr_flush_bits, edx
895
	movzx ecx,word[edx+deflate_state.pending]
895
	mov ecx,[edx+deflate_state.pending]
896
	cmp cx,[ebx+z_stream.avail_out]
896
	cmp cx,[ebx+z_stream.avail_out]
897
	jle @f ;if (..>..)
897
	jle @f ;if (..>..)
898
		movzx ecx,word[ebx+z_stream.avail_out]
898
		movzx ecx,word[ebx+z_stream.avail_out]
899
	@@:
899
	@@:
Line 903... Line 903...
903
	stdcall zmemcpy, [ebx+z_stream.next_out], [edx+deflate_state.pending_out], ecx
903
	stdcall zmemcpy, [ebx+z_stream.next_out], [edx+deflate_state.pending_out], ecx
904
	add [ebx+z_stream.next_out],ecx
904
	add [ebx+z_stream.next_out],ecx
905
	add [edx+deflate_state.pending_out],ecx
905
	add [edx+deflate_state.pending_out],ecx
906
	add [ebx+z_stream.total_out],ecx
906
	add [ebx+z_stream.total_out],ecx
907
	sub [ebx+z_stream.avail_out],cx
907
	sub [ebx+z_stream.avail_out],cx
908
	sub [edx+deflate_state.pending],cx
908
	sub [edx+deflate_state.pending],ecx
909
	cmp word[edx+deflate_state.pending],0
909
	cmp dword[edx+deflate_state.pending],0
910
	jne @f ;if (..==0)
910
	jne @f ;if (..==0)
911
		mov eax,[edx+deflate_state.pending_buf]
911
		mov eax,[edx+deflate_state.pending_buf]
912
		mov [edx+deflate_state.pending_out],eax
912
		mov [edx+deflate_state.pending_out],eax
913
	@@:
913
	@@:
914
	ret
914
	ret
Line 1046... Line 1046...
1046
					put_byte edi, cl
1046
					put_byte edi, cl
1047
					put_byte edi, ch
1047
					put_byte edi, ch
1048
				@@:
1048
				@@:
1049
				cmp dword[edx+gz_header.hcrc],0
1049
				cmp dword[edx+gz_header.hcrc],0
1050
				je @f ;if (..)
1050
				je @f ;if (..)
1051
					movzx eax,word[edi+deflate_state.pending]
-
 
1052
					stdcall calc_crc32, [ebx+z_stream.adler],\
1051
					stdcall calc_crc32, [ebx+z_stream.adler],\
1053
						[edi+deflate_state.pending_buf], eax
1052
						[edi+deflate_state.pending_buf], [edi+deflate_state.pending]
1054
					mov [ebx+z_stream.adler],eax
1053
					mov [ebx+z_stream.adler],eax
1055
				@@:
1054
				@@:
1056
				mov dword[edi+deflate_state.gzindex],0
1055
				mov dword[edi+deflate_state.gzindex],0
1057
				mov dword[edi+deflate_state.status],EXTRA_STATE
1056
				mov dword[edi+deflate_state.status],EXTRA_STATE
1058
			jmp .end2
1057
			jmp .end2
Line 1114... Line 1113...
1114
	mov edx,[edi+deflate_state.gzhead]
1113
	mov edx,[edi+deflate_state.gzhead]
1115
	cmp dword[edi+deflate_state.status],EXTRA_STATE
1114
	cmp dword[edi+deflate_state.status],EXTRA_STATE
1116
	jne .end5 ;if (..==..)
1115
	jne .end5 ;if (..==..)
1117
		cmp dword[edx+gz_header.extra],Z_NULL
1116
		cmp dword[edx+gz_header.extra],Z_NULL
1118
		je .end21 ;if (..!=..)
1117
		je .end21 ;if (..!=..)
1119
			movzx esi,word[edi+deflate_state.pending]
1118
			mov esi,[edi+deflate_state.pending]
1120
			;esi = beg ;start of bytes to update crc
1119
			;esi = beg ;start of bytes to update crc
Line 1121... Line 1120...
1121
 
1120
 
1122
			movzx ecx,word[edx+gz_header.extra_len]
1121
			movzx ecx,word[edx+gz_header.extra_len]
1123
			.cycle0: ;while (..<..)
1122
			.cycle0: ;while (..<..)
1124
			cmp dword[edi+deflate_state.gzindex],ecx
1123
			cmp dword[edi+deflate_state.gzindex],ecx
1125
			jge .cycle0end
1124
			jge .cycle0end
1126
				movzx eax,word[edi+deflate_state.pending]
1125
				mov eax,[edi+deflate_state.pending]
1127
				cmp eax,[edi+deflate_state.pending_buf_size]
1126
				cmp eax,[edi+deflate_state.pending_buf_size]
1128
				jne .end24 ;if (..==..)
1127
				jne .end24 ;if (..==..)
1129
					mov dword[edx+gz_header.hcrc],0
1128
					mov dword[edx+gz_header.hcrc],0
1130
					je @f
1129
					je @f
1131
					cmp [edi+deflate_state.pending],si
1130
					cmp [edi+deflate_state.pending],esi
1132
					jle @f ;if (.. && ..>..)
1131
					jle @f ;if (.. && ..>..)
1133
						movzx ecx,word[edi+deflate_state.pending]
1132
						mov ecx,[edi+deflate_state.pending]
1134
						sub ecx,esi
1133
						sub ecx,esi
1135
						mov eax,[edi+deflate_state.pending_buf]
1134
						mov eax,[edi+deflate_state.pending_buf]
1136
						add eax,esi
1135
						add eax,esi
1137
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1136
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1138
						mov [ebx+z_stream.adler],eax
1137
						mov [ebx+z_stream.adler],eax
1139
					@@:
1138
					@@:
1140
					stdcall flush_pending, ebx
1139
					stdcall flush_pending, ebx
1141
					movzx esi,word[edi+deflate_state.pending]
1140
					mov esi,[edi+deflate_state.pending]
1142
					cmp esi,[edi+deflate_state.pending_buf_size]
1141
					cmp esi,[edi+deflate_state.pending_buf_size]
1143
					je .cycle0end ;if (..==..) break
1142
					je .cycle0end ;if (..==..) break
1144
				.end24:
1143
				.end24:
1145
				push ebx
1144
				push ebx
Line 1151... Line 1150...
1151
				inc dword[edi+deflate_state.gzindex]
1150
				inc dword[edi+deflate_state.gzindex]
1152
				jmp .cycle0
1151
				jmp .cycle0
1153
			.cycle0end:
1152
			.cycle0end:
1154
			mov dword[edx+gz_header.hcrc],0
1153
			mov dword[edx+gz_header.hcrc],0
1155
			je @f
1154
			je @f
1156
			cmp [edi+deflate_state.pending],si
1155
			cmp [edi+deflate_state.pending],esi
1157
			jle @f ;if (.. && ..>..)
1156
			jle @f ;if (.. && ..>..)
1158
				movzx ecx,word[edi+deflate_state.pending]
1157
				mov ecx,[edi+deflate_state.pending]
1159
				sub ecx,esi
1158
				sub ecx,esi
1160
				mov eax,[edi+deflate_state.pending_buf]
1159
				mov eax,[edi+deflate_state.pending_buf]
1161
				add eax,esi
1160
				add eax,esi
1162
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1161
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1163
				mov [ebx+z_stream.adler],eax
1162
				mov [ebx+z_stream.adler],eax
Line 1173... Line 1172...
1173
	.end5:
1172
	.end5:
1174
	cmp dword[edi+deflate_state.status],NAME_STATE
1173
	cmp dword[edi+deflate_state.status],NAME_STATE
1175
	jne .end6 ;if (..==..)
1174
	jne .end6 ;if (..==..)
1176
		cmp dword[edx+gz_header.name],Z_NULL
1175
		cmp dword[edx+gz_header.name],Z_NULL
1177
		je .end22 ;if (..!=..)
1176
		je .end22 ;if (..!=..)
1178
			movzx esi,word[edi+deflate_state.pending]
1177
			mov esi,[edi+deflate_state.pending]
1179
			;esi = beg ;start of bytes to update crc
1178
			;esi = beg ;start of bytes to update crc
Line 1180... Line 1179...
1180
 
1179
 
1181
			.cycle1: ;do
1180
			.cycle1: ;do
1182
				movzx eax,word[edi+deflate_state.pending]
1181
				mov eax,[edi+deflate_state.pending]
1183
				cmp eax,[edi+deflate_state.pending_buf_size]
1182
				cmp eax,[edi+deflate_state.pending_buf_size]
1184
				jne .end25 ;if (..==..)
1183
				jne .end25 ;if (..==..)
1185
					mov dword[edx+gz_header.hcrc],0
1184
					mov dword[edx+gz_header.hcrc],0
1186
					je @f
1185
					je @f
1187
					cmp [edi+deflate_state.pending],si
1186
					cmp [edi+deflate_state.pending],esi
1188
					jle @f ;if (.. && ..>..)
1187
					jle @f ;if (.. && ..>..)
1189
						movzx ecx,word[edi+deflate_state.pending]
1188
						mov ecx,[edi+deflate_state.pending]
1190
						sub ecx,esi
1189
						sub ecx,esi
1191
						mov eax,[edi+deflate_state.pending_buf]
1190
						mov eax,[edi+deflate_state.pending_buf]
1192
						add eax,esi
1191
						add eax,esi
1193
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1192
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1194
						mov [ebx+z_stream.adler],eax
1193
						mov [ebx+z_stream.adler],eax
1195
					@@:
1194
					@@:
1196
					stdcall flush_pending, ebx
1195
					stdcall flush_pending, ebx
1197
					movzx esi,word[edi+deflate_state.pending]
-
 
1198
					movzx eax,word[edi+deflate_state.pending]
1196
					mov esi,[edi+deflate_state.pending]
1199
					cmp eax,[edi+deflate_state.pending_buf_size]
1197
					cmp esi,[edi+deflate_state.pending_buf_size]
1200
					jne .end25 ;if (..==..)
1198
					jne .end25 ;if (..==..)
1201
						mov dword[val],1
1199
						mov dword[val],1
1202
						jmp .cycle1end
1200
						jmp .cycle1end
1203
				.end25:
1201
				.end25:
Line 1212... Line 1210...
1212
				cmp dword[val],0
1210
				cmp dword[val],0
1213
				jne .cycle1 ;while (val != 0)
1211
				jne .cycle1 ;while (val != 0)
1214
			.cycle1end:
1212
			.cycle1end:
1215
			mov dword[edx+gz_header.hcrc],0
1213
			mov dword[edx+gz_header.hcrc],0
1216
			je @f
1214
			je @f
1217
			cmp [edi+deflate_state.pending],si
1215
			cmp [edi+deflate_state.pending],esi
1218
			jle @f ;if (.. && ..>..)
1216
			jle @f ;if (.. && ..>..)
1219
				movzx ecx,word[edi+deflate_state.pending]
1217
				mov ecx,[edi+deflate_state.pending]
1220
				sub ecx,esi
1218
				sub ecx,esi
1221
				mov eax,[edi+deflate_state.pending_buf]
1219
				mov eax,[edi+deflate_state.pending_buf]
1222
				add eax,esi
1220
				add eax,esi
1223
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1221
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1224
				mov [ebx+z_stream.adler],eax
1222
				mov [ebx+z_stream.adler],eax
Line 1233... Line 1231...
1233
	.end6:
1231
	.end6:
1234
	cmp dword[edi+deflate_state.status],COMMENT_STATE
1232
	cmp dword[edi+deflate_state.status],COMMENT_STATE
1235
	jne .end7 ;if (..==..)
1233
	jne .end7 ;if (..==..)
1236
		cmp dword[edx+gz_header.comment],Z_NULL
1234
		cmp dword[edx+gz_header.comment],Z_NULL
1237
		je .end23 ;if (..!=..)
1235
		je .end23 ;if (..!=..)
1238
			movzx esi,word[edi+deflate_state.pending]
1236
			mov esi,[edi+deflate_state.pending]
1239
			;esi = beg ;start of bytes to update crc
1237
			;esi = beg ;start of bytes to update crc
Line 1240... Line 1238...
1240
 
1238
 
1241
			.cycle2: ;do
1239
			.cycle2: ;do
1242
				movzx eax,word[edi+deflate_state.pending]
1240
				mov eax,[edi+deflate_state.pending]
1243
				cmp eax,[edi+deflate_state.pending_buf_size]
1241
				cmp eax,[edi+deflate_state.pending_buf_size]
1244
				jne .end26 ;if (..==..)
1242
				jne .end26 ;if (..==..)
1245
					mov dword[edx+gz_header.hcrc],0
1243
					mov dword[edx+gz_header.hcrc],0
1246
					je @f
1244
					je @f
1247
					cmp [edi+deflate_state.pending],si
1245
					cmp [edi+deflate_state.pending],esi
1248
					jle @f ;if (.. && ..>..)
1246
					jle @f ;if (.. && ..>..)
1249
						movzx ecx,word[edi+deflate_state.pending]
1247
						mov ecx,[edi+deflate_state.pending]
1250
						sub ecx,esi
1248
						sub ecx,esi
1251
						mov eax,[edi+deflate_state.pending_buf]
1249
						mov eax,[edi+deflate_state.pending_buf]
1252
						add eax,esi
1250
						add eax,esi
1253
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1251
						stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1254
						mov [ebx+z_stream.adler],eax
1252
						mov [ebx+z_stream.adler],eax
1255
					@@:
1253
					@@:
1256
					stdcall flush_pending, ebx
1254
					stdcall flush_pending, ebx
1257
					movzx esi,word[edi+deflate_state.pending]
-
 
1258
					movzx eax,word[edi+deflate_state.pending]
1255
					mov esi,[edi+deflate_state.pending]
1259
					cmp eax,[edi+deflate_state.pending_buf_size]
1256
					cmp esi,[edi+deflate_state.pending_buf_size]
1260
					jne .end26 ;if (..==..)
1257
					jne .end26 ;if (..==..)
1261
						mov dword[val],1
1258
						mov dword[val],1
1262
						jmp .cycle2end
1259
						jmp .cycle2end
1263
				.end26:
1260
				.end26:
Line 1272... Line 1269...
1272
				cmp dword[val],0
1269
				cmp dword[val],0
1273
				jne .cycle2 ;while (val != 0)
1270
				jne .cycle2 ;while (val != 0)
1274
			.cycle2end:
1271
			.cycle2end:
1275
			mov dword[edx+gz_header.hcrc],0
1272
			mov dword[edx+gz_header.hcrc],0
1276
			je @f
1273
			je @f
1277
			cmp [edi+deflate_state.pending],si
1274
			cmp [edi+deflate_state.pending],esi
1278
			jle @f ;if (.. && ..>..)
1275
			jle @f ;if (.. && ..>..)
1279
				movzx ecx,word[edi+deflate_state.pending]
1276
				mov ecx,[edi+deflate_state.pending]
1280
				sub ecx,esi
1277
				sub ecx,esi
1281
				mov eax,[edi+deflate_state.pending_buf]
1278
				mov eax,[edi+deflate_state.pending_buf]
1282
				add eax,esi
1279
				add eax,esi
1283
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1280
				stdcall calc_crc32, [ebx+z_stream.adler], eax, ecx
1284
				mov [ebx+z_stream.adler],eax
1281
				mov [ebx+z_stream.adler],eax
Line 1292... Line 1289...
1292
	.end7:
1289
	.end7:
1293
	cmp dword[edi+deflate_state.status],HCRC_STATE
1290
	cmp dword[edi+deflate_state.status],HCRC_STATE
1294
	jne .end8 ;if (..==..)
1291
	jne .end8 ;if (..==..)
1295
		cmp dword[edx+gz_header.hcrc],0
1292
		cmp dword[edx+gz_header.hcrc],0
1296
		je .end9 ;if (..)
1293
		je .end9 ;if (..)
1297
			movzx ecx,word[edi+deflate_state.pending]
1294
			mov ecx,[edi+deflate_state.pending]
1298
			add ecx,2
1295
			add ecx,2
1299
			cmp ecx,[edi+deflate_state.pending_buf_size]
1296
			cmp ecx,[edi+deflate_state.pending_buf_size]
1300
			jle @f ;if (..>..)
1297
			jle @f ;if (..>..)
1301
				stdcall flush_pending, ebx
1298
				stdcall flush_pending, ebx
1302
			@@:
1299
			@@:
1303
			movzx ecx,word[edi+deflate_state.pending]
1300
			mov ecx,[edi+deflate_state.pending]
1304
			add ecx,2
1301
			add ecx,2
1305
			cmp ecx,[edi+deflate_state.pending_buf_size]
1302
			cmp ecx,[edi+deflate_state.pending_buf_size]
1306
			jg @f ;if (..<=..)
1303
			jg @f ;if (..<=..)
1307
				mov ecx,[ebx+z_stream.adler]
1304
				mov ecx,[ebx+z_stream.adler]
1308
				put_byte edi, cl
1305
				put_byte edi, cl
Line 1316... Line 1313...
1316
			mov dword[edi+deflate_state.status],BUSY_STATE
1313
			mov dword[edi+deflate_state.status],BUSY_STATE
1317
	.end8:
1314
	.end8:
1318
end if
1315
end if
Line 1319... Line 1316...
1319
 
1316
 
1320
	; Flush as much pending output as possible
1317
	; Flush as much pending output as possible
1321
	cmp word[edi+deflate_state.pending],0
1318
	cmp dword[edi+deflate_state.pending],0
1322
	je .end13 ;if (..!=0)
1319
	je .end13 ;if (..!=0)
1323
		stdcall flush_pending, ebx
1320
		stdcall flush_pending, ebx
1324
		cmp word[ebx+z_stream.avail_out],0
1321
		cmp word[ebx+z_stream.avail_out],0
1325
		jne @f ;if (..==0)
1322
		jne @f ;if (..==0)
Line 1476... Line 1473...
1476
	.end17:
1473
	.end17:
1477
	stdcall flush_pending, ebx
1474
	stdcall flush_pending, ebx
1478
	; If avail_out is zero, the application will call deflate again
1475
	; If avail_out is zero, the application will call deflate again
1479
	; to flush the rest.
1476
	; to flush the rest.
Line 1480... Line 1477...
1480
 
1477
 
1481
	cmp word[edi+deflate_state.pending],0
1478
	cmp dword[edi+deflate_state.pending],0
1482
	jle @f ;if (..>0) ;write the trailer only once!
1479
	jle @f ;if (..>0) ;write the trailer only once!
1483
		neg word[edi+deflate_state.pending]
1480
		neg dword[edi+deflate_state.pending]
1484
		inc word[edi+deflate_state.pending]
1481
		inc dword[edi+deflate_state.pending]
1485
	@@:
1482
	@@:
1486
	mov eax,Z_OK
1483
	mov eax,Z_OK
1487
	cmp word[edi+deflate_state.pending],0
1484
	cmp dword[edi+deflate_state.pending],0
1488
	je .end_f
1485
	je .end_f
1489
		mov eax,Z_STREAM_END
1486
		mov eax,Z_STREAM_END
1490
.end_f:
1487
.end_f:
1491
zlib_debug '  deflate.ret = %d',eax
1488
zlib_debug '  deflate.ret = %d',eax