Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.6.0 warnings treated as error with vs 2019  (Read 1180 times)

0 Members and 1 Guest are viewing this topic.

cmathai

  • Newbie
  • *
  • Posts: 5
    • View Profile
SFML 2.6.0 warnings treated as error with vs 2019
« on: October 24, 2023, 02:13:24 am »
Hello, I noticed I when I try to compile SFML with VS 2019, I get the following compilation warning (that gets treated as an error)

Severity   Code   Description   Project   File   Line   Suppression State
Warning   C4242   '=': conversion from 'int' to 'unsigned char', possible loss of data   sfml-graphics   C:\SFML-2.6.0-sources\SFML-2.6.0\extlibs\headers\stb_image\stb_image.h   3425   

I noticed this is because, j->marker in stbi__decode_jpeg_image is unsigned char while stbi__skip_jpeg_junk_at_end returns an int. In the method stbi__skip_jpeg_junk_at_end, I see we should really be returning an unsigned char, but return int instead. Specifically changing
static int stbi__skip_jpeg_junk_at_end(stbi__jpeg *j) to
static unsigned char stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)
and
int x = stbi__get8(j->s); to
unsigned char x = stbi__get8(j->s); fixes the problem.

There is a similar issue with arguments passed to stbi__mul2shorts_valid (method takes short, but passing in int)

Should I open an issue ?
« Last Edit: October 24, 2023, 02:21:10 am by cmathai »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML 2.6.0 warnings treated as error with vs 2019
« Reply #1 on: October 24, 2023, 09:00:01 am »
I believe this was already fixed: https://github.com/SFML/SFML/pull/2464

For the upcoming SFML 2.6.1 release, we've also disabled treat-warning-as-error, to prevent hard failures.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

cmathai

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SFML 2.6.0 warnings treated as error with vs 2019
« Reply #2 on: October 24, 2023, 08:32:10 pm »
Thanks!

 

anything