Browse Source

Fix some warnings in nanovg code

pull/6/head
falkTX 10 years ago
parent
commit
38732fe79d
2 changed files with 6 additions and 2 deletions
  1. +4
    -1
      dgl/src/nanovg/fontstash.h
  2. +2
    -1
      dgl/src/nanovg/stb_image.h

+ 4
- 1
dgl/src/nanovg/fontstash.h View File

@@ -854,6 +854,7 @@ int fonsAddFont(FONScontext* stash, const char* name, const char* path)
FILE* fp = 0;
int dataSize = 0;
unsigned char* data = NULL;
size_t ignore;

// Read in the font data.
fp = fopen(path, "rb");
@@ -863,7 +864,7 @@ int fonsAddFont(FONScontext* stash, const char* name, const char* path)
fseek(fp,0,SEEK_SET);
data = (unsigned char*)malloc(dataSize);
if (data == NULL) goto error;
fread(data, 1, dataSize, fp);
ignore = fread(data, 1, dataSize, fp);
fclose(fp);
fp = 0;

@@ -873,6 +874,8 @@ error:
if (data) free(data);
if (fp) fclose(fp);
return FONS_INVALID;

FONS_NOTUSED(ignore);
}

int fonsAddFontMem(FONScontext* stash, const char* name, unsigned char* data, int dataSize, int freeData)


+ 2
- 1
dgl/src/nanovg/stb_image.h View File

@@ -4127,7 +4127,8 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
static stbi_uc *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi_uc *u = 0;
stbi__gif g={0};
stbi__gif g;
memset(&g, 0, sizeof(stbi__gif));

u = stbi__gif_load_next(s, &g, comp, req_comp);
if (u == (void *) 1) u = 0; // end of animated gif marker


Loading…
Cancel
Save