/*
- * Copyright 2010, Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
err = fread(file->data, file->len, 1, fh);
if (err != 1)
- return ferror(fh);
+ return -ferror(fh);
file->name = strdup(name);
fclose(fh);
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) &&
}
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;
init_list_head(&fw->desc_list);
- snprintf(filename, sizeof(filename), "%s.dsc", basename);
- err = __carlfw_load(&fw->hdr, filename, "r");
-
- snprintf(filename, sizeof(filename), "%s.fw", basename);
- err = __carlfw_load(&fw->fw, filename, "r");
- if (!err)
- goto found;
-
err = __carlfw_load(&fw->fw, basename, "r");
if (err)
goto err_out;
-found:
if (fw->hdr.name)
hdr_file = &fw->hdr;
else
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;
}