mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Remove local_strtoull, windows has equivalent function _strtoui64
This commit is contained in:
committed by
Erik de Castro Lopo
parent
9b7cb22f84
commit
7e62afe9fa
@@ -59,3 +59,11 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define strtoll _strtoi64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define restrict __restrict
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "FLAC/all.h"
|
#include "FLAC/all.h"
|
||||||
#include "share/alloc.h"
|
#include "share/alloc.h"
|
||||||
#include "share/grabbag.h"
|
#include "share/grabbag.h"
|
||||||
|
#include "share/compat.h"
|
||||||
#include "analyze.h"
|
#include "analyze.h"
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
#include "encode.h"
|
#include "encode.h"
|
||||||
@@ -84,11 +85,6 @@ static const char *get_outfilename(const char *infilename, const char *suffix);
|
|||||||
static void die(const char *message);
|
static void die(const char *message);
|
||||||
static int conditional_fclose(FILE *f);
|
static int conditional_fclose(FILE *f);
|
||||||
static char *local_strdup(const char *source);
|
static char *local_strdup(const char *source);
|
||||||
#ifdef _MSC_VER
|
|
||||||
/* There's no strtoll() in MSVC6 so we just write a specialized one */
|
|
||||||
static FLAC__int64 local__strtoll(const char *src, char **endptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* share__getopt format struct; note that for long options with no
|
* share__getopt format struct; note that for long options with no
|
||||||
@@ -683,13 +679,8 @@ int parse_option(int short_option, const char *long_option, const char *option_a
|
|||||||
FLAC__ASSERT(0 != option_argument);
|
FLAC__ASSERT(0 != option_argument);
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
#ifdef _MSC_VER
|
|
||||||
FLAC__int64 i;
|
FLAC__int64 i;
|
||||||
i = local__strtoll(option_argument, &end);
|
|
||||||
#else
|
|
||||||
long long i;
|
|
||||||
i = strtoll(option_argument, &end, 10);
|
i = strtoll(option_argument, &end, 10);
|
||||||
#endif
|
|
||||||
if(0 == strlen(option_argument) || *end)
|
if(0 == strlen(option_argument) || *end)
|
||||||
return usage_error("ERROR: --%s must be a number\n", long_option);
|
return usage_error("ERROR: --%s must be a number\n", long_option);
|
||||||
option_values.format_input_size = (off_t)i;
|
option_values.format_input_size = (off_t)i;
|
||||||
@@ -2222,29 +2213,3 @@ char *local_strdup(const char *source)
|
|||||||
die("out of memory during strdup()");
|
die("out of memory during strdup()");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
/* There's no strtoll() in MSVC6 so we just write a specialized one */
|
|
||||||
FLAC__int64 local__strtoll(const char *src, char **endptr)
|
|
||||||
{
|
|
||||||
FLAC__bool neg = false;
|
|
||||||
FLAC__int64 ret = 0;
|
|
||||||
int c;
|
|
||||||
FLAC__ASSERT(0 != src);
|
|
||||||
if(*src == '-') {
|
|
||||||
neg = true;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
while(0 != (c = *src)) {
|
|
||||||
c -= '0';
|
|
||||||
if(c >= 0 && c <= 9)
|
|
||||||
ret = (ret * 10) + c;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
if(endptr)
|
|
||||||
*endptr = (char*)src;
|
|
||||||
return neg? -ret : ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -21,36 +21,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "share/grabbag.h"
|
#include "share/grabbag.h"
|
||||||
|
#include "share/compat.h"
|
||||||
#include "FLAC/assert.h"
|
#include "FLAC/assert.h"
|
||||||
#include <stdlib.h> /* for atoi() */
|
#include <stdlib.h> /* for atoi() */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
/* There's no strtoll() in MSVC6 so we just write a specialized one */
|
|
||||||
static FLAC__int64 local__strtoll(const char *src, char **endptr)
|
|
||||||
{
|
|
||||||
FLAC__bool neg = false;
|
|
||||||
FLAC__int64 ret = 0;
|
|
||||||
int c;
|
|
||||||
FLAC__ASSERT(0 != src);
|
|
||||||
if(*src == '-') {
|
|
||||||
neg = true;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
while(0 != (c = *src)) {
|
|
||||||
c -= '0';
|
|
||||||
if(c >= 0 && c <= 9)
|
|
||||||
ret = (ret * 10) + c;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
if(endptr)
|
|
||||||
*endptr = (char*)src;
|
|
||||||
return neg? -ret : ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points)
|
FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@@ -107,11 +82,7 @@ FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec
|
|||||||
*spec_has_real_points = true;
|
*spec_has_real_points = true;
|
||||||
if(!only_explicit_placeholders) {
|
if(!only_explicit_placeholders) {
|
||||||
char *endptr;
|
char *endptr;
|
||||||
#ifdef _MSC_VER
|
|
||||||
const FLAC__int64 n = local__strtoll(pt, &endptr);
|
|
||||||
#else
|
|
||||||
const FLAC__int64 n = (FLAC__int64)strtoll(pt, &endptr, 10);
|
const FLAC__int64 n = (FLAC__int64)strtoll(pt, &endptr, 10);
|
||||||
#endif
|
|
||||||
if(
|
if(
|
||||||
(n > 0 || (endptr > pt && *endptr == ';')) && /* is a valid number (extra check needed for "0") */
|
(n > 0 || (endptr > pt && *endptr == ';')) && /* is a valid number (extra check needed for "0") */
|
||||||
(total_samples_to_encode == 0 || (FLAC__uint64)n < total_samples_to_encode) /* number is not >= the known total_samples_to_encode */
|
(total_samples_to_encode == 0 || (FLAC__uint64)n < total_samples_to_encode) /* number is not >= the known total_samples_to_encode */
|
||||||
|
|||||||
Reference in New Issue
Block a user