X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tools%2Flib%2Fcarlfw.c;h=44897e39ef8ee07a1c0b464a1cc7857f303bb854;hb=007045ac7c9822009b704b856e2f92934cca2401;hp=de942219833ecc87c3ca713d25a6022fcd8c6fdf;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/tools/lib/carlfw.c b/tools/lib/carlfw.c index de94221..44897e3 100644 --- a/tools/lib/carlfw.c +++ b/tools/lib/carlfw.c @@ -170,7 +170,7 @@ static int __carlfw_load(struct carlfw_file *file, const char *name, const char err = fread(file->data, file->len, 1, fh); if (err != 1) - return ferror(fh); + return -ferror(fh); file->name = strdup(name); fclose(fh); @@ -190,18 +190,18 @@ static void *__carlfw_find_desc(struct carlfw_file *file, struct carl9170fw_desc_head *tmp = NULL; while (scan >= 0) { - if (file->data[scan] == descid[sizeof(descid) - found - 1]) + if (file->data[scan] == descid[CARL9170FW_MAGIC_SIZE - found - 1]) found++; else found = 0; - if (found == sizeof(descid)) + if (found == CARL9170FW_MAGIC_SIZE) break; scan--; } - if (found == sizeof(descid)) { + if (found == CARL9170FW_MAGIC_SIZE) { tmp = (void *) &file->data[scan]; if (!CHECK_HDR_VERSION(tmp, compatible_revision) && @@ -280,7 +280,7 @@ void carlfw_desc_del(struct carlfw *fw, } void *carlfw_desc_mod_len(struct carlfw *fw __unused, - struct carl9170fw_desc_head *desc, int len) + struct carl9170fw_desc_head *desc, size_t len) { struct carlfw_list_entry *obj, tmp; int new_len = le16_to_cpu(desc->length) + len; @@ -563,14 +563,14 @@ int carlfw_store(struct carlfw *fw) err = fwrite(iter->data, elen, 1, fh); if (err != 1) { - err = ferror(fh); + err = -ferror(fh); goto close_out; } } err = fwrite(&last_desc, sizeof(last_desc), 1, fh); if (err != 1) { - err = ferror(fh); + err = -ferror(fh); goto close_out; }