1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/file_util.c busybox-1.1.0-pre1-new/archival/libipkg/file_util.c
--- busybox-1.1.0-pre1-old/archival/libipkg/file_util.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/file_util.c 2005-12-08 09:04:01.000000000 +0100
@@ -123,7 +123,7 @@
int file_mkdir_hier(const char *path, long mode)
{
- return bb_make_directory(path, mode, FILEUTILS_RECUR);
+ return bb_make_directory((char *)path, mode, FILEUTILS_RECUR);
}
char *file_md5sum_alloc(const char *file_name)
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/ipkg_cmd.c busybox-1.1.0-pre1-new/archival/libipkg/ipkg_cmd.c
--- busybox-1.1.0-pre1-old/archival/libipkg/ipkg_cmd.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/ipkg_cmd.c 2005-12-08 09:04:01.000000000 +0100
@@ -251,7 +251,7 @@
in = fopen (tmp_file_name, "r");
out = fopen (list_file_name, "w");
if (in && out)
- inflate_unzip (in, out);
+ inflate_unzip (fileno(in), fileno(out));
else
err = 1;
if (in)
@@ -807,14 +807,13 @@
pkg_vec_free(available);
} else {
pkg_vec_t *installed_pkgs = pkg_vec_alloc();
- int i;
int flagged_pkg_count = 0;
int removed;
pkg_hash_fetch_all_installed(&conf->pkg_hash, installed_pkgs);
for (i = 0; i < installed_pkgs->len; i++) {
- pkg_t *pkg = installed_pkgs->pkgs[i];
+ pkg = installed_pkgs->pkgs[i];
if (pkg->state_flag & SF_USER) {
flagged_pkg_count++;
} else {
@@ -834,7 +833,7 @@
do {
removed = 0;
for (i = 0; i < installed_pkgs->len; i++) {
- pkg_t *pkg = installed_pkgs->pkgs[i];
+ pkg = installed_pkgs->pkgs[i];
if (!(pkg->state_flag & SF_USER)
&& !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) {
removed++;
@@ -889,7 +888,7 @@
{
int i;
pkg_t *pkg;
- const char *flags = argv[0];
+ char *flags = argv[0];
global_conf = conf;
signal(SIGINT, sigint_handler);
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/ipkg_conf.c busybox-1.1.0-pre1-new/archival/libipkg/ipkg_conf.c
--- busybox-1.1.0-pre1-old/archival/libipkg/ipkg_conf.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/ipkg_conf.c 2005-12-08 09:04:01.000000000 +0100
@@ -540,14 +540,14 @@
if (strcmp(type, "option") == 0) {
ipkg_conf_set_option(options, name, value);
} else if (strcmp(type, "src") == 0) {
- if (!nv_pair_list_find(pkg_src_list, name)) {
+ if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
pkg_src_list_append (pkg_src_list, name, value, extra, 0);
} else {
ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
name, value);
}
} else if (strcmp(type, "src/gz") == 0) {
- if (!nv_pair_list_find(pkg_src_list, name)) {
+ if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
pkg_src_list_append (pkg_src_list, name, value, extra, 1);
} else {
ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/libipkg.c busybox-1.1.0-pre1-new/archival/libipkg/libipkg.c
--- busybox-1.1.0-pre1-old/archival/libipkg/libipkg.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/libipkg.c 2005-12-08 09:04:01.000000000 +0100
@@ -445,7 +445,7 @@
int
ipkg_op (int argc, char *argv[])
{
- int err, optind;
+ int err, opt_index;
args_t args;
char *cmd_name;
ipkg_cmd_t *cmd;
@@ -453,13 +453,13 @@
args_init (&args);
- optind = args_parse (&args, argc, argv);
- if (optind == argc || optind < 0)
+ opt_index = args_parse (&args, argc, argv);
+ if (opt_index == argc || opt_index < 0)
{
args_usage ("ipkg must have one sub-command argument");
}
- cmd_name = argv[optind++];
+ cmd_name = argv[opt_index++];
/* Pigi: added a flag to disable the checking of structures if the command does not need to
read anything from there.
*/
@@ -494,7 +494,7 @@
args_usage (NULL);
}
- if (cmd->requires_args && optind == argc)
+ if (cmd->requires_args && opt_index == argc)
{
fprintf (stderr,
"%s: the ``%s'' command requires at least one argument\n",
@@ -502,7 +502,7 @@
args_usage (NULL);
}
- err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL);
+ err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - opt_index, (const char **) (argv + opt_index), NULL);
ipkg_conf_deinit (&ipkg_conf);
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/md5.c busybox-1.1.0-pre1-new/archival/libipkg/md5.c
--- busybox-1.1.0-pre1-old/archival/libipkg/md5.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/md5.c 2005-12-08 09:04:01.000000000 +0100
@@ -25,7 +25,6 @@
int md5_stream(FILE *stream, void *resblock)
{
int fd;
- int sum;
if( (fd = fileno(stream)) == -1 ) {
bb_error_msg("bad file descriptor");
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg.c busybox-1.1.0-pre1-new/archival/libipkg/pkg.c
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg.c 2005-12-08 09:04:01.000000000 +0100
@@ -527,6 +527,7 @@
char * pkg_formatted_field(pkg_t *pkg, const char *field )
{
static size_t LINE_LEN = 128;
+ char line_str[LINE_LEN];
char * temp = (char *)malloc(1);
int len = 0;
int flag_provide_false = 0;
@@ -566,7 +567,6 @@
if (strcasecmp(field, "Conffiles") == 0) {
/* Conffiles */
conffile_list_elt_t *iter;
- char confstr[LINE_LEN];
if (pkg->conffiles.head == NULL) {
return temp;
@@ -587,15 +587,14 @@
strncpy(temp, "Conffiles:\n", 12);
for (iter = pkg->conffiles.head; iter; iter = iter->next) {
if (iter->data->name && iter->data->value) {
- snprintf(confstr, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
- strncat(temp, confstr, strlen(confstr));
+ snprintf(line_str, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
+ strncat(temp, line_str, strlen(line_str));
}
}
} else if (strcasecmp(field, "Conflicts") == 0) {
int i;
if (pkg->conflicts_count) {
- char conflictstr[LINE_LEN];
len = 14 ;
for(i = 0; i < pkg->conflicts_count; i++) {
len = len + (strlen(pkg->conflicts_str[i])+5);
@@ -608,8 +607,8 @@
temp[0]='\0';
strncpy(temp, "Conflicts:", 11);
for(i = 0; i < pkg->conflicts_count; i++) {
- snprintf(conflictstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
- strncat(temp, conflictstr, strlen(conflictstr));
+ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
+ strncat(temp, line_str, strlen(line_str));
}
strncat(temp, "\n", strlen("\n"));
}
@@ -624,7 +623,6 @@
int i;
if (pkg->depends_count) {
- char depstr[LINE_LEN];
len = 14 ;
for(i = 0; i < pkg->depends_count; i++) {
len = len + (strlen(pkg->depends_str[i])+4);
@@ -637,8 +635,8 @@
temp[0]='\0';
strncpy(temp, "Depends:", 10);
for(i = 0; i < pkg->depends_count; i++) {
- snprintf(depstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
- strncat(temp, depstr, strlen(depstr));
+ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
+ strncat(temp, line_str, strlen(line_str));
}
strncat(temp, "\n", strlen("\n"));
}
@@ -803,7 +801,6 @@
/* Replaces | Recommends*/
if (strcasecmp (field, "Replaces") == 0) {
if (pkg->replaces_count) {
- char replstr[LINE_LEN];
len = 14;
for (i = 0; i < pkg->replaces_count; i++) {
len = len + (strlen(pkg->replaces_str[i])+5);
@@ -816,14 +813,13 @@
temp[0]='\0';
strncpy(temp, "Replaces:", 12);
for (i = 0; i < pkg->replaces_count; i++) {
- snprintf(replstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
- strncat(temp, replstr, strlen(replstr));
+ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
+ strncat(temp, line_str, strlen(line_str));
}
strncat(temp, "\n", strlen("\n"));
}
} else if (strcasecmp (field, "Recommends") == 0) {
if (pkg->recommends_count) {
- char recstr[LINE_LEN];
len = 15;
for(i = 0; i < pkg->recommends_count; i++) {
len = len + (strlen( pkg->recommends_str[i])+5);
@@ -836,8 +832,8 @@
temp[0]='\0';
strncpy(temp, "Recommends:", 13);
for(i = 0; i < pkg->recommends_count; i++) {
- snprintf(recstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
- strncat(temp, recstr, strlen(recstr));
+ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
+ strncat(temp, line_str, strlen(line_str));
}
strncat(temp, "\n", strlen("\n"));
}
@@ -906,7 +902,6 @@
} else if (strcasecmp(field, "Suggests") == 0) {
if (pkg->suggests_count) {
int i;
- char sugstr[LINE_LEN];
len = 13;
for(i = 0; i < pkg->suggests_count; i++) {
len = len + (strlen(pkg->suggests_str[i])+5);
@@ -919,8 +914,8 @@
temp[0]='\0';
strncpy(temp, "Suggests:", 10);
for(i = 0; i < pkg->suggests_count; i++) {
- snprintf(sugstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
- strncat(temp, sugstr, strlen(sugstr));
+ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
+ strncat(temp, line_str, strlen(line_str));
}
strncat(temp, "\n", strlen("\n"));
}
@@ -1139,10 +1134,8 @@
return 0;
}
-int pkg_name_version_and_architecture_compare(void *p1, void *p2)
+int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b)
{
- const pkg_t *a = *(const pkg_t **)p1;
- const pkg_t *b = *(const pkg_t **)p2;
int namecmp;
int vercmp;
if (!a->name || !b->name) {
@@ -1169,10 +1162,8 @@
return 0;
}
-int abstract_pkg_name_compare(void *p1, void *p2)
+int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b)
{
- const abstract_pkg_t *a = *(const abstract_pkg_t **)p1;
- const abstract_pkg_t *b = *(const abstract_pkg_t **)p2;
if (!a->name || !b->name) {
fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n",
a, a->name, b, b->name);
@@ -1192,7 +1183,7 @@
#endif
if (pkg->epoch) {
- sprintf_alloc(&epoch_str, "%d:", pkg->epoch);
+ sprintf_alloc(&epoch_str, "%d:", (int)(pkg->epoch));
} else {
epoch_str = strdup("");
}
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg.h busybox-1.1.0-pre1-new/archival/libipkg/pkg.h
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg.h 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg.h 2005-12-08 09:04:01.000000000 +0100
@@ -192,8 +192,8 @@
char *pkg_version_str_alloc(pkg_t *pkg);
int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg);
-int pkg_name_version_and_architecture_compare(void *a, void *b);
-int abstract_pkg_name_compare(void *a, void *b);
+int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b);
+int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b);
char * pkg_formatted_info(pkg_t *pkg );
char * pkg_formatted_field(pkg_t *pkg, const char *field );
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg_depends.c busybox-1.1.0-pre1-new/archival/libipkg/pkg_depends.c
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg_depends.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg_depends.c 2005-12-08 09:04:01.000000000 +0100
@@ -68,7 +68,7 @@
pkg_vec_t *unsatisfied, char *** unresolved)
{
pkg_t * satisfier_entry_pkg;
- register int i, j, k;
+ register int i, j, k, l;
int count, found;
char ** the_lost;
abstract_pkg_t * ab_pkg;
@@ -113,7 +113,6 @@
abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by;
int nposs = ab_provider_vec->len;
abstract_pkg_t **ab_providers = ab_provider_vec->pkgs;
- int l;
for (l = 0; l < nposs; l++) {
pkg_vec_t *test_vec = ab_providers[l]->pkgs;
/* if no depends on this one, try the first package that Provides this one */
@@ -137,10 +136,9 @@
tmp_vec,
&newstuff);
if (newstuff == NULL) {
- int i;
int ok = 1;
- for (i = 0; i < rc; i++) {
- pkg_t *p = tmp_vec->pkgs[i];
+ for (l = 0; l < rc; l++) {
+ pkg_t *p = tmp_vec->pkgs[l];
if (p->state_want == SW_INSTALL)
continue;
ipkg_message(conf, IPKG_DEBUG, "not installing %s due to requirement for %s\n", pkg_scout->name, p->name);
@@ -810,27 +808,27 @@
* [npredepends+nrecommends,npredepends+nrecommends+nsuggests) -> returns recommends_str[index]
* [npredepends+nrecommends+nsuggests,npredepends+nrecommends+nsuggests+ndepends) -> returns depends_str[index]
*/
-char *pkg_depend_str(pkg_t *pkg, int index)
+char *pkg_depend_str(pkg_t *pkg, int pkg_index)
{
- if (index < pkg->pre_depends_count) {
- return pkg->pre_depends_str[index];
+ if (pkg_index < pkg->pre_depends_count) {
+ return pkg->pre_depends_str[pkg_index];
}
- index -= pkg->pre_depends_count;
+ pkg_index -= pkg->pre_depends_count;
- if (index < pkg->recommends_count) {
- return pkg->recommends_str[index];
+ if (pkg_index < pkg->recommends_count) {
+ return pkg->recommends_str[pkg_index];
}
- index -= pkg->recommends_count;
+ pkg_index -= pkg->recommends_count;
- if (index < pkg->suggests_count) {
- return pkg->suggests_str[index];
+ if (pkg_index < pkg->suggests_count) {
+ return pkg->suggests_str[pkg_index];
}
- index -= pkg->suggests_count;
+ pkg_index -= pkg->suggests_count;
- if (index < pkg->depends_count) {
- return pkg->depends_str[index];
+ if (pkg_index < pkg->depends_count) {
+ return pkg->depends_str[pkg_index];
}
- fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name);
+ fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", pkg_index, pkg->name);
return NULL;
}
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg_depends.h busybox-1.1.0-pre1-new/archival/libipkg/pkg_depends.h
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg_depends.h 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg_depends.h 2005-12-08 09:04:01.000000000 +0100
@@ -92,7 +92,7 @@
*/
int pkg_conflicts(pkg_t *pkg, pkg_t *conflicts);
-char *pkg_depend_str(pkg_t *pkg, int index);
+char *pkg_depend_str(pkg_t *pkg, int pkg_index);
void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg);
void freeDepends(pkg_t *pkg);
void printDepends(pkg_t * pkg);
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg_hash.c busybox-1.1.0-pre1-new/archival/libipkg/pkg_hash.c
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg_hash.c 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg_hash.c 2005-12-08 09:04:01.000000000 +0100
@@ -143,7 +143,7 @@
pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg,
int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet)
{
- int i;
+ int i, j;
int nprovides = 0;
int nmatching = 0;
pkg_vec_t *matching_pkgs = pkg_vec_alloc();
@@ -209,11 +209,10 @@
/* now check for supported architecture */
{
int max_count = 0;
- int i;
/* count packages matching max arch priority and keep track of last one */
- for (i = 0; i < vec->len; i++) {
- pkg_t *maybe = vec->pkgs[i];
+ for (j = 0; j < vec->len; j++) {
+ pkg_t *maybe = vec->pkgs[j];
ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d \n",
maybe->name, maybe->architecture, maybe->arch_priority);
if (maybe->arch_priority > 0) {
diff -ruN busybox-1.1.0-pre1-old/archival/libipkg/pkg_vec.h busybox-1.1.0-pre1-new/archival/libipkg/pkg_vec.h
--- busybox-1.1.0-pre1-old/archival/libipkg/pkg_vec.h 2005-12-08 09:01:04.000000000 +0100
+++ busybox-1.1.0-pre1-new/archival/libipkg/pkg_vec.h 2005-12-08 09:04:01.000000000 +0100
@@ -35,6 +35,8 @@
};
typedef struct abstract_pkg_vec abstract_pkg_vec_t;
+typedef int (*pkg_compar_t)(pkg_t *, pkg_t *);
+typedef int (*abstract_pkg_compar_t)(abstract_pkg_t *, abstract_pkg_t *);
pkg_vec_t * pkg_vec_alloc(void);
void pkg_vec_free(pkg_vec_t *vec);
|