Merge pull request #4434 from karjonas/always_true

Fix 'i >= 0' always true bug
pull/4421/head^2
Kim Kulling 2022-03-10 11:37:03 +01:00 committed by GitHub
commit 1b3ae63527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -122,15 +122,15 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char *filename, int mode) {
voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode) { voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode) {
ZipFile *io_stream = (ZipFile *)stream; ZipFile *io_stream = (ZipFile *)stream;
voidpf ret = NULL; voidpf ret = NULL;
size_t i; int i;
char *disk_filename = (char*)malloc(io_stream->m_Filename.length() + 1); char *disk_filename = (char*)malloc(io_stream->m_Filename.length() + 1);
strncpy(disk_filename, io_stream->m_Filename.c_str(), io_stream->m_Filename.length() + 1); strncpy(disk_filename, io_stream->m_Filename.c_str(), io_stream->m_Filename.length() + 1);
for (i = io_stream->m_Filename.length() - 1; i >= 0; i -= 1) for (i = (int)io_stream->m_Filename.length() - 1; i >= 0; i -= 1)
{ {
if (disk_filename[i] != '.') if (disk_filename[i] != '.')
continue; continue;
snprintf(&disk_filename[i], io_stream->m_Filename.length() - i, ".z%02u", number_disk + 1); snprintf(&disk_filename[i], io_stream->m_Filename.length() - size_t(i), ".z%02u", number_disk + 1);
break; break;
} }