1 # Copyright (C) 2006 OpenWrt.org
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
6 # remove (numerous) compile warnings
8 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/file_util.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/file_util.c
9 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/file_util.c 2006-05-09 02:06:48.000000000 +0200
10 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/file_util.c 2006-05-09 02:16:48.000000000 +0200
13 int file_mkdir_hier(const char *path, long mode)
15 - return bb_make_directory(path, mode, FILEUTILS_RECUR);
16 + return bb_make_directory((char *)path, mode, FILEUTILS_RECUR);
19 char *file_md5sum_alloc(const char *file_name)
20 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_cmd.c
21 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c 2006-05-09 02:23:37.000000000 +0200
22 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_cmd.c 2006-05-09 02:23:17.000000000 +0200
24 in = fopen (tmp_file_name, "r");
25 out = fopen (list_file_name, "w");
27 - inflate_unzip (in, out);
28 + inflate_unzip (fileno(in), fileno(out));
33 pkg_vec_free(available);
35 pkg_vec_t *installed_pkgs = pkg_vec_alloc();
37 int flagged_pkg_count = 0;
40 pkg_hash_fetch_all_installed(&conf->pkg_hash, installed_pkgs);
42 for (i = 0; i < installed_pkgs->len; i++) {
43 - pkg_t *pkg = installed_pkgs->pkgs[i];
44 + pkg = installed_pkgs->pkgs[i];
45 if (pkg->state_flag & SF_USER) {
51 for (i = 0; i < installed_pkgs->len; i++) {
52 - pkg_t *pkg = installed_pkgs->pkgs[i];
53 + pkg = installed_pkgs->pkgs[i];
54 if (!(pkg->state_flag & SF_USER)
55 && !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) {
61 - const char *flags = argv[0];
62 + char *flags = argv[0];
65 signal(SIGINT, sigint_handler);
66 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_conf.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_conf.c
67 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_conf.c 2006-05-09 02:12:04.000000000 +0200
68 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_conf.c 2006-05-09 02:16:48.000000000 +0200
70 if (strcmp(type, "option") == 0) {
71 ipkg_conf_set_option(options, name, value);
72 } else if (strcmp(type, "src") == 0) {
73 - if (!nv_pair_list_find(pkg_src_list, name)) {
74 + if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
75 pkg_src_list_append (pkg_src_list, name, value, extra, 0);
77 ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
80 } else if (strcmp(type, "src/gz") == 0) {
81 - if (!nv_pair_list_find(pkg_src_list, name)) {
82 + if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) {
83 pkg_src_list_append (pkg_src_list, name, value, extra, 1);
85 ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
86 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_download.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_download.c
87 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_download.c 2006-05-09 02:12:04.000000000 +0200
88 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_download.c 2006-05-09 02:22:51.000000000 +0200
92 pkg->local_filename = strdup(url);
93 - ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand \(%s\).\n", pkg->name,pkg->local_filename);
94 + ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand (%s).\n", pkg->name,pkg->local_filename);
95 pkg->provided_by_hand = 1;
98 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/libipkg.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/libipkg.c
99 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/libipkg.c 2006-05-09 02:12:05.000000000 +0200
100 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/libipkg.c 2006-05-09 02:16:48.000000000 +0200
103 ipkg_op (int argc, char *argv[])
106 + int err, opt_index;
110 @@ -453,13 +453,13 @@
114 - optind = args_parse (&args, argc, argv);
115 - if (optind == argc || optind < 0)
116 + opt_index = args_parse (&args, argc, argv);
117 + if (opt_index == argc || opt_index < 0)
119 args_usage ("ipkg must have one sub-command argument");
122 - cmd_name = argv[optind++];
123 + cmd_name = argv[opt_index++];
124 /* Pigi: added a flag to disable the checking of structures if the command does not need to
125 read anything from there.
131 - if (cmd->requires_args && optind == argc)
132 + if (cmd->requires_args && opt_index == argc)
135 "%s: the ``%s'' command requires at least one argument\n",
140 - err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL);
141 + err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - opt_index, (const char **) (argv + opt_index), NULL);
143 ipkg_conf_deinit (&ipkg_conf);
145 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/md5.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/md5.c
146 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/md5.c 2006-05-09 02:06:48.000000000 +0200
147 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/md5.c 2006-05-09 02:16:48.000000000 +0200
149 int md5_stream(FILE *stream, void *resblock)
154 if( (fd = fileno(stream)) == -1 ) {
155 bb_error_msg("bad file descriptor");
156 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c
157 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.c 2006-05-09 02:12:05.000000000 +0200
158 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c 2006-05-09 02:16:48.000000000 +0200
160 char * pkg_formatted_field(pkg_t *pkg, const char *field )
162 static size_t LINE_LEN = 128;
163 + char line_str[LINE_LEN];
164 char * temp = (char *)malloc(1);
166 int flag_provide_false = 0;
168 if (strcasecmp(field, "Conffiles") == 0) {
170 conffile_list_elt_t *iter;
171 - char confstr[LINE_LEN];
173 if (pkg->conffiles.head == NULL) {
175 @@ -588,15 +588,14 @@
176 strncpy(temp, "Conffiles:\n", 12);
177 for (iter = pkg->conffiles.head; iter; iter = iter->next) {
178 if (iter->data->name && iter->data->value) {
179 - snprintf(confstr, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
180 - strncat(temp, confstr, strlen(confstr));
181 + snprintf(line_str, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
182 + strncat(temp, line_str, strlen(line_str));
185 } else if (strcasecmp(field, "Conflicts") == 0) {
188 if (pkg->conflicts_count) {
189 - char conflictstr[LINE_LEN];
191 for(i = 0; i < pkg->conflicts_count; i++) {
192 len = len + (strlen(pkg->conflicts_str[i])+5);
195 strncpy(temp, "Conflicts:", 11);
196 for(i = 0; i < pkg->conflicts_count; i++) {
197 - snprintf(conflictstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
198 - strncat(temp, conflictstr, strlen(conflictstr));
199 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]);
200 + strncat(temp, line_str, strlen(line_str));
202 strncat(temp, "\n", strlen("\n"));
207 if (pkg->depends_count) {
208 - char depstr[LINE_LEN];
210 for(i = 0; i < pkg->depends_count; i++) {
211 len = len + (strlen(pkg->depends_str[i])+4);
214 strncpy(temp, "Depends:", 10);
215 for(i = 0; i < pkg->depends_count; i++) {
216 - snprintf(depstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
217 - strncat(temp, depstr, strlen(depstr));
218 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]);
219 + strncat(temp, line_str, strlen(line_str));
221 strncat(temp, "\n", strlen("\n"));
224 /* Replaces | Recommends*/
225 if (strcasecmp (field, "Replaces") == 0) {
226 if (pkg->replaces_count) {
227 - char replstr[LINE_LEN];
229 for (i = 0; i < pkg->replaces_count; i++) {
230 len = len + (strlen(pkg->replaces_str[i])+5);
231 @@ -817,14 +814,13 @@
233 strncpy(temp, "Replaces:", 12);
234 for (i = 0; i < pkg->replaces_count; i++) {
235 - snprintf(replstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
236 - strncat(temp, replstr, strlen(replstr));
237 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]);
238 + strncat(temp, line_str, strlen(line_str));
240 strncat(temp, "\n", strlen("\n"));
242 } else if (strcasecmp (field, "Recommends") == 0) {
243 if (pkg->recommends_count) {
244 - char recstr[LINE_LEN];
246 for(i = 0; i < pkg->recommends_count; i++) {
247 len = len + (strlen( pkg->recommends_str[i])+5);
250 strncpy(temp, "Recommends:", 13);
251 for(i = 0; i < pkg->recommends_count; i++) {
252 - snprintf(recstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
253 - strncat(temp, recstr, strlen(recstr));
254 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]);
255 + strncat(temp, line_str, strlen(line_str));
257 strncat(temp, "\n", strlen("\n"));
260 } else if (strcasecmp(field, "Suggests") == 0) {
261 if (pkg->suggests_count) {
263 - char sugstr[LINE_LEN];
265 for(i = 0; i < pkg->suggests_count; i++) {
266 len = len + (strlen(pkg->suggests_str[i])+5);
269 strncpy(temp, "Suggests:", 10);
270 for(i = 0; i < pkg->suggests_count; i++) {
271 - snprintf(sugstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
272 - strncat(temp, sugstr, strlen(sugstr));
273 + snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]);
274 + strncat(temp, line_str, strlen(line_str));
276 strncat(temp, "\n", strlen("\n"));
278 @@ -1140,10 +1135,8 @@
282 -int pkg_name_version_and_architecture_compare(void *p1, void *p2)
283 +int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b)
285 - const pkg_t *a = *(const pkg_t **)p1;
286 - const pkg_t *b = *(const pkg_t **)p2;
289 if (!a->name || !b->name) {
290 @@ -1170,10 +1163,8 @@
294 -int abstract_pkg_name_compare(void *p1, void *p2)
295 +int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b)
297 - const abstract_pkg_t *a = *(const abstract_pkg_t **)p1;
298 - const abstract_pkg_t *b = *(const abstract_pkg_t **)p2;
299 if (!a->name || !b->name) {
300 fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n",
301 a, a->name, b, b->name);
302 @@ -1193,7 +1184,7 @@
306 - sprintf_alloc(&epoch_str, "%d:", pkg->epoch);
307 + sprintf_alloc(&epoch_str, "%d:", (int)(pkg->epoch));
309 epoch_str = strdup("");
311 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.h
312 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.h 2006-05-09 02:12:05.000000000 +0200
313 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.h 2006-05-09 02:16:48.000000000 +0200
315 char *pkg_version_str_alloc(pkg_t *pkg);
317 int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg);
318 -int pkg_name_version_and_architecture_compare(void *a, void *b);
319 -int abstract_pkg_name_compare(void *a, void *b);
320 +int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b);
321 +int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b);
323 char * pkg_formatted_info(pkg_t *pkg );
324 char * pkg_formatted_field(pkg_t *pkg, const char *field );
325 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.c
326 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.c 2006-05-09 02:12:05.000000000 +0200
327 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.c 2006-05-09 02:16:48.000000000 +0200
329 pkg_vec_t *unsatisfied, char *** unresolved)
331 pkg_t * satisfier_entry_pkg;
332 - register int i, j, k;
333 + register int i, j, k, l;
336 abstract_pkg_t * ab_pkg;
338 abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by;
339 int nposs = ab_provider_vec->len;
340 abstract_pkg_t **ab_providers = ab_provider_vec->pkgs;
342 for (l = 0; l < nposs; l++) {
343 pkg_vec_t *test_vec = ab_providers[l]->pkgs;
344 /* if no depends on this one, try the first package that Provides this one */
348 if (newstuff == NULL) {
351 - for (i = 0; i < rc; i++) {
352 - pkg_t *p = tmp_vec->pkgs[i];
353 + for (l = 0; l < rc; l++) {
354 + pkg_t *p = tmp_vec->pkgs[l];
355 if (p->state_want == SW_INSTALL)
357 ipkg_message(conf, IPKG_DEBUG, "not installing %s due to requirement for %s\n", pkg_scout->name, p->name);
358 @@ -814,27 +812,27 @@
359 * [npredepends+nrecommends,npredepends+nrecommends+nsuggests) -> returns recommends_str[index]
360 * [npredepends+nrecommends+nsuggests,npredepends+nrecommends+nsuggests+ndepends) -> returns depends_str[index]
362 -char *pkg_depend_str(pkg_t *pkg, int index)
363 +char *pkg_depend_str(pkg_t *pkg, int pkg_index)
365 - if (index < pkg->pre_depends_count) {
366 - return pkg->pre_depends_str[index];
367 + if (pkg_index < pkg->pre_depends_count) {
368 + return pkg->pre_depends_str[pkg_index];
370 - index -= pkg->pre_depends_count;
371 + pkg_index -= pkg->pre_depends_count;
373 - if (index < pkg->recommends_count) {
374 - return pkg->recommends_str[index];
375 + if (pkg_index < pkg->recommends_count) {
376 + return pkg->recommends_str[pkg_index];
378 - index -= pkg->recommends_count;
379 + pkg_index -= pkg->recommends_count;
381 - if (index < pkg->suggests_count) {
382 - return pkg->suggests_str[index];
383 + if (pkg_index < pkg->suggests_count) {
384 + return pkg->suggests_str[pkg_index];
386 - index -= pkg->suggests_count;
387 + pkg_index -= pkg->suggests_count;
389 - if (index < pkg->depends_count) {
390 - return pkg->depends_str[index];
391 + if (pkg_index < pkg->depends_count) {
392 + return pkg->depends_str[pkg_index];
394 - fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name);
395 + fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", pkg_index, pkg->name);
399 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.h
400 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.h 2006-05-09 02:06:48.000000000 +0200
401 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.h 2006-05-09 02:16:48.000000000 +0200
404 int pkg_conflicts(pkg_t *pkg, pkg_t *conflicts);
406 -char *pkg_depend_str(pkg_t *pkg, int index);
407 +char *pkg_depend_str(pkg_t *pkg, int pkg_index);
408 void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg);
409 void freeDepends(pkg_t *pkg);
410 void printDepends(pkg_t * pkg);
411 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_hash.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_hash.c
412 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_hash.c 2006-05-09 02:12:05.000000000 +0200
413 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_hash.c 2006-05-09 02:17:35.000000000 +0200
415 pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg,
416 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet)
422 pkg_vec_t *matching_pkgs = pkg_vec_alloc();
423 @@ -209,11 +209,10 @@
424 /* now check for supported architecture */
429 /* count packages matching max arch priority and keep track of last one */
430 - for (i = 0; i < vec->len; i++) {
431 - pkg_t *maybe = vec->pkgs[i];
432 + for (j = 0; j < vec->len; j++) {
433 + pkg_t *maybe = vec->pkgs[j];
434 ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d version=%s \n",
435 maybe->name, maybe->architecture, maybe->arch_priority, maybe->version);
436 if (maybe->arch_priority > 0) {
437 diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_vec.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_vec.h
438 --- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_vec.h 2006-05-09 02:06:48.000000000 +0200
439 +++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_vec.h 2006-05-09 02:16:48.000000000 +0200
442 typedef struct abstract_pkg_vec abstract_pkg_vec_t;
444 +typedef int (*pkg_compar_t)(pkg_t *, pkg_t *);
445 +typedef int (*abstract_pkg_compar_t)(abstract_pkg_t *, abstract_pkg_t *);
447 pkg_vec_t * pkg_vec_alloc(void);
448 void pkg_vec_free(pkg_vec_t *vec);