Skip to content

Commit

Permalink
Fixed invalid literal PRI- when compiling with C++. #416
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Sep 16, 2019
1 parent 8bba5e3 commit fe33c3d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 68 deletions.
40 changes: 20 additions & 20 deletions minizip.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int32_t minizip_list(const char *path)
err = mz_zip_reader_open_file(reader, path);
if (err != MZ_OK)
{
printf("Error %"PRId32" opening archive %s\n", err, path);
printf("Error %" PRId32 " opening archive %s\n", err, path);
mz_zip_reader_delete(&reader);
return err;
}
Expand All @@ -123,7 +123,7 @@ int32_t minizip_list(const char *path)

if (err != MZ_OK && err != MZ_END_OF_LIST)
{
printf("Error %"PRId32" going to first entry in archive\n", err);
printf("Error %" PRId32 " going to first entry in archive\n", err);
mz_zip_reader_delete(&reader);
return err;
}
Expand All @@ -138,7 +138,7 @@ int32_t minizip_list(const char *path)

if (err != MZ_OK)
{
printf("Error %"PRId32" getting entry info in archive\n", err);
printf("Error %" PRId32 " getting entry info in archive\n", err);
break;
}

Expand Down Expand Up @@ -181,8 +181,8 @@ int32_t minizip_list(const char *path)
mz_zip_time_t_to_tm(file_info->modified_date, &tmu_date);

