Converting `int` return types to `cl_error_t` as needed.
Micah Snyder authored on 2020/08/22 13:34:05... | ... |
@@ -161,7 +161,7 @@ typedef struct arj_decode_tag { |
161 | 161 |
int status; |
162 | 162 |
} arj_decode_t; |
163 | 163 |
|
164 |
-static int fill_buf(arj_decode_t *decode_data, int n) |
|
164 |
+static cl_error_t fill_buf(arj_decode_t *decode_data, int n) |
|
165 | 165 |
{ |
166 | 166 |
if (decode_data->status == CL_EFORMAT) |
167 | 167 |
return CL_EFORMAT; |
... | ... |
@@ -195,7 +195,7 @@ static int fill_buf(arj_decode_t *decode_data, int n) |
195 | 195 |
return CL_SUCCESS; |
196 | 196 |
} |
197 | 197 |
|
198 |
-static int init_getbits(arj_decode_t *decode_data) |
|
198 |
+static cl_error_t init_getbits(arj_decode_t *decode_data) |
|
199 | 199 |
{ |
200 | 200 |
decode_data->bit_buf = 0; |
201 | 201 |
decode_data->sub_bit_buf = 0; |
... | ... |
@@ -212,7 +212,7 @@ static unsigned short arj_getbits(arj_decode_t *decode_data, int n) |
212 | 212 |
return x; |
213 | 213 |
} |
214 | 214 |
|
215 |
-static int decode_start(arj_decode_t *decode_data) |
|
215 |
+static cl_error_t decode_start(arj_decode_t *decode_data) |
|
216 | 216 |
{ |
217 | 217 |
decode_data->blocksize = 0; |
218 | 218 |
return init_getbits(decode_data); |
... | ... |
@@ -229,8 +229,8 @@ static cl_error_t write_text(int ofd, unsigned char *data, size_t length) |
229 | 229 |
return CL_SUCCESS; |
230 | 230 |
} |
231 | 231 |
|
232 |
-static int make_table(arj_decode_t *decode_data, int nchar, unsigned char *bitlen, int tablebits, |
|
233 |
- unsigned short *table, int tablesize) |
|
232 |
+static cl_error_t make_table(arj_decode_t *decode_data, int nchar, unsigned char *bitlen, int tablebits, |
|
233 |
+ unsigned short *table, int tablesize) |
|
234 | 234 |
{ |
235 | 235 |
unsigned short count[17], weight[17], start[18], *p; |
236 | 236 |
unsigned int i, k, len, ch, jutbits, avail, nextcode, mask; |
... | ... |
@@ -338,7 +338,7 @@ static int make_table(arj_decode_t *decode_data, int nchar, unsigned char *bitle |
338 | 338 |
return CL_SUCCESS; |
339 | 339 |
} |
340 | 340 |
|
341 |
-static int read_pt_len(arj_decode_t *decode_data, int nn, int nbit, int i_special) |
|
341 |
+static cl_error_t read_pt_len(arj_decode_t *decode_data, int nn, int nbit, int i_special) |
|
342 | 342 |
{ |
343 | 343 |
int i, n; |
344 | 344 |
short c; |
... | ... |
@@ -394,7 +394,7 @@ static int read_pt_len(arj_decode_t *decode_data, int nn, int nbit, int i_specia |
394 | 394 |
return CL_SUCCESS; |
395 | 395 |
} |
396 | 396 |
|
397 |
-static int read_c_len(arj_decode_t *decode_data) |
|
397 |
+static cl_error_t read_c_len(arj_decode_t *decode_data) |
|
398 | 398 |
{ |
399 | 399 |
short i, c, n; |
400 | 400 |
unsigned short mask; |
... | ... |
@@ -542,9 +542,9 @@ static uint16_t decode_p(arj_decode_t *decode_data) |
542 | 542 |
return j; |
543 | 543 |
} |
544 | 544 |
|
545 |
-static int decode(arj_metadata_t *metadata) |
|
545 |
+static cl_error_t decode(arj_metadata_t *metadata) |
|
546 | 546 |
{ |
547 |
- int ret; |
|
547 |
+ cl_error_t ret; |
|
548 | 548 |
|
549 | 549 |
arj_decode_t decode_data; |
550 | 550 |
uint32_t count = 0, out_ptr = 0; |
... | ... |
@@ -696,9 +696,9 @@ static uint16_t decode_len(arj_decode_t *decode_data) |
696 | 696 |
return c; |
697 | 697 |
} |
698 | 698 |
|
699 |
-static int decode_f(arj_metadata_t *metadata) |
|
699 |
+static cl_error_t decode_f(arj_metadata_t *metadata) |
|
700 | 700 |
{ |
701 |
- int ret; |
|
701 |
+ cl_error_t ret; |
|
702 | 702 |
|
703 | 703 |
arj_decode_t decode_data, *dd; |
704 | 704 |
uint32_t count = 0, out_ptr = 0; |
... | ... |
@@ -787,7 +787,7 @@ static int decode_f(arj_metadata_t *metadata) |
787 | 787 |
return CL_SUCCESS; |
788 | 788 |
} |
789 | 789 |
|
790 |
-static int arj_unstore(arj_metadata_t *metadata, int ofd, uint32_t len) |
|
790 |
+static cl_error_t arj_unstore(arj_metadata_t *metadata, int ofd, uint32_t len) |
|
791 | 791 |
{ |
792 | 792 |
const unsigned char *data; |
793 | 793 |
uint32_t rem; |
... | ... |
@@ -969,7 +969,7 @@ done: |
969 | 969 |
return ret; |
970 | 970 |
} |
971 | 971 |
|
972 |
-static int arj_read_file_header(arj_metadata_t *metadata) |
|
972 |
+static cl_error_t arj_read_file_header(arj_metadata_t *metadata) |
|
973 | 973 |
{ |
974 | 974 |
uint16_t header_size, count; |
975 | 975 |
const char *filename, *comment; |
... | ... |
@@ -977,7 +977,7 @@ static int arj_read_file_header(arj_metadata_t *metadata) |
977 | 977 |
struct text_norm_state fnstate, comstate; |
978 | 978 |
unsigned char *fnnorm = NULL; |
979 | 979 |
unsigned char *comnorm = NULL; |
980 |
- uint32_t ret = CL_SUCCESS; |
|
980 |
+ cl_error_t ret = CL_SUCCESS; |
|
981 | 981 |
|
982 | 982 |
size_t filename_max_len = 0; |
983 | 983 |
size_t filename_len = 0; |
... | ... |
@@ -1139,7 +1139,7 @@ done: |
1139 | 1139 |
return ret; |
1140 | 1140 |
} |
1141 | 1141 |
|
1142 |
-int cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, size_t off) |
|
1142 |
+cl_error_t cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, size_t off) |
|
1143 | 1143 |
{ |
1144 | 1144 |
UNUSEDPARAM(dirname); |
1145 | 1145 |
cli_dbgmsg("in cli_unarj_open\n"); |
... | ... |
@@ -1156,7 +1156,7 @@ int cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, s |
1156 | 1156 |
return CL_SUCCESS; |
1157 | 1157 |
} |
1158 | 1158 |
|
1159 |
-int cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata) |
|
1159 |
+cl_error_t cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata) |
|
1160 | 1160 |
{ |
1161 | 1161 |
cli_dbgmsg("in cli_unarj_prepare_file\n"); |
1162 | 1162 |
if (!metadata || !dirname) { |
... | ... |
@@ -1170,9 +1170,9 @@ int cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata) |
1170 | 1170 |
return arj_read_file_header(metadata); |
1171 | 1171 |
} |
1172 | 1172 |
|
1173 |
-int cli_unarj_extract_file(const char *dirname, arj_metadata_t *metadata) |
|
1173 |
+cl_error_t cli_unarj_extract_file(const char *dirname, arj_metadata_t *metadata) |
|
1174 | 1174 |
{ |
1175 |
- int ret = CL_SUCCESS; |
|
1175 |
+ cl_error_t ret = CL_SUCCESS; |
|
1176 | 1176 |
char filename[1024]; |
1177 | 1177 |
|
1178 | 1178 |
cli_dbgmsg("in cli_unarj_extract_file\n"); |
... | ... |
@@ -36,8 +36,8 @@ typedef struct arj_metadata_tag { |
36 | 36 |
size_t offset; |
37 | 37 |
} arj_metadata_t; |
38 | 38 |
|
39 |
-int cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, size_t off); |
|
40 |
-int cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata); |
|
41 |
-int cli_unarj_extract_file(const char *dirname, arj_metadata_t *metadata); |
|
39 |
+cl_error_t cli_unarj_open(fmap_t *map, const char *dirname, arj_metadata_t *metadata, size_t off); |
|
40 |
+cl_error_t cli_unarj_prepare_file(const char *dirname, arj_metadata_t *metadata); |
|
41 |
+cl_error_t cli_unarj_extract_file(const char *dirname, arj_metadata_t *metadata); |
|
42 | 42 |
|
43 | 43 |
#endif |