@@ -509,7 +509,7 @@ typedef enum modes { k_generate_avl, k_extract, k_list, k_rewrite } modes;
509
509
typedef enum errors { err_end_of_sector = -5001 , err_iso_rewritten = -5002 , err_iso_no_files = -5003 } errors ;
510
510
511
511
typedef void (* progress_callback )( xoff_t in_current_value , xoff_t in_final_value );
512
- typedef int32_t (* traversal_callback )( void * in_node , void * in_context , long in_depth );
512
+ typedef int32_t (* traversal_callback )( void * in_node , void * in_context , int32_t in_depth );
513
513
514
514
typedef struct dir_node dir_node ;
515
515
typedef struct create_list create_list ;
@@ -526,20 +526,20 @@ struct dir_node {
526
526
unsigned char attributes ;
527
527
unsigned char filename_length ;
528
528
529
- unsigned long file_size ;
530
- unsigned long start_sector ;
529
+ u_int32_t file_size ;
530
+ u_int32_t start_sector ;
531
531
};
532
532
533
533
struct dir_node_avl {
534
- unsigned long offset ;
534
+ u_int32_t offset ;
535
535
xoff_t dir_start ;
536
536
537
537
char * filename ;
538
- unsigned long file_size ;
539
- unsigned long start_sector ;
538
+ u_int32_t file_size ;
539
+ u_int32_t start_sector ;
540
540
dir_node_avl * subdirectory ;
541
541
542
- unsigned long old_start_sector ;
542
+ u_int32_t old_start_sector ;
543
543
544
544
avl_skew skew ;
545
545
dir_node_avl * left ;
@@ -553,13 +553,13 @@ struct create_list {
553
553
};
554
554
555
555
typedef struct FILE_TIME {
556
- unsigned long l ;
557
- unsigned long h ;
556
+ u_int32_t l ;
557
+ u_int32_t h ;
558
558
} FILE_TIME ;
559
559
560
560
typedef struct wdsafp_context {
561
561
xoff_t dir_start ;
562
- unsigned long * current_sector ;
562
+ u_int32_t * current_sector ;
563
563
} wdsafp_context ;
564
564
565
565
typedef struct write_tree_context {
@@ -579,13 +579,13 @@ avl_result avl_left_grown( dir_node_avl **in_root );
579
579
avl_result avl_right_grown ( dir_node_avl * * in_root );
580
580
dir_node_avl * avl_fetch ( dir_node_avl * in_root , char * in_filename );
581
581
avl_result avl_insert ( dir_node_avl * * in_root , dir_node_avl * in_node );
582
- int32_t avl_traverse_depth_first ( dir_node_avl * in_root , traversal_callback in_callback , void * in_context , avl_traversal_method in_method , long in_depth );
582
+ int32_t avl_traverse_depth_first ( dir_node_avl * in_root , traversal_callback in_callback , void * in_context , avl_traversal_method in_method , int32_t in_depth );
583
583
584
584
void boyer_moore_done ();
585
- char * boyer_moore_search ( char * in_text , long in_text_len );
586
- int32_t boyer_moore_init ( char * in_pattern , long in_pat_len , long in_alphabet_size );
585
+ char * boyer_moore_search ( char * in_text , int32_t in_text_len );
586
+ int32_t boyer_moore_init ( char * in_pattern , int32_t in_pat_len , int32_t in_alphabet_size );
587
587
588
- int32_t free_dir_node_avl ( void * in_dir_node_avl , void * , long );
588
+ int32_t free_dir_node_avl ( void * in_dir_node_avl , void * , int32_t );
589
589
int32_t extract_file ( int32_t in_xiso , dir_node * in_file , modes in_mode , char * path );
590
590
int32_t decode_xiso ( char * in_xiso , char * in_path , modes in_mode , char * * out_iso_path , bool in_ll_compat );
591
591
int32_t verify_xiso ( int32_t in_xiso , int32_t * out_root_dir_sector , int32_t * out_root_dir_size , char * in_iso_name );
@@ -599,22 +599,22 @@ int32_t write_directory( dir_node_avl *in_avl, int32_t in_xiso, int32_t in_depth
599
599
int32_t write_file ( dir_node_avl * in_avl , write_tree_context * in_context , int32_t in_depth );
600
600
int32_t write_tree ( dir_node_avl * in_avl , write_tree_context * in_context , int32_t in_depth );
601
601
int32_t calculate_total_files_and_bytes ( dir_node_avl * in_avl , void * in_context , int32_t in_depth );
602
- int32_t calculate_directory_size ( dir_node_avl * in_avl , unsigned long * out_size , long in_depth );
602
+ int32_t calculate_directory_size ( dir_node_avl * in_avl , u_int32_t * out_size , int32_t in_depth );
603
603
int32_t calculate_directory_requirements ( dir_node_avl * in_avl , void * in_context , int32_t in_depth );
604
- int32_t calculate_directory_offsets ( dir_node_avl * in_avl , unsigned long * io_context , int32_t in_depth );
604
+ int32_t calculate_directory_offsets ( dir_node_avl * in_avl , u_int32_t * io_context , int32_t in_depth );
605
605
int32_t write_dir_start_and_file_positions ( dir_node_avl * in_avl , wdsafp_context * io_context , int32_t in_depth );
606
- int32_t write_volume_descriptors ( int32_t in_xiso , unsigned long in_total_sectors );
606
+ int32_t write_volume_descriptors ( int32_t in_xiso , u_int32_t in_total_sectors );
607
607
608
608
#if DEBUG
609
609
void write_sector ( int32_t in_xiso , xoff_t in_start , char * in_name , char * in_extension );
610
610
#endif
611
611
612
612
613
- static long s_pat_len ;
613
+ static int32_t s_pat_len ;
614
614
static bool s_quiet = false;
615
615
static char * s_pattern = nil ;
616
- static long * s_gs_table = nil ;
617
- static long * s_bc_table = nil ;
616
+ static int32_t * s_gs_table = nil ;
617
+ static int32_t * s_bc_table = nil ;
618
618
static xoff_t s_total_bytes = 0 ;
619
619
static int s_total_files = 0 ;
620
620
static char * s_copy_buffer = nil ;
@@ -640,7 +640,7 @@ int main( int argc, char **argv ) {
640
640
create_list * create = nil , * p , * q , * * r ;
641
641
int32_t i , fd , opt_char , err = 0 , isos = 0 ;
642
642
bool extract = true, rewrite = false, free_user = false, free_pass = false, x_seen = false, delete = false, optimized ;
643
- char * cwd = nil , * path = nil , * buf = nil , * new_iso_path = nil , tag [ XISO_OPTIMIZED_TAG_LENGTH * sizeof (long ) ];
643
+ char * cwd = nil , * path = nil , * buf = nil , * new_iso_path = nil , tag [ XISO_OPTIMIZED_TAG_LENGTH * sizeof (int32_t ) ];
644
644
645
645
if ( argc < 2 ) { usage (); exit ( 1 ); }
646
646
@@ -819,7 +819,7 @@ int main( int argc, char **argv ) {
819
819
}
820
820
}
821
821
822
- if ( ! err ) exiso_log ( "\n%u files in %s total %lld bytes\n" , s_total_files , rewrite ? new_iso_path : argv [ i ], (long long int ) s_total_bytes );
822
+ if ( ! err ) exiso_log ( "\n%u files in %s total %lld bytes\n" , s_total_files , rewrite ? new_iso_path : argv [ i ], (int64_t ) s_total_bytes );
823
823
824
824
if ( new_iso_path ) {
825
825
if ( ! err ) exiso_log ( "\n%s successfully rewritten%s%s\n" , argv [ i ], path ? " as " : "." , path ? new_iso_path : "" );
@@ -831,7 +831,7 @@ int main( int argc, char **argv ) {
831
831
if ( err == err_iso_no_files ) err = 0 ;
832
832
}
833
833
834
- if ( ! err && isos > 1 ) exiso_log ( "\n%u files in %u xiso's total %lld bytes\n" , s_total_files_all_isos , isos , (long long int ) s_total_bytes_all_isos );
834
+ if ( ! err && isos > 1 ) exiso_log ( "\n%u files in %u xiso's total %lld bytes\n" , s_total_files_all_isos , isos , (int64_t ) s_total_bytes_all_isos );
835
835
if ( s_warned ) exiso_log ( "\nWARNING: Warning(s) were issued during execution--review stderr!\n" );
836
836
837
837
boyer_moore_done ();
@@ -928,7 +928,7 @@ int32_t create_xiso( char *in_root_directory, char *in_output_directory, dir_nod
928
928
dir_node_avl root ;
929
929
FILE_TIME * ft = nil ;
930
930
write_tree_context wt_context ;
931
- unsigned long start_sector ;
931
+ u_int32_t start_sector ;
932
932
int32_t i , n , xiso = -1 , err = 0 ;
933
933
char * cwd = nil , * buf = nil , * iso_name , * xiso_path , * iso_dir ;
934
934
@@ -1060,7 +1060,7 @@ int32_t create_xiso( char *in_root_directory, char *in_output_directory, dir_nod
1060
1060
1061
1061
if ( ! in_root ) {
1062
1062
if ( err ) { exiso_log ( "\ncould not create %s%s\n" , iso_name ? iso_name : "xiso" , iso_name && ! in_name ? ".iso" : "" ); }
1063
- else exiso_log ( "\nsucessfully created %s%s (%u files totalling %lld bytes added)\n" , iso_name ? iso_name : "xiso" , iso_name && ! in_name ? ".iso" : "" , s_total_files , (long long int ) s_total_bytes );
1063
+ else exiso_log ( "\nsucessfully created %s%s (%u files totalling %lld bytes added)\n" , iso_name ? iso_name : "xiso" , iso_name && ! in_name ? ".iso" : "" , s_total_files , (int64_t ) s_total_bytes );
1064
1064
}
1065
1065
1066
1066
if ( root .subdirectory != EMPTY_SUBDIRECTORY ) avl_traverse_depth_first ( root .subdirectory , free_dir_node_avl , nil , k_postfix , 0 );
@@ -1505,7 +1505,7 @@ int32_t avl_compare_key( char *in_lhs, char *in_rhs ) {
1505
1505
}
1506
1506
1507
1507
1508
- int32_t avl_traverse_depth_first ( dir_node_avl * in_root , traversal_callback in_callback , void * in_context , avl_traversal_method in_method , long in_depth ) {
1508
+ int32_t avl_traverse_depth_first ( dir_node_avl * in_root , traversal_callback in_callback , void * in_context , avl_traversal_method in_method , int32_t in_depth ) {
1509
1509
int32_t err ;
1510
1510
1511
1511
if ( in_root == nil ) return 0 ;
@@ -1541,19 +1541,19 @@ int32_t avl_traverse_depth_first( dir_node_avl *in_root, traversal_callback in_c
1541
1541
#endif
1542
1542
1543
1543
1544
- int32_t boyer_moore_init ( char * in_pattern , long in_pat_len , long in_alphabet_size ) {
1545
- long i , j , k , * backup , err = 0 ;
1544
+ int32_t boyer_moore_init ( char * in_pattern , int32_t in_pat_len , int32_t in_alphabet_size ) {
1545
+ int32_t i , j , k , * backup , err = 0 ;
1546
1546
1547
1547
s_pattern = in_pattern ;
1548
1548
s_pat_len = in_pat_len ;
1549
1549
1550
- if ( ( s_bc_table = (long * ) malloc ( in_alphabet_size * sizeof (long ) ) ) == nil ) mem_err ();
1550
+ if ( ( s_bc_table = (int32_t * ) malloc ( in_alphabet_size * sizeof (int32_t ) ) ) == nil ) mem_err ();
1551
1551
1552
1552
if ( ! err ) {
1553
1553
for ( i = 0 ; i < in_alphabet_size ; ++ i ) s_bc_table [ i ] = in_pat_len ;
1554
1554
for ( i = 0 ; i < in_pat_len - 1 ; ++ i ) s_bc_table [ (unsigned char ) in_pattern [ i ] ] = in_pat_len - i - 1 ;
1555
1555
1556
- if ( ( s_gs_table = (long * ) malloc ( 2 * ( in_pat_len + 1 ) * sizeof (long ) ) ) == nil ) mem_err ();
1556
+ if ( ( s_gs_table = (int32_t * ) malloc ( 2 * ( in_pat_len + 1 ) * sizeof (int32_t ) ) ) == nil ) mem_err ();
1557
1557
}
1558
1558
1559
1559
if ( ! err ) {
@@ -1587,8 +1587,8 @@ void boyer_moore_done() {
1587
1587
}
1588
1588
1589
1589
1590
- char * boyer_moore_search ( char * in_text , long in_text_len ) {
1591
- long i , j , k , l ;
1590
+ char * boyer_moore_search ( char * in_text , int32_t in_text_len ) {
1591
+ int32_t i , j , k , l ;
1592
1592
1593
1593
for ( i = j = s_pat_len - 1 ; j < in_text_len && i >= 0 ; ) {
1594
1594
if ( in_text [ j ] == s_pattern [ i ] ) { -- i ; -- j ; }
@@ -1615,7 +1615,7 @@ int32_t extract_file( int32_t in_xiso, dir_node *in_file, modes in_mode , char*
1615
1615
char c ;
1616
1616
int32_t err = 0 ;
1617
1617
bool warn = false;
1618
- unsigned long i , size , totalsize = 0 , totalpercent = 0 ;
1618
+ u_int32_t i , size , totalsize = 0 , totalpercent = 0 ;
1619
1619
int32_t out ;
1620
1620
1621
1621
if ( s_remove_systemupdate && strstr ( path , s_systemupdate ) )
@@ -1669,7 +1669,7 @@ int32_t extract_file( int32_t in_xiso, dir_node *in_file, modes in_mode , char*
1669
1669
}
1670
1670
1671
1671
1672
- int32_t free_dir_node_avl ( void * in_dir_node_avl , void * in_context , long in_depth ) {
1672
+ int32_t free_dir_node_avl ( void * in_dir_node_avl , void * in_context , int32_t in_depth ) {
1673
1673
dir_node_avl * avl = (dir_node_avl * ) in_dir_node_avl ;
1674
1674
1675
1675
if ( avl -> subdirectory && avl -> subdirectory != EMPTY_SUBDIRECTORY ) avl_traverse_depth_first ( avl -> subdirectory , free_dir_node_avl , nil , k_postfix , 0 );
@@ -1727,7 +1727,7 @@ int32_t write_tree( dir_node_avl *in_avl, write_tree_context *in_context, int32_
1727
1727
1728
1728
int32_t write_file ( dir_node_avl * in_avl , write_tree_context * in_context , int32_t in_depth ) {
1729
1729
char * buf , * p ;
1730
- unsigned long bytes , n , size ;
1730
+ u_int32_t bytes , n , size ;
1731
1731
int32_t err = 0 , fd = -1 , i ;
1732
1732
1733
1733
if ( ! in_avl -> subdirectory ) {
@@ -1829,7 +1829,7 @@ int32_t write_directory( dir_node_avl *in_avl, int32_t in_xiso, int32_t in_depth
1829
1829
}
1830
1830
1831
1831
1832
- int32_t calculate_directory_offsets ( dir_node_avl * in_avl , unsigned long * io_current_sector , int32_t in_depth ) {
1832
+ int32_t calculate_directory_offsets ( dir_node_avl * in_avl , u_int32_t * io_current_sector , int32_t in_depth ) {
1833
1833
wdsafp_context context ;
1834
1834
1835
1835
if ( in_avl -> subdirectory ) {
@@ -1885,8 +1885,8 @@ int32_t calculate_directory_requirements( dir_node_avl *in_avl, void *in_context
1885
1885
}
1886
1886
1887
1887
1888
- int32_t calculate_directory_size ( dir_node_avl * in_avl , unsigned long * out_size , long in_depth ) {
1889
- unsigned long length ;
1888
+ int32_t calculate_directory_size ( dir_node_avl * in_avl , u_int32_t * out_size , int32_t in_depth ) {
1889
+ u_int32_t length ;
1890
1890
1891
1891
if ( in_depth == 0 ) * out_size = 0 ;
1892
1892
@@ -1947,7 +1947,7 @@ int32_t generate_avl_tree_local( dir_node_avl **out_root, int32_t *io_n ) {
1947
1947
free ( avl );
1948
1948
continue ;
1949
1949
}
1950
- s_total_bytes += avl -> file_size = (unsigned long ) sb .st_size ;
1950
+ s_total_bytes += avl -> file_size = (u_int32_t ) sb .st_size ;
1951
1951
++ s_total_files ;
1952
1952
} else {
1953
1953
free ( avl -> filename );
@@ -1984,8 +1984,8 @@ FILE_TIME *alloc_filetime_now( void ) {
1984
1984
if ( ! err ) {
1985
1985
tmp = ( (double ) now + ( 369.0 * 365.25 * 24 * 60 * 60 - ( 3.0 * 24 * 60 * 60 + 6.0 * 60 * 60 ) ) ) * 1.0e7 ;
1986
1986
1987
- ft -> h = (unsigned long ) ( tmp * ( 1.0 / ( 4.0 * (double ) ( 1 << 30 ) ) ) );
1988
- ft -> l = (unsigned long ) ( tmp - ( (double ) ft -> h ) * 4.0 * (double ) ( 1 << 30 ) );
1987
+ ft -> h = (u_int32_t ) ( tmp * ( 1.0 / ( 4.0 * (double ) ( 1 << 30 ) ) ) );
1988
+ ft -> l = (u_int32_t ) ( tmp - ( (double ) ft -> h ) * 4.0 * (double ) ( 1 << 30 ) );
1989
1989
1990
1990
little32 ( ft -> h ); // convert to little endian here because this is a PC only struct and we won't read it anyway
1991
1991
little32 ( ft -> l );
@@ -2011,7 +2011,7 @@ FILE_TIME *alloc_filetime_now( void ) {
2011
2011
// write_volume_descriptors() assumes that the iso file block from offset
2012
2012
// 0x8000 to 0x8808 has been zeroed prior to entry.
2013
2013
2014
- int32_t write_volume_descriptors ( int32_t in_xiso , unsigned long in_total_sectors ) {
2014
+ int32_t write_volume_descriptors ( int32_t in_xiso , u_int32_t in_total_sectors ) {
2015
2015
int32_t big , err = 0 , little ;
2016
2016
char date [] = "0000000000000000" ;
2017
2017
char spaces [ ECMA_119_VOLUME_CREATION_DATE - ECMA_119_VOLUME_SET_IDENTIFIER ];
0 commit comments