Skip to content

Commit

Permalink
Make VC compiler happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
syoyo committed Apr 6, 2012
1 parent de234a4 commit 6d3c81c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lfpsplitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ typedef unsigned int uint32_t;
#define BLANK_LENGTH 35
#define STRING_LENGTH 256

#ifdef _MSC_VER
#define snprintf _snprintf
#endif

// TODO: read directly from the file instead of copying to a string
// since camera backup files can be in the hundreds of megabytes
static lfp_file_p lfp_create(const char *filename)
Expand All @@ -49,7 +53,7 @@ static lfp_file_p lfp_create(const char *filename)
fseek(fp, 0, SEEK_END);
lfp->len = ftell(fp);
fseek(fp, 0, SEEK_SET);
lfp->data = malloc(lfp->len);
lfp->data = (char*)malloc(lfp->len);

lfp->len = fread(lfp->data, 1, lfp->len, fp);
fclose(fp);
Expand Down Expand Up @@ -120,7 +124,7 @@ static char *depth_string(const char *data, int *datalen, int len)
{
// make sure there is enough space for the ascii formatted floats
int filelen = 20*len/4;
char *depth = malloc(filelen);
char *depth = (char*)malloc(filelen);
char *start = depth;
int i = 0;

Expand All @@ -145,7 +149,7 @@ static char *converted_image(const unsigned char *data, int *datalen, int len)
{
int filelen = 4*len/3;
const unsigned char *ptr = data;
unsigned short *image = malloc(filelen*sizeof(short));
unsigned short *image = (unsigned short*)malloc(filelen*sizeof(short));
unsigned short *start = image;

if (!image) return NULL;
Expand Down Expand Up @@ -188,7 +192,7 @@ static void lfp_identify_section(lfp_file_p lfp, lfp_section_p section)
char jpeg[10] = {0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46};
char *ptr = NULL;
int quotecount = 0;
section->name = malloc(STRING_LENGTH);
section->name = (char*)malloc(STRING_LENGTH);

// Find the sha1 in the table of contents
if ((ptr = strstr(lfp->table->data, section->sha1))) {
Expand Down

0 comments on commit 6d3c81c

Please sign in to comment.