Commit bcd8e4f4 authored by Thomas Daede's avatar Thomas Daede Committed by Philipp Schafft
Browse files

Replace I64FORMAT with PRId64 for gettext compatibility.

Will not work with Visual Studio < 2010 due to using inttypes.h.

Closes: #1869
parent b318ad81
......@@ -17,6 +17,7 @@
#include <stdarg.h>
#include <getopt.h>
#include <math.h>
#include <inttypes.h>
#include <ogg/ogg.h>
#include <vorbis/codec.h>
......@@ -33,12 +34,6 @@
#define CHUNK 4500
#ifdef _WIN32
#define I64FORMAT "I64d"
#else
#define I64FORMAT "lld"
#endif
struct vorbis_release {
char *vendor_string;
char *desc;
......@@ -474,8 +469,8 @@ static void theora_process(stream_processor *stream, ogg_page *page)
if(inf->framenum_expected >= 0 &&
inf->framenum_expected != framenum)
{
warn(_("WARNING: Expected frame %" I64FORMAT
", got %" I64FORMAT "\n"),
warn(_("WARNING: Expected frame %" PRId64
", got %" PRId64 "\n"),
inf->framenum_expected, framenum);
}
inf->framenum_expected = framenum + 1;
......@@ -491,7 +486,7 @@ static void theora_process(stream_processor *stream, ogg_page *page)
if(gp > 0) {
if(gp < inf->lastgranulepos)
warn(_("WARNING: granulepos in stream %d decreases from %"
I64FORMAT " to %" I64FORMAT "\n"),
PRId64 " to %" PRId64 "\n"),
stream->num, inf->lastgranulepos, gp);
inf->lastgranulepos = gp;
}
......@@ -525,7 +520,7 @@ static void theora_end(stream_processor *stream)
bitrate = inf->bytes*8 / time / 1000.0;
info(_("Theora stream %d:\n"
"\tTotal data length: %" I64FORMAT " bytes\n"
"\tTotal data length: %" PRId64 " bytes\n"
"\tPlayback length: %ldm:%02ld.%03lds\n"
"\tAverage bitrate: %f kb/s\n"),
stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
......@@ -626,7 +621,7 @@ static void vorbis_process(stream_processor *stream, ogg_page *page )
if(gp > 0) {
if(gp < inf->lastgranulepos)
warn(_("WARNING: granulepos in stream %d decreases from %"
I64FORMAT " to %" I64FORMAT "\n" ),
PRId64 " to %" PRId64 "\n" ),
stream->num, inf->lastgranulepos, gp);
inf->lastgranulepos = gp;
}
......@@ -634,7 +629,7 @@ static void vorbis_process(stream_processor *stream, ogg_page *page )
/* Only do this if we saw at least one packet ending on this page.
* It's legal (though very unusual) to have no packets in a page at
* all - this is occasionally used to have an empty EOS page */
warn(_("Negative or zero granulepos (%" I64FORMAT ") on Vorbis stream outside of headers. This file was created by a buggy encoder\n"), gp);
warn(_("Negative or zero granulepos (%" PRId64 ") on Vorbis stream outside of headers. This file was created by a buggy encoder\n"), gp);
}
if(inf->firstgranulepos < 0) { /* Not set yet */
}
......@@ -656,7 +651,7 @@ static void vorbis_end(stream_processor *stream)
bitrate = inf->bytes*8 / time / 1000.0;
info(_("Vorbis stream %d:\n"
"\tTotal data length: %" I64FORMAT " bytes\n"
"\tTotal data length: %" PRId64 " bytes\n"
"\tPlayback length: %ldm:%02ld.%03lds\n"
"\tAverage bitrate: %f kb/s\n"),
stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
......@@ -824,7 +819,7 @@ static void kate_process(stream_processor *stream, ogg_page *page )
if(gp > 0) {
if(gp < inf->lastgranulepos)
warn(_("WARNING: granulepos in stream %d decreases from %"
I64FORMAT " to %" I64FORMAT "\n" ),
PRId64 " to %" PRId64 "\n" ),
stream->num, inf->lastgranulepos, gp);
inf->lastgranulepos = gp;
}
......@@ -832,7 +827,7 @@ static void kate_process(stream_processor *stream, ogg_page *page )
/* Only do this if we saw at least one packet ending on this page.
* It's legal (though very unusual) to have no packets in a page at
* all - this is occasionally used to have an empty EOS page */
warn(_("Negative granulepos (%" I64FORMAT ") on Kate stream outside of headers. This file was created by a buggy encoder\n"), gp);
warn(_("Negative granulepos (%" PRId64 ") on Kate stream outside of headers. This file was created by a buggy encoder\n"), gp);
}
if(inf->firstgranulepos < 0) { /* Not set yet */
}
......@@ -858,7 +853,7 @@ static void kate_end(stream_processor *stream)
bitrate = inf->bytes*8 / time / 1000.0;
info(_("Kate stream %d:\n"
"\tTotal data length: %" I64FORMAT " bytes\n"
"\tTotal data length: %" PRId64 " bytes\n"
"\tPlayback length: %ldm:%02ld.%03lds\n"
"\tAverage bitrate: %f kb/s\n"),
stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
......@@ -1111,7 +1106,7 @@ static int get_next_page(FILE *f, ogg_sync_state *sync, ogg_page *page,
while((ret = ogg_sync_pageseek(sync, page)) <= 0) {
if(ret < 0) {
/* unsynced, we jump over bytes to a possible capture - we don't need to read more just yet */
warn(_("WARNING: Hole in data (%d bytes) found at approximate offset %" I64FORMAT " bytes. Corrupted Ogg.\n"), -ret, *written);
warn(_("WARNING: Hole in data (%d bytes) found at approximate offset %" PRId64 " bytes. Corrupted Ogg.\n"), -ret, *written);
continue;
}
......
......@@ -34,25 +34,7 @@
#include <locale.h>
#include "i18n.h"
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#define FORMAT_INT64 "%" PRId64
#define FORMAT_INT64_TIME "+%" PRId64
#else
#ifdef _WIN32
#define FORMAT_INT64 "%I64d"
#define FORMAT_INT64_TIME "+%I64d"
#else
#if LONG_MAX!=2147483647L
#define FORMAT_INT64 "%ld"
#define FORMAT_INT64_TIME "+%ld"
#else
#define FORMAT_INT64 "%lld"
#define FORMAT_INT64_TIME "+%lld"
#endif
#endif
#endif
static void clear_packet(vcut_packet *p)
{
......@@ -296,7 +278,7 @@ int main(int argc, char **argv)
fprintf(stderr, _("Couldn't parse cutpoint \"%s\"\n"), argv[4]);
exit(1);
}
} else if(sscanf(argv[4], FORMAT_INT64, &seg->cutpoint) != 1) {
} else if(sscanf(argv[4], "%" PRId64, &seg->cutpoint) != 1) {
fprintf(stderr, _("Couldn't parse cutpoint \"%s\"\n"), argv[4]);
exit(1);
}
......@@ -357,7 +339,7 @@ int process_audio_packet(vcut_state *s,
&& vs->granulepos > 0 && !packet->e_o_s)
{
fprintf(stderr, _("WARNING: unexpected granulepos "
FORMAT_INT64 " (expected " FORMAT_INT64 ")\n"),
"%" PRId64 " (expected " "%" PRId64 ")\n"),
packet->granulepos, (vs->granulepos + bs));
}
vs->granulepos = packet->granulepos;
......@@ -414,8 +396,8 @@ int process_audio_packet(vcut_state *s,
if(rel_sample < bs && !s->drop_output)
{
fprintf(stderr, _("Can't produce a file starting"
" and ending between sample positions " FORMAT_INT64
" and " FORMAT_INT64 "\n"),
" and ending between sample positions " "%" PRId64
" and " "%" PRId64 "\n"),
packet_start_granpos + gp_to_global_sample_adj - 1,
vs->granulepos + gp_to_global_sample_adj);
return -1;
......@@ -458,7 +440,7 @@ int process_audio_packet(vcut_state *s,
&& strcmp(s->output_filename, ".") != 0)
{
fprintf(stderr, _("Can't produce a file starting between sample"
" positions " FORMAT_INT64 " and " FORMAT_INT64 ".\n"),
" positions " "%" PRId64 " and " "%" PRId64 ".\n"),
packet_start_granpos + gp_to_global_sample_adj - 1,
vs->granulepos + gp_to_global_sample_adj);
fprintf(stderr, _("Specify \".\" as the second output file"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment