Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6881 → Rev 6880

/programs/fs/kfar/trunk/zlib/crc32.asm
17,10 → 17,14
 
; Definitions for doing the crc four data bytes at a time.
 
TBLS equ 1
 
if DYNAMIC_CRC_TABLE eq 1
 
align 4
crc_table_empty dd 1
;align 4
;crc_table rd TBLS*256
 
; Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
; x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
96,12 → 100,15
endp
 
; =========================================================================
;unsigned long (unsigned long crc, unsigned char *buf, uInt len)
;unsigned long (crc, buf, len)
; unsigned long crc
; unsigned char *buf
; uInt len
align 4
proc calc_crc32 uses ecx esi, p1crc:dword, buf:dword, len:dword
xor eax,eax
mov esi,[buf]
 
zlib_debug 'calc_crc32 buf = %d',esi
cmp esi,Z_NULL
je .end_f ;if (..==0) return 0
 
114,9 → 121,7
 
mov eax,[p1crc]
mov ecx,[len]
push edx
call crc
pop edx
.end_f:
ret
endp
124,7 → 129,9
GF2_DIM equ 32 ;dimension of GF(2) vectors (length of CRC)
 
; =========================================================================
;unsigned long (unsigned long *mat, unsigned long vec)
;unsigned long (mat, vec)
; unsigned long *mat
; unsigned long vec
align 4
proc gf2_matrix_times, mat:dword, vec:dword
; unsigned long sum;
141,7 → 148,9
endp
 
; =========================================================================
;local void (unsigned long *square, unsigned long *mat)
;local void (square, mat)
; unsigned long *square
; unsigned long *mat
align 4
proc gf2_matrix_square, square:dword, mat:dword
; int n;
152,7 → 161,10
endp
 
; =========================================================================
;uLong (uLong crc1, uLong crc2, z_off64_t len2)
;uLong (crc1, crc2, len2)
; uLong crc1
; uLong crc2
; z_off64_t len2
align 4
proc crc32_combine_, crc1:dword, crc2:dword, len2:dword
; int n;
207,7 → 219,10
endp
 
; =========================================================================
;uLong (uLong crc1, uLong crc2, z_off_t len2)
;uLong (crc1, crc2, len2)
; uLong crc1
; uLong crc2
; z_off_t len2
align 4
proc crc32_combine, crc1:dword, crc2:dword, len2:dword
stdcall crc32_combine_, [crc1], [crc2], [len2]
214,7 → 229,10
ret
endp
 
;uLong (uLong crc1, uLong crc2, z_off64_t len2)
;uLong (crc1, crc2, len2)
; uLong crc1
; uLong crc2
; z_off64_t len2
align 4
proc crc32_combine64, crc1:dword, crc2:dword, len2:dword
stdcall crc32_combine_, [crc1], [crc2], [len2]
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwrite.asm
631,8 → 631,8
stdcall png_create_png_struct, [user_png_ver], [error_ptr], [error_fn], [warn_fn], 0, 0, 0
;eax = png_ptr
end if ;USER_MEM
test eax,eax
jz .end0 ;if (..!=0)
cmp eax,0
je .end0 ;if (..!=0)
; Set the zlib control values to defaults; they can be overridden by the
; application after the struct has been created.
 
1839,20 → 1839,20
stdcall png_create_write_struct, PNG_LIBPNG_VER_STRING, ebx, png_safe_error, png_safe_warning
;eax = png_ptr
 
test eax,eax
jz .end0 ;if (..!=0)
cmp eax,0
je .end0 ;if (..!=0)
mov edi,eax
stdcall png_create_info_struct, edi
;eax = info_ptr
 
test eax,eax
jz .end1 ;if (..!=0)
cmp eax,0
je .end1 ;if (..!=0)
mov esi,eax
stdcall png_malloc_warn, edi, sizeof.png_control
;control = eax
 
test eax,eax
jz .end2 ;if (..!=0)
cmp eax,0
je .end2 ;if (..!=0)
push eax
mov edx,edi ; edx = png_ptr
mov ecx,sizeof.png_control
2745,8 → 2745,8
stdcall png_free, edi, ecx
 
; Skip the 'write_end' on error:
test eax,eax
jz .end_f ;if (..==0) return 0
cmp eax,0
je .end_f ;if (..==0) return 0
jmp .end8
 
; Otherwise this is the case where the input is in a format currently
2793,8 → 2793,8
 
;create buffer with filters
stdcall png_zalloc, edi, 1, [len]
test eax,eax
jz .end_f
cmp eax,0
je .end_f
mov [buf_f],eax
 
mov eax,ZLIB_IO_MAX
2803,8 → 2803,8
mov eax,[len]
@@:
stdcall png_zalloc, edi, 1, eax
test eax,eax
jz .end0
cmp eax,0
je .end0
mov [m1],eax
 
;init buffer with filters
3100,8 → 3100,8
@@:
 
stdcall png_image_write_init, ebx
test eax,eax
jz .end3 ;if (..!=0)
cmp eax,0
je .end3 ;if (..!=0)
mov ecx,sizeof.png_image_write_control
mov edi,ebp
sub edi,ecx
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwutil.asm
82,14 → 82,14
buf rb 8 ;ebp-8
endl
 
if (PNG_DEBUG eq 1) & (PNG_DEBUG > 0)
;#if defined(PNG_DEBUG) && (PNG_DEBUG > 0)
; PNG_CSTRING_FROM_CHUNK(buf, chunk_name);
; png_debug2(0, "Writing %s chunk, length = %lu", buf, (unsigned long)length);
end if
;end if
 
mov edi,[png_ptr]
test edi,edi
jz .end_f ;if (..==0) return
cmp edi,0
je .end_f ;if (png_ptr == NULL) return
 
if PNG_IO_STATE_SUPPORTED eq 1
; Inform the I/O callback that the chunk header is being written.
99,7 → 99,8
end if
 
; Write the length and the chunk name
lea ebx,[ebp-8]
mov ebx,ebp
sub ebx,8
stdcall png_save_uint_32, ebx, [length]
m2m dword[ebx+4],dword[chunk_name]
stdcall png_write_data, edi, ebx, 8
109,7 → 110,9
 
; Reset the crc and run it over the chunk name
stdcall png_reset_crc, edi
lea ebx,[ebp-4] ;buf + 4
 
mov ebx,ebp
sub ebx,4 ;buf + 4
stdcall png_calculate_crc, edi, ebx, 4
 
if PNG_IO_STATE_SUPPORTED eq 1
196,8 → 199,8
align 4
proc png_write_complete_chunk uses edi, png_ptr:dword, chunk_name:dword, p3data:dword, length:dword
mov edi,[png_ptr]
test edi,edi
jz .end_f ;if (..==0) return
cmp edi,0
je .end_f ;if (..==0) return
 
; On 64-bit architectures 'length' may not fit in a uint_32.
cmp dword[length],PNG_UINT_31_MAX ;if(..>..)
675,14 → 678,14
mov eax,[edx]
mov [next],eax
 
test eax,eax
jnz .end1 ;if (..==0)
cmp eax,0
jne .end1 ;if (..==0)
PNG_COMPRESSION_BUFFER_SIZE edi
stdcall png_malloc, edi, eax
mov [next],eax
 
test eax,eax
jnz @f ;if (..==0)
cmp eax,0
jne @f ;if (..==0)
mov esi,Z_MEM_ERROR
jmp .cycle0end
@@:
1177,7 → 1180,6
align 4
proc png_compress_IDAT uses eax ebx ecx edx, input:dword, input_len:dword, flush:dword
png_debug 1, 'in png_compress_IDAT'
 
cmp dword[edi+png_struct.zowner],png_IDAT
je .end0 ;if (..!=..)
; First time. Ensure we have a temporary buffer for compression and
1230,7 → 1232,7
mov eax,ZLIB_IO_MAX
 
cmp eax,[input_len]
jbe @f ;if (..>..)
jle @f ;if (..>..)
mov eax,[input_len] ;safe because of the check
@@:
 
1449,8 → 1451,8
stdcall png_check_keyword, edi, [name], ebx
mov [name_len],eax
 
test eax,eax
jnz @f ;if (..==0)
cmp eax,0
jne @f ;if (..==0)
png_error edi, 'iCCP: invalid keyword'
@@:
 
1953,8 → 1955,8
stdcall png_check_keyword, edi, [key], ebx
mov [key_len],eax
 
test eax,eax
jnz @f ;if (..==0)
cmp eax,0
jne @f ;if (..==0)
png_error edi, 'iTXt: invalid keyword'
@@:
 
2101,8 → 2103,8
stdcall png_check_keyword, edi, [purpose], ebx
mov [purpose_len],eax
 
test eax,eax
jnz @f ;if(..==0)
cmp eax,0
jne @f ;if(..==0)
png_error edi, 'pCAL: invalid keyword'
@@:
 
2458,6 → 2460,8
 
; See if we are done
mov eax,[edi+png_struct.row_number]
;png_debug1 2, ' row_number = %d', eax
;png_debug1 2, ' num_rows = %d', [edi+png_struct.num_rows]
cmp eax,[edi+png_struct.num_rows]
jl .end_f ;if (..<..) return
 
3059,17 → 3063,13
endl
pushad
mov edi,[png_ptr]
if PNG_WRITE_FILTER_SUPPORTED eq 0
mov eax,[edi+png_struct.row_number]
png_debug1 2, ' (3)= %d', eax
if PNG_WRITE_FILTER_SUPPORTED eq 1
mov eax,[edi+png_struct.rowbytes]
inc eax
stdcall png_write_filtered_row, edi, [edi+png_struct.row_buf], eax
mov eax,[edi+png_struct.row_number]
png_debug1 2, ' (4)= %d', eax
else
mov esi,[row_info]
movzx eax,byte[edi+png_struct.do_filter]
mov eax,[edi+png_struct.do_filter]
mov [filter_to_do],eax
mov eax,[esi+png_row_info.rowbytes]
mov [row_bytes],eax
3119,8 → 3119,8
mov eax,[edi+png_struct.row_buf]
mov [best_row],eax
 
cmp dword[row_bytes],PNG_SIZE_MAX/128
jl @f ;if (..>=..)
cmp PNG_SIZE_MAX/128, dword[row_bytes]
jg @f ;if (..<=..)
; Overflow can occur in the calculation, just select the lowest set
; filter.
 
3168,8 → 3168,8
mov [mins],eax
mov eax,[edi+png_struct.try_row]
mov [best_row],eax
test eax,eax
jz .end1 ;if (..!=0)
cmp eax,0
je .end1 ;if (..!=0)
mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax
mov eax,[best_row]
3194,8 → 3194,8
mov [mins],eax
mov eax,[edi+png_struct.try_row]
mov [best_row],eax
test eax,eax
jz .end2 ;if (..!=0)
cmp eax,0
je .end2 ;if (..!=0)
mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax
mov eax,[best_row]
3220,14 → 3220,14
mov [mins],eax
mov eax,[edi+png_struct.try_row]
mov [best_row],eax
test eax,eax
jz .end3 ;if (..!=0)
cmp eax,0
je .end3 ;if (..!=0)
mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax
mov eax,[best_row]
mov [edi+png_struct.tst_row],eax
.end3:
if 0 ;;; tmp
 
; Paeth filter
mov eax,[filter_to_do]
cmp eax,PNG_FILTER_PAETH
3246,14 → 3246,14
mov [mins],eax
mov eax,[edi+png_struct.try_row]
mov [best_row],eax
test eax,eax
jz .end4 ;if (..!=0)
cmp eax,0
je .end4 ;if (..!=0)
mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax
mov eax,[best_row]
mov [edi+png_struct.tst_row],eax
.end4:
end if
 
