X-Git-Url: http://andersk.mit.edu/gitweb/libyaml.git/blobdiff_plain/fc2dd942fc61ae135b7e2bfe5c248b1f15b74547..c45550e5cf265bf6877cad127faa9854851e291e:/src/yaml_private.h diff --git a/src/yaml_private.h b/src/yaml_private.h index fe25141..eb72207 100644 --- a/src/yaml_private.h +++ b/src/yaml_private.h @@ -8,28 +8,6 @@ #include #include -#ifndef _MSC_VER -#if defined(__sun) || defined(__sun__) -#include -#define PTRDIFF_MAX INT_MAX -#else -#include -#ifndef PTRDIFF_MAX /* gcc on HP-UX */ -#ifdef _LP64 -#define PTRDIFF_MAX 0x7FFFFFFFFFFFFFFFLL -#else -#define PTRDIFF_MAX 0x7FFFFFFFL -#endif -#endif -#endif -#else -#ifdef _WIN64 -#define PTRDIFF_MAX _I64_MAX -#else -#define PTRDIFF_MAX INT_MAX -#endif -#endif - /* * Memory management. */ @@ -88,6 +66,17 @@ yaml_parser_fetch_more_tokens(yaml_parser_t *parser); #define OUTPUT_RAW_BUFFER_SIZE (OUTPUT_BUFFER_SIZE*2+2) +/* + * The maximum size of a YAML input file. + * This used to be PTRDIFF_MAX, but that's not entirely portable + * because stdint.h isn't available on all platforms. + * It is not entirely clear why this isn't the maximum value + * that can fit into the parser->offset field. + */ + +#define MAX_FILE_SIZE (~(size_t)0 / 2) + + /* * The size of other stacks and queues. */