* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
#include <sys/stat.h>
static int read_section(FILE *input_file, int length_size, char section,
#include <sys/stat.h>
static int read_section(FILE *input_file, int length_size, char section,
- if ((read_count = fread(§ion_char, 1, 1, input_file)) != 1)
- {
+ read_count = fread(§ion_char, 1, 1, input_file);
+ if (read_count != 1)
- if ((read_count = fread(length_buffer, 1, length_size, input_file)) != length_size)
- {
+ read_count = fread(length_buffer, 1, length_size, input_file);
+ if (read_count != length_size)
- if ((read_count = fread(*buffer, 1, length, input_file)) != length)
- {
+ read_count = fread(*buffer, 1, length, input_file);
+ if (read_count != length)
LOG_ERROR("couldn't stat() %s: %s", filename, strerror(errno));
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("couldn't stat() %s: %s", filename, strerror(errno));
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("%s is a directory", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("%s is a directory", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("Empty file %s", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("Empty file %s", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("couldn't open %s: %s", filename, strerror(errno));
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("couldn't open %s: %s", filename, strerror(errno));
return ERROR_PLD_FILE_LOAD_FAILED;
}
- if ((read_count = fread(bit_file->unknown_header, 1, 13, input_file)) != 13)
- {
+ read_count = fread(bit_file->unknown_header, 1, 13, input_file);
+ if (read_count != 13) {
LOG_ERROR("couldn't read unknown_header from file '%s'", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
LOG_ERROR("couldn't read unknown_header from file '%s'", filename);
return ERROR_PLD_FILE_LOAD_FAILED;
}
if (read_section(input_file, 4, 'e', &bit_file->length, &bit_file->data) != ERROR_OK)
return ERROR_PLD_FILE_LOAD_FAILED;
if (read_section(input_file, 4, 'e', &bit_file->length, &bit_file->data) != ERROR_OK)
return ERROR_PLD_FILE_LOAD_FAILED;
- LOG_DEBUG("bit_file: %s %s %s,%s %i", bit_file->source_file, bit_file->part_name,
+ LOG_DEBUG("bit_file: %s %s %s,%s %" PRIi32 "", bit_file->source_file, bit_file->part_name,