Skip to content

Commit

Permalink
removed some warnings from the stb_image_writer header, it's not been…
Browse files Browse the repository at this point in the history
… updated for 2 years so still the old download
  • Loading branch information
jmacey committed Oct 6, 2023
1 parent 9b5b2a9 commit 0f5dca6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 9 additions & 9 deletions 3rdparty/stb_image_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,15 @@ static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, c

STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context(); //{0};
stbi__start_write_callbacks(&s, func, context);
return stbi_write_bmp_core(&s, x, y, comp, data);
}

#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context(); //{0};
if(stbi__start_write_file(&s, filename))
{
int r = stbi_write_bmp_core(&s, x, y, comp, data);
Expand Down Expand Up @@ -661,15 +661,15 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v

STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context(); //{0};
stbi__start_write_callbacks(&s, func, context);
return stbi_write_tga_core(&s, x, y, comp, (void *)data);
}

#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context(); //{0};
if(stbi__start_write_file(&s, filename))
{
int r = stbi_write_tga_core(&s, x, y, comp, (void *)data);
Expand Down Expand Up @@ -845,7 +845,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
#ifdef __STDC_LIB_EXT1__
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
#else
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
len = snprintf(buffer,128, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
#endif
s->func(s->context, buffer, len);

Expand All @@ -858,14 +858,14 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f

STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context();
stbi__start_write_callbacks(&s, func, context);
return stbi_write_hdr_core(&s, x, y, comp, (float *)data);
}

STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context();
if(stbi__start_write_file(&s, filename))
{
int r = stbi_write_hdr_core(&s, x, y, comp, (float *)data);
Expand Down Expand Up @@ -1759,15 +1759,15 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in

STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context(); // {0};
stbi__start_write_callbacks(&s, func, context);
return stbi_write_jpg_core(&s, x, y, comp, (void *)data, quality);
}

#ifndef STBI_WRITE_NO_STDIO
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)
{
stbi__write_context s = {0};
stbi__write_context s = stbi__write_context();
if(stbi__start_write_file(&s, filename))
{
int r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
Expand Down
5 changes: 2 additions & 3 deletions src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ Vec4 Image::getColour(const GLuint _x, const GLuint _y) const noexcept
Vec4 Image::getColour(const Real _uvX, const Real _uvY) const noexcept
{

auto xx = static_cast< GLuint >(_uvX * (m_width - 1));
auto yy = static_cast< GLuint >(_uvY * (m_height - 1));
auto xx = static_cast< GLuint >(static_cast<GLuint>(_uvX) * (m_width - 1));
auto yy = static_cast< GLuint >(static_cast<GLuint>(_uvY) * (m_height - 1));

NGL_ASSERT(xx < m_width && yy < m_height)

Expand Down Expand Up @@ -373,7 +373,6 @@ bool Image::load(std::string_view _fname,bool _flipY) noexcept
int ch;
stbi_set_flip_vertically_on_load(_flipY);


if(const unsigned char *img = stbi_load(fname, &w, &h, &ch, 0); img != nullptr)
{
NGLMessage::addMessage(fmt::format("loaded {} Width {} Height {} Channels {}", fname, w, h, ch));
Expand Down

0 comments on commit 0f5dca6

Please sign in to comment.