Avoid preprocessor error in SIZE_MAX (GH #864)

pull/867/head
Jeffrey Walton 2019-07-14 00:52:30 -04:00
parent 6ae9c055cc
commit e8b07b162f
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,6 @@
#ifndef CRYPTOPP_IMPORTS
#include "cryptlib.h"
#include "misc.h"
#include "filters.h"
#include "algparam.h"
#include "fips140.h"
@ -26,9 +25,11 @@
#include "secblock.h"
#include "smartptr.h"
#include "stdcpp.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
CRYPTOPP_COMPILE_ASSERT(SIZE_MAX > 0);
CRYPTOPP_COMPILE_ASSERT(sizeof(byte) == 1);
CRYPTOPP_COMPILE_ASSERT(sizeof(word16) == 2);
CRYPTOPP_COMPILE_ASSERT(sizeof(word32) == 4);

4
misc.h
View File

@ -117,9 +117,9 @@
// http://stackoverflow.com/questions/30472731/which-c-standard-header-defines-size-max
// Avoid NOMINMAX macro on Windows. http://support.microsoft.com/en-us/kb/143208
#ifndef SIZE_MAX
# if defined(__SIZE_MAX__) && (__SIZE_MAX__ > 0)
# if defined(__SIZE_MAX__)
# define SIZE_MAX __SIZE_MAX__
# elif defined(SIZE_T_MAX) && (SIZE_T_MAX > 0)
# elif defined(SIZE_T_MAX)
# define SIZE_MAX SIZE_T_MAX
# elif defined(__SIZE_TYPE__)
# define SIZE_MAX (~(__SIZE_TYPE__)0)