2 Commits

Author SHA1 Message Date
Dav999 85dae94d2e Avoid compiler warning about signedness mismatch
This warning kept appearing for me:

Script.cpp:350:35: warning: comparison of integer expressions of
different signedness: ‘int’ and
‘std::__cxx11::basic_string<char>::size_type’
{aka ‘long unsigned int’} [-Wsign-compare]

  350 |                 for (int i = 0; i < words[1].size(); i++)
      |                                 ~~^~~~~~~~~~~~~~~~~

So I just made it a size_t instead.
2026-05-14 06:10:52 -04:00
Dav999 08aa7c9087 Remove nuisance Vorbis errors on blank music slots
When vvvvvvmusic.vvv files contain blank slots before the last valid
song, the following error message would be output for all of them:

[ERROR] Unable to create Vorbis handle, error 30

Now, this is very common: many levels, for example, ship a music file
where songs start at slot 16, or alternatively they used slots 0-15 but
didn't need every slot. Or IDs are skipped so that certain songs are
on their own page in the music editor. Either way, I've seen bursts of
this message appear in my console a lot when loading levels lol, so it
became time this was silenced by not bothering to load a <=1 byte song,
and giving a (silenced by default) debug message in that case instead.

(It checks for <= 1 byte, because in all these cases, the empty slots
have a single null byte in them. I looked up why that is again, and it
is because, in 2019, "Rumor goes that 0-byte tracks actually mess
things up in VVVVVV". We could probably verify if that's the case now,
but music files have been made this way for ages, and it's pretty clear
a 1-byte song is not usable.)
2026-05-14 06:10:52 -04:00
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -381,6 +381,12 @@ public:
MusicTrack(SDL_RWops *rw, const char* _id, bool _loose_extra)
{
SDL_zerop(this);
if (rw->size(rw) <= 1)
{
// Don't bother
vlog_debug("Skipping empty music track");
goto end;
}
read_buf = (Uint8*) SDL_malloc(rw->size(rw));
SDL_RWread(rw, read_buf, rw->size(rw), 1);
int err;
+1 -1
View File
@@ -347,7 +347,7 @@ void scriptclass::run(void)
int current = 0;
// Crawl through the string
for (int i = 0; i < words[1].size(); i++)
for (size_t i = 0; i < words[1].size(); i++)
{
// If the current character is a number, add it to the current version part
if (words[1][i] >= '0' && words[1][i] <= '9')