Commit d68a14c0 authored by Josh Coalson's avatar Josh Coalson
Browse files

_snprintf hackery for MSVC6

parent 59717c20
......@@ -25,6 +25,7 @@
#include "FLAC/metadata.h"
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -282,7 +283,11 @@ FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__
FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
FLAC__ASSERT(strlen(CHANNEL_MASK_TAG+1+2+16+1) <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */
entry.entry = (FLAC__byte*)tag;
#if defined _MSC_VER || defined __MINGW32__
if((entry.length = _snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag))
#else
if((entry.length = snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag))
#endif
return false;
if(!FLAC__metadata_object_vorbiscomment_replace_comment(object, entry, /*all=*/true, /*copy=*/true))
return false;
......
......@@ -199,7 +199,7 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe
return false;
}
#ifdef _MSC_VER
#if defined _MSC_VER || defined __MINGW32__
_snprintf(ref, reflen, "\"%s\" FLAC", filename);
#else
snprintf(ref, reflen, "\"%s\" FLAC", filename);
......
......@@ -69,7 +69,11 @@ static FLAC__bool test_one_picture(const char *prefix, const PictureFile *pf, co
FLAC__StreamMetadata *obj;
const char *error;
char s[4096];
#if defined _MSC_VER || defined __MINGW32__
_snprintf(s, sizeof(s)-1, "%u|%s|%s|%s|%s/%s", (unsigned)pf->type, pf->mime_type, pf->description, res, prefix, pf->path);
#else
snprintf(s, sizeof(s)-1, "%u|%s|%s|%s|%s/%s", (unsigned)pf->type, pf->mime_type, pf->description, res, prefix, pf->path);
#endif
printf("testing grabbag__picture_parse_specification(\"%s\")... ", s);
if(0 == (obj = grabbag__picture_parse_specification(s, &error)))
......
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