/* Print entry information */
printf("%12"PRId64" %12"PRId64" %3"PRIu32"%% %6s%c %8"PRIx32" %2.2"PRIu32\
"-%2.2"PRIu32"-%2.2"PRIu32" %2.2"PRIu32":%2.2"PRIu32" %8.8"PRIx32" %s\n",
printf("%12" PRId64 " %12" PRId64 " %3" PRIu32 "%% %6s%c %8" PRIx32 " %2.2" PRIu32 \
"-%2.2" PRIu32 "-%2.2" PRIu32 " %2.2" PRIu32 ":%2.2" PRIu32 " %8.8" PRIx32 " %s\n",
file_info->compressed_size, file_info->uncompressed_size, ratio,
string_method, crypt, file_info->external_fa,
(uint32_t)tmu_date.tm_mon + 1, (uint32_t)tmu_date.tm_mday,
Expand All @@ -194,7 +194,7 @@ int32_t minizip_list(const char *path)

if (err != MZ_OK && err != MZ_END_OF_LIST)
{
printf("Error %"PRId32" going to next entry in archive\n", err);
printf("Error %" PRId32 " going to next entry in archive\n", err);
break;
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ int32_t minizip_add_progress_cb(void *handle, void *userdata, mz_zip_file *file_

/* Print the progress of the current compress operation */
if (options->verbose)
printf("%s - %"PRId64" / %"PRId64" (%.02f%%)\n", file_info->filename, position,
printf("%s - %" PRId64 " / %" PRId64 " (%.02f%%)\n", file_info->filename, position,
file_info->uncompressed_size, progress);
return MZ_OK;
}
Expand Down Expand Up @@ -314,18 +314,18 @@ int32_t minizip_add(const char *path, const char *password, minizip_opt *options
/* Add file system path to archive */
err = mz_zip_writer_add_path(writer, filename_in_zip, NULL, options->include_path, 1);
if (err != MZ_OK)
printf("Error %"PRId32" adding path to archive %s\n", err, filename_in_zip);
printf("Error %" PRId32 " adding path to archive %s\n", err, filename_in_zip);
}
}
else
{
printf("Error %"PRId32" opening archive for writing\n", err);
printf("Error %" PRId32 " opening archive for writing\n", err);
}

err_close = mz_zip_writer_close(writer);
if (err_close != MZ_OK)
{
printf("Error %"PRId32" closing archive for writing %s\n", err_close, path);
printf("Error %" PRId32 " closing archive for writing %s\n", err_close, path);
err = err_close;
}

Expand Down Expand Up @@ -363,7 +363,7 @@ int32_t minizip_extract_progress_cb(void *handle, void *userdata, mz_zip_file *f

/* Print the progress of the current extraction */
if (options->verbose)
printf("%s - %"PRId64" / %"PRId64" (%.02f%%)\n", file_info->filename, position,
printf("%s - %" PRId64 " / %" PRId64 " (%.02f%%)\n", file_info->filename, position,
file_info->uncompressed_size, progress);

return MZ_OK;
Expand Down Expand Up @@ -422,7 +422,7 @@ int32_t minizip_extract(const char *path, const char *pattern, const char *desti

if (err != MZ_OK)
{
printf("Error %"PRId32" opening archive %s\n", err, path);
printf("Error %" PRId32 " opening archive %s\n", err, path);
}
else
{
Expand All @@ -443,14 +443,14 @@ int32_t minizip_extract(const char *path, const char *pattern, const char *desti
}
else if (err != MZ_OK)
{
printf("Error %"PRId32" saving entries to disk %s\n", err, path);
printf("Error %" PRId32 " saving entries to disk %s\n", err, path);
}
}

err_close = mz_zip_reader_close(reader);
if (err_close != MZ_OK)
{
printf("Error %"PRId32" closing archive for reading\n", err_close);
printf("Error %" PRId32 " closing archive for reading\n", err_close);
err = err_close;
}

Expand Down Expand Up @@ -490,7 +490,7 @@ int32_t minizip_erase(const char *src_path, const char *target_path, int32_t arg
err = mz_zip_reader_open_file(reader, src_path);
if (err != MZ_OK)
{
printf("Error %"PRId32" opening archive for reading %s\n", err, src_path);
printf("Error %" PRId32 " opening archive for reading %s\n", err, src_path);
mz_zip_reader_delete(&reader);
return err;
}
Expand All @@ -499,7 +499,7 @@ int32_t minizip_erase(const char *src_path, const char *target_path, int32_t arg
err = mz_zip_writer_open_file(writer, target_path_ptr, 0, 0);
if (err != MZ_OK)
{
printf("Error %"PRId32" opening archive for writing %s\n", err, target_path_ptr);
printf("Error %" PRId32 " opening archive for writing %s\n", err, target_path_ptr);
mz_zip_reader_delete(&reader);
mz_zip_writer_delete(&writer);
return err;
Expand All @@ -508,14 +508,14 @@ int32_t minizip_erase(const char *src_path, const char *target_path, int32_t arg
err = mz_zip_reader_goto_first_entry(reader);

if (err != MZ_OK && err != MZ_END_OF_LIST)
printf("Error %"PRId32" going to first entry in archive\n", err);
printf("Error %" PRId32 " going to first entry in archive\n", err);

while (err == MZ_OK)
{
err = mz_zip_reader_entry_get_info(reader, &file_info);
if (err != MZ_OK)
{
printf("Error %"PRId32" getting info from archive\n", err);
printf("Error %" PRId32 " getting info from archive\n", err);
break;
}

Expand All @@ -541,14 +541,14 @@ int32_t minizip_erase(const char *src_path, const char *target_path, int32_t arg

if (err != MZ_OK)
{
printf("Error %"PRId32" copying entry into new zip\n", err);
printf("Error %" PRId32 " copying entry into new zip\n", err);
break;
}

err = mz_zip_reader_goto_next_entry(reader);

if (err != MZ_OK && err != MZ_END_OF_LIST)
printf("Error %"PRId32" going to next entry in archive\n", err);
printf("Error %" PRId32 " going to next entry in archive\n", err);
}

mz_zip_reader_get_zip_cd(reader, &zip_cd);
Expand Down
24 changes: 12 additions & 12 deletions mz_strm_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static int32_t mz_stream_buffered_reset(void *stream)
int32_t mz_stream_buffered_open(void *stream, const char *path, int32_t mode)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
mz_stream_buffered_print("Buffered - Open (mode %"PRId32")\n", mode);
mz_stream_buffered_print("Buffered - Open (mode %" PRId32 ")\n", mode);
mz_stream_buffered_reset(buffered);
return mz_stream_open(buffered->stream.base, path, mode);
}
Expand Down Expand Up @@ -107,7 +107,7 @@ static int32_t mz_stream_buffered_flush(void *stream, int32_t *written)

buffered->writebuf_misses += 1;

mz_stream_buffered_print("Buffered - Write flush (%"PRId32":%"PRId32" len %"PRId32")\n",
mz_stream_buffered_print("Buffered - Write flush (%" PRId32 ":%" PRId32 " len %" PRId32 ")\n",
bytes_to_write, bytes_left_to_write, buffered->writebuf_len);

total_bytes_written += bytes_written;
Expand All @@ -131,11 +131,11 @@ int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size)
int32_t bytes_left_to_read = size;
int32_t bytes_read = 0;

mz_stream_buffered_print("Buffered - Read (size %"PRId32" pos %"PRId64")\n", size, buffered->position);
mz_stream_buffered_print("Buffered - Read (size %" PRId32 " pos %" PRId64 ")\n", size, buffered->position);

if (buffered->writebuf_len > 0)
{
mz_stream_buffered_print("Buffered - Switch from write to read, not yet supported (pos %"PRId64")\n",
mz_stream_buffered_print("Buffered - Switch from write to read, not yet supported (pos %" PRId64 ")\n",
buffered->position);
}

Expand All @@ -158,7 +158,7 @@ int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size)
buffered->readbuf_len += bytes_read;
buffered->position += bytes_read;

mz_stream_buffered_print("Buffered - Filled (read %"PRId32"/%"PRId32" buf %"PRId32":%"PRId32" pos %"PRId64")\n",
mz_stream_buffered_print("Buffered - Filled (read %" PRId32 "/%" PRId32 " buf %" PRId32 ":%" PRId32 " pos %" PRId64 ")\n",
bytes_read, bytes_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position);

if (bytes_read == 0)
Expand All @@ -179,7 +179,7 @@ int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size)
buffered->readbuf_hits += 1;
buffered->readbuf_pos += bytes_to_copy;

mz_stream_buffered_print("Buffered - Emptied (copied %"PRId32" remaining %"PRId32" buf %"PRId32":%"PRId32" pos %"PRId64")\n",
mz_stream_buffered_print("Buffered - Emptied (copied %" PRId32 " remaining %" PRId32 " buf %" PRId32 ":%" PRId32 " pos %" PRId64 ")\n",
bytes_to_copy, bytes_left_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position);
}
}
Expand All @@ -198,7 +198,7 @@ int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size)
int32_t err = MZ_OK;


mz_stream_buffered_print("Buffered - Write (size %"PRId32" len %"PRId32" pos %"PRId64")\n",
mz_stream_buffered_print("Buffered - Write (size %" PRId32 " len %" PRId32 " pos %" PRId64 ")\n",
size, buffered->writebuf_len, buffered->position);

if (buffered->readbuf_len > 0)
Expand All @@ -209,7 +209,7 @@ int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size)
buffered->readbuf_len = 0;
buffered->readbuf_pos = 0;

mz_stream_buffered_print("Buffered - Switch from read to write (pos %"PRId64")\n", buffered->position);
mz_stream_buffered_print("Buffered - Switch from read to write (pos %" PRId64 ")\n", buffered->position);

err = mz_stream_seek(buffered->stream.base, buffered->position, MZ_SEEK_SET);
if (err != MZ_OK)
Expand Down Expand Up @@ -239,7 +239,7 @@ int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size)
memcpy(buffered->writebuf + buffered->writebuf_pos,
(const char *)buf + (bytes_to_write - bytes_left_to_write), bytes_to_copy);

mz_stream_buffered_print("Buffered - Write copy (remaining %"PRId32" write %"PRId32":%"PRId32" len %"PRId32")\n",
mz_stream_buffered_print("Buffered - Write copy (remaining %" PRId32 " write %" PRId32 ":%" PRId32 " len %" PRId32 ")\n",
bytes_to_copy, bytes_to_write, bytes_left_to_write, buffered->writebuf_len);

bytes_left_to_write -= bytes_to_copy;
Expand All @@ -260,7 +260,7 @@ int64_t mz_stream_buffered_tell(void *stream)

buffered->position = position;

mz_stream_buffered_print("Buffered - Tell (pos %"PRId64" readpos %"PRId32" writepos %"PRId32")\n",
mz_stream_buffered_print("Buffered - Tell (pos %" PRId64 " readpos %" PRId32 " writepos %" PRId32 ")\n",
buffered->position, buffered->readbuf_pos, buffered->writebuf_pos);

if (buffered->readbuf_len > 0)
Expand All @@ -276,7 +276,7 @@ int32_t mz_stream_buffered_seek(void *stream, int64_t offset, int32_t origin)
int32_t bytes_flushed = 0;
int32_t err = MZ_OK;

mz_stream_buffered_print("Buffered - Seek (origin %"PRId32" offset %"PRId64" pos %"PRId64")\n",
mz_stream_buffered_print("Buffered - Seek (origin %" PRId32 " offset %" PRId64 " pos %" PRId64 ")\n",
origin, offset, buffered->position);

switch (origin)
Expand Down Expand Up @@ -358,7 +358,7 @@ int32_t mz_stream_buffered_close(void *stream)
int32_t bytes_flushed = 0;

mz_stream_buffered_flush(stream, &bytes_flushed);
mz_stream_buffered_print("Buffered - Close (flushed %"PRId32")\n", bytes_flushed);
mz_stream_buffered_print("Buffered - Close (flushed %" PRId32 ")\n", bytes_flushed);

if (buffered->readbuf_hits + buffered->readbuf_misses > 0)
{
Expand Down
10 changes: 5 additions & 5 deletions mz_strm_os_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int32_t mz_stream_os_open(void *stream, const char *path, int32_t mode)
return MZ_PARAM_ERROR;
}

mz_stream_os_print("Win32 - Open - %s (mode %"PRId32")\n", path);
mz_stream_os_print("Win32 - Open - %s (mode %" PRId32 ")\n", path);

path_wide = mz_os_unicode_string_create(path, MZ_ENCODING_UTF8);
if (path_wide == NULL)
Expand Down Expand Up @@ -161,7 +161,7 @@ int32_t mz_stream_os_read(void *stream, void *buf, int32_t size)
win32->error = 0;
}

mz_stream_os_print("Win32 - Read - %"PRId32"\n", read);
mz_stream_os_print("Win32 - Read - %" PRId32 "\n", read);

return read;
}
Expand All @@ -181,7 +181,7 @@ int32_t mz_stream_os_write(void *stream, const void *buf, int32_t size)
win32->error = 0;
}

mz_stream_os_print("Win32 - Write - %"PRId32"\n", written);
mz_stream_os_print("Win32 - Write - %" PRId32 "\n", written);

return written;
}
Expand Down Expand Up @@ -224,7 +224,7 @@ int64_t mz_stream_os_tell(void *stream)
if (mz_stream_os_seekinternal(win32->handle, large_pos, &large_pos, FILE_CURRENT) != MZ_OK)
win32->error = GetLastError();

mz_stream_os_print("Win32 - Tell - %"PRId64"\n", large_pos.QuadPart);
mz_stream_os_print("Win32 - Tell - %" PRId64 "\n", large_pos.QuadPart);

return large_pos.QuadPart;
}
Expand Down Expand Up @@ -255,7 +255,7 @@ int32_t mz_stream_os_seek(void *stream, int64_t offset, int32_t origin)
return MZ_SEEK_ERROR;
}

mz_stream_os_print("Win32 - Seek - %"PRId64" (origin %"PRId32")\n", offset, origin);
mz_stream_os_print("Win32 - Seek - %" PRId64 " (origin %" PRId32 ")\n", offset, origin);

large_pos.QuadPart = offset;

Expand Down
12 changes: 6 additions & 6 deletions mz_strm_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int32_t mz_stream_split_open_disk(void *stream, int32_t number_disk)
if (split->path_disk[i] != '.')
continue;
snprintf(&split->path_disk[i], split->path_disk_size - (uint32_t)i,
".z%02"PRId32, number_disk + 1);
".z%02" PRId32, number_disk + 1);
break;
}
}
Expand All @@ -109,7 +109,7 @@ static int32_t mz_stream_split_open_disk(void *stream, int32_t number_disk)
split->path_disk[split->path_disk_size - 1] = 0;
}