; Do the actual writing of the filtered row data from the chosen filter.
mov eax,[esi+png_row_info.rowbytes]
inc eax
3281,8 → 3281,8
if PNG_WRITE_FILTER_SUPPORTED eq 1
; Swap the current and previous rows
mov eax,[edi+png_struct.prev_row]
test eax,eax
jz @f ;if (..!=0)
cmp eax,0
je @f ;if (..!=0)
;eax = tptr
mov ebx,[edi+png_struct.row_buf]
mov [edi+png_struct.prev_row],ebx
/programs/develop/libraries/libs-dev/libimg/png/libpng/png.inc
554,7 → 554,6
 
struct png_unknown_chunk
name rb 5 ;byte[5] ;Textual chunk name with '\0' terminator
rb 3 ;align
podata dd ? ;byte* ;Data, should not be modified on read!
size dd ? ;png_size_t
 
/programs/develop/libraries/libs-dev/libimg/png/libpng/png.asm
10,9 → 10,10
; For conditions of distribution and use, see the disclaimer
; and license in png.inc
 
DEBUG equ 0
crc_table rd 256
 
include '../../../../../../KOSfuncs.inc'
include '../../../../../../fs/kfar/trunk/kfar_arc/crc.inc'
include '../../../../../../fs/kfar/trunk/zlib/deflate.inc'
include 'pngtokos.inc' ;integrate png to kos
 
1293,8 → 1294,8
je @f ;if (..==0) ;reduce code size; check here not in the caller
mov ecx,sizeof.png_colorspace
mov esi,[png_ptr]
add esi,png_struct.colorspace
add edi,png_info_def.colorspace
mov esi,[esi+png_struct.colorspace]
mov edi,[edi+png_info_def.colorspace]
rep movsb
stdcall png_colorspace_sync_info, [png_ptr], [info_ptr]
@@:
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngget.asm
1183,16 → 1183,16
end if
; {
if PNG_SEQUENTIAL_READ_SUPPORTED eq 1
mov eax,[eax+png_struct.IDAT_read_size]
; return png_ptr->IDAT_read_size;
else
mov eax,PNG_IDAT_READ_SIZE
jmp .end_f
end if
; }
 
if PNG_WRITE_SUPPORTED eq 1
jmp .end_f
; else
mov eax,[eax+png_struct.zbuffer_size]
; return png_ptr->zbuffer_size;
end if
.end_f:
ret
/programs/develop/libraries/libs-dev/libimg/png/libpng/pnginfo.inc
135,7 → 135,8
sig_bit png_color_8 ; significant bits in color channels
end if
 
