Fix GCC errors and warnings

This commit is contained in:
shermp
2019-06-09 22:46:48 +12:00
parent 2ba2fd8e33
commit 40e5d61798
5 changed files with 16 additions and 5 deletions

View File

@@ -25,7 +25,8 @@ typedef struct MVHDGeom {
uint8_t spt;
} MVHDGeom;
typedef struct MVHDMeta {
typedef struct MVHDMeta MVHDMeta;
struct MVHDMeta {
FILE* f;
char* filename;
struct MVHDMeta* parent;
@@ -37,7 +38,7 @@ typedef struct MVHDMeta {
int (*read_sectors)(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
int (*write_sectors)(MVHDMeta* vhdm, int offset, int num_sectors, void* in_buff);
int (*format_sectors)(MVHDMeta* vhdm, int offset, int num_sectors);
} MVHDMeta;
};
MVHDMeta* mvhd_open(const char* path, int* err);
MVHDMeta* mvhd_create_fixed(const char* path, MVHDGeom geom, int* err);

View File

@@ -68,7 +68,4 @@ void mvhd_buffer_to_header(MVHDSparseHeader* header, uint8_t* buffer);
void mvhd_footer_to_buffer(MVHDFooter* footer, uint8_t* buffer);
void mvhd_header_to_buffer(MVHDSparseHeader* header, uint8_t* buffer);
void mvhd_generate_uuid(uint8_t *uuid);
int mvhd_fixed_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
int mvhd_sparse_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
int mvhd_diff_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
#endif

9
src/minivhd_io.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef MINIVHD_IO_H
#define MINIVHD_IO_H
#include "minivhd.h"
int mvhd_fixed_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
int mvhd_sparse_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
int mvhd_diff_read(MVHDMeta* vhdm, int offset, int num_sectors, void* out_buff);
#endif

View File

@@ -5,6 +5,7 @@
#include <string.h>
#include "bswap.h"
#include "minivhd_internal.h"
#include "minivhd_io.h"
#include "minivhd.h"
static bool mvhd_file_is_vhd(FILE* f);
@@ -181,6 +182,7 @@ MVHDMeta* mvhd_open(const char* path, int* err) {
*err = bat_err;
goto cleanup_file;
}
mvhd_calc_sparse_values(vhdm);
} else if (vhdm->footer.disk_type != MVHD_TYPE_FIXED) {
*err = MVHD_ERR_TYPE;

View File

@@ -1,5 +1,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_UUID_H
#include <uuid/uuid.h>
#endif