fix string and malloc compilation issues
This commit is contained in:
parent
4349f3f82c
commit
60b1626342
@ -17,10 +17,10 @@ GLuint TextureCache::load(const char *fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
SDL_Surface * temp = IMG_Load(filename);
|
SDL_Surface * temp = IMG_Load(filename.c_str());
|
||||||
if (!temp)
|
if (!temp)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to load image '%s'!\n", filename);
|
fprintf(stderr, "Failed to load image '%s'!\n", filename.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,11 +41,10 @@ GLuint TextureCache::load(const char *fname)
|
|||||||
SDL_FreeSurface(temp);
|
SDL_FreeSurface(temp);
|
||||||
if (!texsurf)
|
if (!texsurf)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "'%s' was not converted properly!\n", filename);
|
fprintf(stderr, "'%s' was not converted properly!\n", filename.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned int * pixels =
|
unsigned int * pixels = new unsigned int[texsurf->w * texsurf->h];
|
||||||
malloc(sizeof(unsigned int) * texsurf->w * texsurf->h);
|
|
||||||
int y;
|
int y;
|
||||||
unsigned int dstOffset = texsurf->w * (texsurf->h - 1);
|
unsigned int dstOffset = texsurf->w * (texsurf->h - 1);
|
||||||
unsigned int srcOffset = 0;
|
unsigned int srcOffset = 0;
|
||||||
@ -63,7 +62,7 @@ GLuint TextureCache::load(const char *fname)
|
|||||||
GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
SDL_FreeSurface(texsurf);
|
SDL_FreeSurface(texsurf);
|
||||||
free(pixels);
|
delete[] pixels;
|
||||||
|
|
||||||
m_cache[filename] = texture;
|
m_cache[filename] = texture;
|
||||||
return texture;
|
return texture;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user