if (PNG_tRNS_SUPPORTED eq 1) | (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
;#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
;defined(PNG_READ_BACKGROUND_SUPPORTED)
; The tRNS chunk supplies transparency data for paletted images and
; other image types that don't need a full alpha channel. There are
; "num_trans" transparency values for a paletted image, stored in the
147,7 → 148,7
 
trans_alpha dd ? ;bytep ; alpha values for paletted image
trans_color png_color_16 ;transparent color for non-palette image
end if
;end if
 
if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
; The bKGD chunk gives the suggested image background color if the
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngstruct.inc
126,7 → 126,7
 
struct png_struct
if PNG_SETJMP_SUPPORTED eq 1
jmp_buf_local rb 64 ;jmp_buf ;New name in 1.6.0 for jmp_buf in png_struct
jmp_buf_local dd ? ;jmp_buf ;New name in 1.6.0 for jmp_buf in png_struct
longjmp_fn dd ? ;png_longjmp_ptr ;setjmp non-local goto function.
jmp_buf_ptr dd ? ;jmp_buf * ;passed to longjmp_fn
jmp_buf_size dd ? ;size_t ;size of the above, if allocated
154,7 → 154,6
user_transform_ptr dd ? ;voidp ;user supplied struct for user transform
user_transform_depth db ? ;byte ;bit depth of user transformed pixels
user_transform_channels db ? ;byte ;channels in user transformed pixels
rb 2 ;align
end if
end if
 
217,7 → 216,7
crc dd ? ;uint_32 ;current chunk CRC value
palette dd ? ;png_colorp ;palette from the input file
num_palette dw ? ;uint_16 ;number of color entries in palette
rb 2 ;align
 
; Added at libpng-1.5.10
if PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED eq 1
num_palette_max dd ? ;int ;maximum palette index found in IDAT
238,9 → 237,9
sig_bytes db ? ;byte ;magic bytes read/written from start of file
maximum_pixel_depth db ? ;byte ;pixel depth used for the row buffers
transformed_pixel_depth db ? ;byte ;pixel depth after read/write transforms
;if PNG_ZLIB_VERNUM >= 0x1240
;zstream_start db 1 ;byte ;at start of an input zlib stream
;end if ;Zlib >= 1.2.4
;#if PNG_ZLIB_VERNUM >= 0x1240
zstream_start db ? ;byte ;at start of an input zlib stream
;end if /* Zlib >= 1.2.4 */
if (PNG_READ_FILLER_SUPPORTED eq 1) | (PNG_WRITE_FILLER_SUPPORTED eq 1)
filler dw ? ;uint_16 ;filler bytes for pixel expansion
end if
248,13 → 247,10
if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) | \
(PNG_READ_ALPHA_MODE_SUPPORTED eq 1)
background_gamma_type db ? ;byte
rb 1 ;align
background_gamma dd ? ;png_fixed_point
background png_color_16 ;background color in screen gamma space
rb 1 ;align
if PNG_READ_GAMMA_SUPPORTED eq 1
background_1 png_color_16 ;background normalized to gamma 1.0
rb 1 ;align
end if
end if ;bKGD
 
286,7 → 282,6
 
if (PNG_READ_SHIFT_SUPPORTED eq 1) | (PNG_WRITE_SHIFT_SUPPORTED eq 1)
shift png_color_8 ;shift for significant bit tranformation
rb 2 ;align
end if
 
if (PNG_tRNS_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) \
293,7 → 288,6
| (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
trans_alpha dd ? ;bytep ;alpha values for paletted files
trans_color png_color_16 ;transparent color for non-paletted files
rb 3 ;align
end if
 
read_row_fn dd ? ;png_read_status_ptr ;called after each row is decoded
331,7 → 325,6
; To do: remove this from libpng-1.7
if PNG_TIME_RFC1123_SUPPORTED eq 1
time_buffer rb 29 ;char[29] ;String to hold RFC 1123 time text
rb 2 ;align
end if
;end if
 
362,7 → 355,6
rgb_to_gray_red_coeff dw ? ;uint_16
rgb_to_gray_green_coeff dw ? ;uint_16
; deleted in 1.5.5: rgb_to_gray_blue_coeff;
rb 2 ;align
end if
 
if PNG_MNG_FEATURES_SUPPORTED eq 1
372,7 → 364,6
 
; New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0
filter_type db ? ;byte
rb 3 ;align
end if
 
; New members added in libpng-1.2.0
396,7 → 387,6
 
; New members added in libpng-1.0.16 and 1.2.6
compression_type db ? ;byte
rb 3 ;align
 
if PNG_USER_LIMITS_SUPPORTED eq 1
user_width_max dd ? ;uint_32
418,8 → 408,7
; Temporary storage for unknown chunk that the library doesn't recognize,
; used while reading the chunk.
 
unknown_chunk png_unknown_chunk
rb 3 ;align
; png_unknown_chunk unknown_chunk;
end if
 
; New member added in libpng-1.2.26
443,7 → 432,8
big_prev_row dd ? ;bytep
 
; New member added in libpng-1.5.7
read_filter rd PNG_FILTER_VALUE_LAST-1
; void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
; bytep row, bytep prev_row);
 
if PNG_READ_SUPPORTED eq 1
if (PNG_COLORSPACE_SUPPORTED eq 1) | (PNG_GAMMA_SUPPORTED eq 1)