projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 364 forks source link

warning: implicit conversion from 'const typename basic_string<char, char_traits<char>, allocator<char>>::size_type' (aka 'const unsigned long') to 'int' changes value from 18446744073709551615 to -1 #714

Closed yurivict closed 1 year ago

yurivict commented 1 year ago

This warning looks potentially damaging:

In file included from projectM/src/libprojectM/FileScanner.cpp:7:
In file included from projectM/src/libprojectM/FileScanner.hpp:14:
projectM/src/libprojectM/Common.hpp:252:12: warning: implicit conversion from 'const typename basic_string<char, char_traits<char>, allocator<char>>::size_type' (aka 'const unsigned long') to 'int' changes value from 18446744073709551615 to -1 [-Wconstant-conversion]
    return std::string::npos;
    ~~~~~~ ^~~~~~~~~~~~~~~~~
kblaschke commented 1 year ago

Could you please add some context to this warning, e.g. post the commit hash, add a permalink to the specific file & commit, or copy & paste the actual code plus a few lines of context here? Since Common.hpp has seen lots of changes in the recent past, it's hard to tell which actual version you're trying to compile.

Thanks!

yurivict commented 1 year ago

Sorry, I use the version 4.0.0

kblaschke commented 1 year ago

Then the compiler output seems a bit off, as it says the issue it warns about is in line 252 of Common.hpp, but in v4.0.0, it only has 90 lines, including the newline at end of file. Going back in the commit history, I can find a line that will cause the above warning: https://github.com/projectM-visualizer/projectm/blob/7c8d1583ce4fd1b6865093bdbc7e5e7fb1e93fde/src/libprojectM/Common.hpp#L252

But this specific code has been removed a while ago. So please, check again if you're really using the latest commit (or the v4.0.0 release archive). If so, and the warning still persists, please provide a bit more context, e.g. the actual line the compiler is complaining about or upload your version of Common.hpp as an attachment here.

yurivict commented 1 year ago

Ah, sorry. This is from a bundled version of projectM in https://github.com/DISTRHO/DPF-Plugins

kblaschke commented 1 year ago

In this case, I'd suggest you open an issue in the DISTRHO/DPF-Plugins repo, and ask the author to update their version of libprojectM to the final 4.0 release. Looking at the code in the repository, the version is quite old, probably the 3.1.12 release.

The above mentioned warning is already fixed in the current projectM release, so I'll close this issue here.