mz_stream_split_print("Split - Goto disk - %s (disk %"PRId32")\n", split->path_disk, number_disk);
mz_stream_split_print("Split - Goto disk - %s (disk %" PRId32 ")\n", split->path_disk, number_disk);

/* If disk part doesn't exist during reading then return MZ_EXIST_ERROR */
if (disk_part == MZ_OPEN_MODE_READ)
Expand Down Expand Up @@ -209,7 +209,7 @@ int32_t mz_stream_split_open(void *stream, const char *path, int32_t mode)
strncpy(split->path_cd, path, split->path_cd_size - 1);
split->path_cd[split->path_cd_size - 1] = 0;

mz_stream_split_print("Split - Open - %s (disk %"PRId32")\n", split->path_cd, number_disk);
mz_stream_split_print("Split - Open - %s (disk %" PRId32 ")\n", split->path_cd, number_disk);

split->path_disk_size = (uint32_t)strlen(path) + 10;
split->path_disk = (char *)MZ_ALLOC(split->path_disk_size);
Expand Down Expand Up @@ -261,7 +261,7 @@ int32_t mz_stream_split_read(void *stream, void *buf, int32_t size)
{
read = mz_stream_read(split->stream.base, buf_ptr, bytes_left);

mz_stream_split_print("Split - Read disk - %"PRId32"\n", read);
mz_stream_split_print("Split - Read disk - %" PRId32 "\n", read);

if (read < 0)
return read;
Expand Down Expand Up @@ -327,7 +327,7 @@ int32_t mz_stream_split_write(void *stream, const void *buf, int32_t size)
if (written != bytes_to_write)
return MZ_WRITE_ERROR;

mz_stream_split_print("Split - Write disk - %"PRId32"\n", written);
mz_stream_split_print("Split - Write disk - %" PRId32 "\n", written);

bytes_left -= written;
buf_ptr += written;
Expand Down Expand Up @@ -360,7 +360,7 @@ int32_t mz_stream_split_seek(void *stream, int64_t offset, int32_t origin)
if (err != MZ_OK)
return err;

mz_stream_split_print("Split - Seek disk - %"PRId64" (origin %"PRId32")\n", offset, origin);
mz_stream_split_print("Split - Seek disk - %" PRId64 " (origin %" PRId32 ")\n", offset, origin);

if ((origin == MZ_SEEK_CUR) && (split->number_disk != -1))
{
Expand Down
Loading

0 comments on commit fe33c3d

Please sign in to comment.