1 diff -ruN busybox-1.00-old/archival/libipkg/file_util.c busybox-1.00-new/archival/libipkg/file_util.c
2 --- busybox-1.00-old/archival/libipkg/file_util.c 2005-10-27 16:37:25.000000000 +0200
3 +++ busybox-1.00-new/archival/libipkg/file_util.c 2005-10-27 16:38:03.000000000 +0200
6 int file_mkdir_hier(const char *path, long mode)
8 - return bb_make_directory(path, mode, FILEUTILS_RECUR);
9 + return bb_make_directory((char *)path, mode, FILEUTILS_RECUR);
12 char *file_md5sum_alloc(const char *file_name)
13 diff -ruN busybox-1.00-old/archival/libipkg/ipkg_cmd.c busybox-1.00-new/archival/libipkg/ipkg_cmd.c
14 --- busybox-1.00-old/archival/libipkg/ipkg_cmd.c 2005-10-27 16:37:25.000000000 +0200
15 +++ busybox-1.00-new/archival/libipkg/ipkg_cmd.c 2005-10-27 16:38:03.000000000 +0200
17 in = fopen (tmp_file_name, "r");
18 out = fopen (list_file_name, "w");
20 - inflate_unzip (in, out);
21 + inflate_unzip (fileno(in), fileno(out));
26 pkg_vec_free(available);
28 pkg_vec_t *installed_pkgs = pkg_vec_alloc();
30 int flagged_pkg_count = 0;
33 pkg_hash_fetch_all_installed(&conf->pkg_hash, installed_pkgs);
35 for (i = 0; i < installed_pkgs->len; i++) {
36 - pkg_t *pkg = installed_pkgs->pkgs[i];
37 + pkg = installed_pkgs->pkgs[i];
38 if (pkg->state_flag & SF_USER) {
44 for (i = 0; i < installed_pkgs->len; i++) {
45 - pkg_t *pkg = installed_pkgs->pkgs[i];
46 + pkg = installed_pkgs->pkgs[i];
47 if (!(pkg->state_flag & SF_USER)
48 && !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) {
54 - const char *flags = argv[0];
55 + char *flags = argv[0];
58 signal(SIGINT, sigint_handler);
59 diff -ruN busybox-1.00-old/archival/libipkg/ipkg_conf.c busybox-1.00-new/archival/libipkg/ipkg_conf.c
60 --- busybox-1.00-old/archival/libipkg/ipkg_conf.c 2005-10-27 16:37:25.000000000 +0200
61 +++ busybox-1.00-new/archival/libipkg/ipkg_conf.c 2005-10-27 16:38:03.000000000 +0200
63 if (strcmp(type, "option") == 0) {
64 ipkg_conf_set_option(options, name, value);
65 } else if (strcmp(type, "src") == 0) {
66 - if (!nv_pair_list_find(pkg_src_list, name)) {
67 + if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
68 pkg_src_list_append (pkg_src_list, name, value, extra, 0);
70 ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
73 } else if (strcmp(type, "src/gz") == 0) {
74 - if (!nv_pair_list_find(pkg_src_list, name)) {
75 + if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
76 pkg_src_list_append (pkg_src_list, name, value, extra, 1);
78 ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
79 diff -ruN busybox-1.00-old/archival/libipkg/libipkg.c busybox-1.00-new/archival/libipkg/libipkg.c
80 --- busybox-1.00-old/archival/libipkg/libipkg.c 2005-10-27 16:37:25.000000000 +0200
81 +++ busybox-1.00-new/archival/libipkg/libipkg.c 2005-10-27 16:38:03.000000000 +0200
84 ipkg_op (int argc, char *argv[])
95 - optind = args_parse (&args, argc, argv);
96 - if (optind == argc || optind < 0)
97 + opt_index = args_parse (&args, argc, argv);
98 + if (opt_index == argc || opt_index < 0)
100 args_usage ("ipkg must have one sub-command argument");
103 - cmd_name = argv[optind++];
104 + cmd_name = argv[opt_index++];
105 /* Pigi: added a flag to disable the checking of structures if the command does not need to
106 read anything from there.
112 - if (cmd->requires_args && optind == argc)
113 + if (cmd->requires_args && opt_index == argc)
116 "%s: the ``%s'' command requires at least one argument\n",
121 - err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL);
122 + err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - opt_index, (const char **) (argv + opt_index), NULL);
124 ipkg_conf_deinit (&ipkg_conf);
126 diff -ruN busybox-1.00-old/archival/libipkg/md5.c busybox-1.00-new/archival/libipkg/md5.c
127 --- busybox-1.00-old/archival/libipkg/md5.c 2005-10-27 16:37:25.000000000 +0200
128 +++ busybox-1.00-new/archival/libipkg/md5.c 2005-10-27 16:38:03.000000000 +0200
130 int md5_stream(FILE *stream, void *resblock)
135 if( (fd = fileno(stream)) == -1 ) {
136 bb_error_msg("bad file descriptor");
137 diff -ruN busybox-1.00-old/archival/libipkg/pkg.c busybox-1.00-new/archival/libipkg/pkg.c
138 --- busybox-1.00-old/archival/libipkg/pkg.c 2005-10-27 16:37:25.000000000 +0200
139 +++ busybox-1.00-new/archival/libipkg/pkg.c 2005-10-27 16:38:03.000000000 +0200
141 char * pkg_formatted_field(pkg_t *pkg, const char *field )
143 static size_t LINE_LEN = 128;
144 + char line_str[LINE_LEN];
145 char * temp = (char *)malloc(1);
147 int flag_provide_false = 0;
149 if (strcasecmp(field, "Conffiles") == 0) {
151 conffile_list_elt_t *iter;
152 - char confstr[LINE_LEN];
154 if (pkg->conffiles.head == NULL) {
156 @@ -587,15 +587,14 @@
157 strncpy(temp, "Conffiles:\n", 12);
158 for (iter = pkg->conffiles.head; iter; iter = iter->next) {
159 if (iter->data->name && iter->data->value) {
160 - snprintf(confstr, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
161 - strncat(temp, confstr, strlen(confstr));
162 + snprintf(line_str, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
163 + strncat(temp, line_str, strlen(line_str));
166 } else if (strcasecmp(field, "Conflicts") == 0) {
169 if (pkg->conflicts_count) {
170 - char conflictstr[LINE_LEN];
172 for(i = 0; i < pkg->conflicts_count; i++) {
173 len = len + (strlen(pkg->conflicts_str[i])+5);
176 strncpy(temp, "Conflicts:", 11);
177 for(i = 0; i < pkg->conflicts_count; i++) {
178 - snprintf(conflictstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
179 - strncat(temp, conflictstr, strlen(conflictstr));
180 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
181 + strncat(temp, line_str, strlen(line_str));
183 strncat(temp, "\n", strlen("\n"));
188 if (pkg->depends_count) {
189 - char depstr[LINE_LEN];
191 for(i = 0; i < pkg->depends_count; i++) {
192 len = len + (strlen(pkg->depends_str[i])+4);
195 strncpy(temp, "Depends:", 10);
196 for(i = 0; i < pkg->depends_count; i++) {
197 - snprintf(depstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
198 - strncat(temp, depstr, strlen(depstr));
199 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
200 + strncat(temp, line_str, strlen(line_str));
202 strncat(temp, "\n", strlen("\n"));
205 /* Replaces | Recommends*/
206 if (strcasecmp (field, "Replaces") == 0) {
207 if (pkg->replaces_count) {
208 - char replstr[LINE_LEN];
210 for (i = 0; i < pkg->replaces_count; i++) {
211 len = len + (strlen(pkg->replaces_str[i])+5);
212 @@ -816,14 +813,13 @@
214 strncpy(temp, "Replaces:", 12);
215 for (i = 0; i < pkg->replaces_count; i++) {
216 - snprintf(replstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
217 - strncat(temp, replstr, strlen(replstr));
218 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
219 + strncat(temp, line_str, strlen(line_str));
221 strncat(temp, "\n", strlen("\n"));
223 } else if (strcasecmp (field, "Recommends") == 0) {
224 if (pkg->recommends_count) {
225 - char recstr[LINE_LEN];
227 for(i = 0; i < pkg->recommends_count; i++) {
228 len = len + (strlen( pkg->recommends_str[i])+5);
231 strncpy(temp, "Recommends:", 13);
232 for(i = 0; i < pkg->recommends_count; i++) {
233 - snprintf(recstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
234 - strncat(temp, recstr, strlen(recstr));
235 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
236 + strncat(temp, line_str, strlen(line_str));
238 strncat(temp, "\n", strlen("\n"));
241 } else if (strcasecmp(field, "Suggests") == 0) {
242 if (pkg->suggests_count) {
244 - char sugstr[LINE_LEN];
246 for(i = 0; i < pkg->suggests_count; i++) {
247 len = len + (strlen(pkg->suggests_str[i])+5);
250 strncpy(temp, "Suggests:", 10);
251 for(i = 0; i < pkg->suggests_count; i++) {
252 - snprintf(sugstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
253 - strncat(temp, sugstr, strlen(sugstr));
254 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
255 + strncat(temp, line_str, strlen(line_str));
257 strncat(temp, "\n", strlen("\n"));
259 @@ -1139,10 +1134,8 @@
263 -int pkg_name_version_and_architecture_compare(void *p1, void *p2)
264 +int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b)
266 - const pkg_t *a = *(const pkg_t **)p1;
267 - const pkg_t *b = *(const pkg_t **)p2;
270 if (!a->name || !b->name) {
271 @@ -1169,10 +1162,8 @@
275 -int abstract_pkg_name_compare(void *p1, void *p2)
276 +int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b)
278 - const abstract_pkg_t *a = *(const abstract_pkg_t **)p1;
279 - const abstract_pkg_t *b = *(const abstract_pkg_t **)p2;
280 if (!a->name || !b->name) {
281 fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n",
282 a, a->name, b, b->name);
283 @@ -1192,7 +1183,7 @@
287 - sprintf_alloc(&epoch_str, "%d:", pkg->epoch);
288 + sprintf_alloc(&epoch_str, "%d:", (int)(pkg->epoch));
290 epoch_str = strdup("");
292 diff -ruN busybox-1.00-old/archival/libipkg/pkg.h busybox-1.00-new/archival/libipkg/pkg.h
293 --- busybox-1.00-old/archival/libipkg/pkg.h 2005-10-27 16:37:25.000000000 +0200
294 +++ busybox-1.00-new/archival/libipkg/pkg.h 2005-10-27 16:38:03.000000000 +0200
296 char *pkg_version_str_alloc(pkg_t *pkg);
298 int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg);
299 -int pkg_name_version_and_architecture_compare(void *a, void *b);
300 -int abstract_pkg_name_compare(void *a, void *b);
301 +int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b);
302 +int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b);
304 char * pkg_formatted_info(pkg_t *pkg );
305 char * pkg_formatted_field(pkg_t *pkg, const char *field );
306 diff -ruN busybox-1.00-old/archival/libipkg/pkg_depends.c busybox-1.00-new/archival/libipkg/pkg_depends.c
307 --- busybox-1.00-old/archival/libipkg/pkg_depends.c 2005-10-27 16:37:26.000000000 +0200
308 +++ busybox-1.00-new/archival/libipkg/pkg_depends.c 2005-10-27 16:38:03.000000000 +0200
310 pkg_vec_t *unsatisfied, char *** unresolved)
312 pkg_t * satisfier_entry_pkg;
313 - register int i, j, k;
314 + register int i, j, k, l;
317 abstract_pkg_t * ab_pkg;
319 abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by;
320 int nposs = ab_provider_vec->len;
321 abstract_pkg_t **ab_providers = ab_provider_vec->pkgs;
323 for (l = 0; l < nposs; l++) {
324 pkg_vec_t *test_vec = ab_providers[l]->pkgs;
325 /* if no depends on this one, try the first package that Provides this one */
329 if (newstuff == NULL) {
332 - for (i = 0; i < rc; i++) {
333 - pkg_t *p = tmp_vec->pkgs[i];
334 + for (l = 0; l < rc; l++) {
335 + pkg_t *p = tmp_vec->pkgs[l];
336 if (p->state_want == SW_INSTALL)
338 ipkg_message(conf, IPKG_DEBUG, "not installing %s due to requirement for %s\n", pkg_scout->name, p->name);
339 @@ -810,27 +808,27 @@
340 * [npredepends+nrecommends,npredepends+nrecommends+nsuggests) -> returns recommends_str[index]
341 * [npredepends+nrecommends+nsuggests,npredepends+nrecommends+nsuggests+ndepends) -> returns depends_str[index]
343 -char *pkg_depend_str(pkg_t *pkg, int index)
344 +char *pkg_depend_str(pkg_t *pkg, int pkg_index)
346 - if (index < pkg->pre_depends_count) {
347 - return pkg->pre_depends_str[index];
348 + if (pkg_index < pkg->pre_depends_count) {
349 + return pkg->pre_depends_str[pkg_index];
351 - index -= pkg->pre_depends_count;
352 + pkg_index -= pkg->pre_depends_count;
354 - if (index < pkg->recommends_count) {
355 - return pkg->recommends_str[index];
356 + if (pkg_index < pkg->recommends_count) {
357 + return pkg->recommends_str[pkg_index];
359 - index -= pkg->recommends_count;
360 + pkg_index -= pkg->recommends_count;
362 - if (index < pkg->suggests_count) {
363 - return pkg->suggests_str[index];
364 + if (pkg_index < pkg->suggests_count) {
365 + return pkg->suggests_str[pkg_index];
367 - index -= pkg->suggests_count;
368 + pkg_index -= pkg->suggests_count;
370 - if (index < pkg->depends_count) {
371 - return pkg->depends_str[index];
372 + if (pkg_index < pkg->depends_count) {
373 + return pkg->depends_str[pkg_index];
375 - fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name);
376 + fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", pkg_index, pkg->name);
380 diff -ruN busybox-1.00-old/archival/libipkg/pkg_depends.h busybox-1.00-new/archival/libipkg/pkg_depends.h
381 --- busybox-1.00-old/archival/libipkg/pkg_depends.h 2005-10-27 16:37:26.000000000 +0200
382 +++ busybox-1.00-new/archival/libipkg/pkg_depends.h 2005-10-27 16:38:03.000000000 +0200
385 int pkg_conflicts(pkg_t *pkg, pkg_t *conflicts);
387 -char *pkg_depend_str(pkg_t *pkg, int index);
388 +char *pkg_depend_str(pkg_t *pkg, int pkg_index);
389 void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg);
390 void freeDepends(pkg_t *pkg);
391 void printDepends(pkg_t * pkg);
392 diff -ruN busybox-1.00-old/archival/libipkg/pkg_hash.c busybox-1.00-new/archival/libipkg/pkg_hash.c
393 --- busybox-1.00-old/archival/libipkg/pkg_hash.c 2005-10-27 16:37:26.000000000 +0200
394 +++ busybox-1.00-new/archival/libipkg/pkg_hash.c 2005-10-27 16:38:03.000000000 +0200
396 pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg,
397 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet)
403 pkg_vec_t *matching_pkgs = pkg_vec_alloc();
404 @@ -209,11 +209,10 @@
405 /* now check for supported architecture */
410 /* count packages matching max arch priority and keep track of last one */
411 - for (i = 0; i < vec->len; i++) {
412 - pkg_t *maybe = vec->pkgs[i];
413 + for (j = 0; j < vec->len; j++) {
414 + pkg_t *maybe = vec->pkgs[j];
415 ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d \n",
416 maybe->name, maybe->architecture, maybe->arch_priority);
417 if (maybe->arch_priority > 0) {
418 diff -ruN busybox-1.00-old/archival/libipkg/pkg_vec.h busybox-1.00-new/archival/libipkg/pkg_vec.h
419 --- busybox-1.00-old/archival/libipkg/pkg_vec.h 2005-10-27 16:37:26.000000000 +0200
420 +++ busybox-1.00-new/archival/libipkg/pkg_vec.h 2005-10-27 16:39:05.000000000 +0200
423 typedef struct abstract_pkg_vec abstract_pkg_vec_t;
425 +typedef int (*pkg_compar_t)(pkg_t *, pkg_t *);
426 +typedef int (*abstract_pkg_compar_t)(abstract_pkg_t *, abstract_pkg_t *);
428 pkg_vec_t * pkg_vec_alloc(void);
429 void pkg_vec_free(pkg_vec_t *vec);