1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-05 23:44:00 +03:00

All macros should be enclosed by ()

This commit is contained in:
bel
2015-05-17 12:58:39 +02:00
parent 6ce8b4e92c
commit 9b4095f54d
4 changed files with 103 additions and 104 deletions

View File

@@ -74,7 +74,7 @@
#endif /* __SYMBIAN32__ */ #endif /* __SYMBIAN32__ */
#ifndef IGNORE_UNUSED_RESULT #ifndef IGNORE_UNUSED_RESULT
#define IGNORE_UNUSED_RESULT(a) (void)((a) && 1) #define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1))
#endif #endif
#ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */ #ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */
@@ -96,7 +96,7 @@
#include <mach/mach_time.h> #include <mach/mach_time.h>
#include <assert.h> #include <assert.h>
// clock_gettime is not implemented on OSX /* clock_gettime is not implemented on OSX */
int clock_gettime(int clk_id, struct timespec *t) { int clock_gettime(int clk_id, struct timespec *t) {
if (clk_id == CLOCK_REALTIME) { if (clk_id == CLOCK_REALTIME) {
struct timeval now; struct timeval now;
@@ -118,8 +118,8 @@ int clock_gettime(int clk_id, struct timespec *t) {
#if defined(DEBUG) #if defined(DEBUG)
assert(mach_status == KERN_SUCCESS); assert(mach_status == KERN_SUCCESS);
#else #else
(void)mach_status; // appease "unused variable" warning for release /* appease "unused variable" warning for release builds */
// builds (void)mach_status;
#endif #endif
start_time = now; start_time = now;
} }
@@ -157,7 +157,7 @@ int clock_gettime(int clk_id, struct timespec *t) {
typedef const char *SOCK_OPT_TYPE; typedef const char *SOCK_OPT_TYPE;
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX MAX_PATH #define PATH_MAX (MAX_PATH)
#endif #endif
#ifndef _IN_PORT_T #ifndef _IN_PORT_T
@@ -175,37 +175,37 @@ typedef const char *SOCK_OPT_TYPE;
typedef long off_t; typedef long off_t;
#define errno GetLastError() #define errno (GetLastError())
#define strerror(x) _ultoa(x, (char *)_alloca(sizeof(x) * 3), 10) #define strerror(x) (_ultoa(x, (char *)_alloca(sizeof(x) * 3), 10))
#endif /* _WIN32_WCE */ #endif /* _WIN32_WCE */
#define MAKEUQUAD(lo, hi) \ #define MAKEUQUAD(lo, hi) \
((uint64_t)(((uint32_t)(lo)) | ((uint64_t)((uint32_t)(hi))) << 32)) ((uint64_t)(((uint32_t)(lo)) | ((uint64_t)((uint32_t)(hi))) << 32))
#define RATE_DIFF 10000000 /* 100 nsecs */ #define RATE_DIFF (10000000) /* 100 nsecs */
#define EPOCH_DIFF MAKEUQUAD(0xd53e8000, 0x019db1de) #define EPOCH_DIFF (MAKEUQUAD(0xd53e8000, 0x019db1de))
#define SYS2UNIX_TIME(lo, hi) \ #define SYS2UNIX_TIME(lo, hi) \
(time_t)((MAKEUQUAD((lo), (hi)) - EPOCH_DIFF) / RATE_DIFF) ((time_t)((MAKEUQUAD((lo), (hi)) - EPOCH_DIFF) / RATE_DIFF))
/* Visual Studio 6 does not know __func__ or __FUNCTION__ /* Visual Studio 6 does not know __func__ or __FUNCTION__
The rest of MS compilers use __FUNCTION__, not C99 __func__ * The rest of MS compilers use __FUNCTION__, not C99 __func__
Also use _strtoui64 on modern M$ compilers */ * Also use _strtoui64 on modern M$ compilers */
#if defined(_MSC_VER) && _MSC_VER < 1300 #if defined(_MSC_VER) && _MSC_VER < 1300
#define STRX(x) #x #define STRX(x) #x
#define STR(x) STRX(x) #define STR(x) STRX(x)
#define __func__ __FILE__ ":" STR(__LINE__) #define __func__ __FILE__ ":" STR(__LINE__)
#define strtoull(x, y, z) (unsigned __int64) _atoi64(x) #define strtoull(x, y, z) ((unsigned __int64)_atoi64(x))
#define strtoll(x, y, z) _atoi64(x) #define strtoll(x, y, z) (_atoi64(x))
#else #else
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
#define strtoull(x, y, z) _strtoui64(x, y, z) #define strtoull(x, y, z) (_strtoui64(x, y, z))
#define strtoll(x, y, z) _strtoi64(x, y, z) #define strtoll(x, y, z) (_strtoi64(x, y, z))
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#define ERRNO GetLastError() #define ERRNO (GetLastError())
#define NO_SOCKLEN_T #define NO_SOCKLEN_T
#define SSL_LIB "ssleay32.dll" #define SSL_LIB "ssleay32.dll"
#define CRYPTO_LIB "libeay32.dll" #define CRYPTO_LIB "libeay32.dll"
#define O_NONBLOCK 0 #define O_NONBLOCK (0)
#ifndef W_OK #ifndef W_OK
#define W_OK (2) /* http://msdn.microsoft.com/en-us/library/1w06ktdy.aspx */ #define W_OK (2) /* http://msdn.microsoft.com/en-us/library/1w06ktdy.aspx */
#endif #endif
@@ -216,39 +216,39 @@ typedef long off_t;
#define INT64_FMT "I64d" #define INT64_FMT "I64d"
#define WINCDECL __cdecl #define WINCDECL __cdecl
#define SHUT_RD 0 #define SHUT_RD (0)
#define SHUT_WR 1 #define SHUT_WR (1)
#define SHUT_BOTH 2 #define SHUT_BOTH (2)
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define access _access #define access _access
#define mg_sleep(x) Sleep(x) #define mg_sleep(x) (Sleep(x))
#define pipe(x) _pipe(x, MG_BUF_LEN, _O_BINARY) #define pipe(x) _pipe(x, MG_BUF_LEN, _O_BINARY)
#ifndef popen #ifndef popen
#define popen(x, y) _popen(x, y) #define popen(x, y) (_popen(x, y))
#endif #endif
#ifndef pclose #ifndef pclose
#define pclose(x) _pclose(x) #define pclose(x) (_pclose(x))
#endif #endif
#define close(x) _close(x) #define close(x) (_close(x))
#define dlsym(x, y) GetProcAddress((HINSTANCE)(x), (y)) #define dlsym(x, y) (GetProcAddress((HINSTANCE)(x), (y)))
#define RTLD_LAZY 0 #define RTLD_LAZY (0)
#define fseeko(x, y, z) _lseeki64(_fileno(x), (y), (z)) #define fseeko(x, y, z) (_lseeki64(_fileno(x), (y), (z)))
#define fdopen(x, y) _fdopen((x), (y)) #define fdopen(x, y) (_fdopen((x), (y)))
#define write(x, y, z) _write((x), (y), (unsigned)z) #define write(x, y, z) (_write((x), (y), (unsigned)z))
#define read(x, y, z) _read((x), (y), (unsigned)z) #define read(x, y, z) (_read((x), (y), (unsigned)z))
#define flockfile(x) EnterCriticalSection(&global_log_file_lock) #define flockfile(x) (EnterCriticalSection(&global_log_file_lock))
#define funlockfile(x) LeaveCriticalSection(&global_log_file_lock) #define funlockfile(x) (LeaveCriticalSection(&global_log_file_lock))
#define sleep(x) Sleep((x)*1000) #define sleep(x) (Sleep((x)*1000))
#define rmdir(x) _rmdir(x) #define rmdir(x) (_rmdir(x))
#if defined(USE_LUA) && defined(USE_WEBSOCKET) #if defined(USE_LUA) && defined(USE_WEBSOCKET)
#define USE_TIMERS #define USE_TIMERS
#endif #endif
#if !defined(fileno) #if !defined(fileno)
#define fileno(x) _fileno(x) #define fileno(x) (_fileno(x))
#endif /* !fileno MINGW #defines fileno */ #endif /* !fileno MINGW #defines fileno */
typedef HANDLE pthread_mutex_t; typedef HANDLE pthread_mutex_t;
@@ -292,7 +292,7 @@ typedef unsigned int uint32_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
typedef __int64 int64_t; typedef __int64 int64_t;
#define INT64_MAX 9223372036854775807 #define INT64_MAX (9223372036854775807)
#endif /* HAVE_STDINT */ #endif /* HAVE_STDINT */
/* POSIX dirent interface */ /* POSIX dirent interface */
@@ -313,7 +313,7 @@ struct pollfd {
short events; short events;
short revents; short revents;
}; };
#define POLLIN 0x0300 #define POLLIN (0x0300)
#endif #endif
#endif #endif
@@ -359,13 +359,13 @@ typedef unsigned short int in_port_t;
#endif #endif
#endif #endif
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY (0)
#endif /* O_BINARY */ #endif /* O_BINARY */
#define closesocket(a) close(a) #define closesocket(a) (close(a))
#define mg_mkdir(x, y) mkdir(x, y) #define mg_mkdir(x, y) (mkdir(x, y))
#define mg_remove(x) remove(x) #define mg_remove(x) (remove(x))
#define mg_sleep(x) usleep((x)*1000) #define mg_sleep(x) (usleep((x)*1000))
#define ERRNO errno #define ERRNO (errno)
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
#define INT64_FMT PRId64 #define INT64_FMT PRId64
typedef int SOCKET; typedef int SOCKET;
@@ -392,7 +392,7 @@ typedef int SOCKET;
/* va_copy should always be a macro, C99 and C++11 - DTL */ /* va_copy should always be a macro, C99 and C++11 - DTL */
#ifndef va_copy #ifndef va_copy
#define va_copy(x, y) x = y #define va_copy(x, y) ((x) = (y))
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@@ -423,11 +423,11 @@ void *pthread_getspecific(pthread_key_t key) { return TlsGetValue(key); }
#include "civetweb.h" #include "civetweb.h"
#define PASSWORDS_FILE_NAME ".htpasswd" #define PASSWORDS_FILE_NAME ".htpasswd"
#define CGI_ENVIRONMENT_SIZE 4096 #define CGI_ENVIRONMENT_SIZE (4096)
#define MAX_CGI_ENVIR_VARS 64 #define MAX_CGI_ENVIR_VARS (64)
#define MG_BUF_LEN 8192 #define MG_BUF_LEN (8192)
#ifndef MAX_REQUEST_SIZE #ifndef MAX_REQUEST_SIZE
#define MAX_REQUEST_SIZE 16384 #define MAX_REQUEST_SIZE (16384)
#endif #endif
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
@@ -617,23 +617,23 @@ typedef int socklen_t;
#endif /* NO_SOCKLEN_T */ #endif /* NO_SOCKLEN_T */
#define _DARWIN_UNLIMITED_SELECT #define _DARWIN_UNLIMITED_SELECT
#define IP_ADDR_STR_LEN 50 /* IPv6 hex string is 46 chars */ #define IP_ADDR_STR_LEN (50) /* IPv6 hex string is 46 chars */
#if !defined(MSG_NOSIGNAL) #if !defined(MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0 #define MSG_NOSIGNAL (0)
#endif #endif
#if !defined(SOMAXCONN) #if !defined(SOMAXCONN)
#define SOMAXCONN 100 #define SOMAXCONN (100)
#endif #endif
#if !defined(PATH_MAX) #if !defined(PATH_MAX)
#define PATH_MAX 4096 #define PATH_MAX (4096)
#endif #endif
/* Size of the accepted socket queue */ /* Size of the accepted socket queue */
#if !defined(MGSQLEN) #if !defined(MGSQLEN)
#define MGSQLEN 20 #define MGSQLEN (20)
#endif #endif
#if defined(NO_SSL_DL) #if defined(NO_SSL_DL)
@@ -2388,7 +2388,7 @@ static int dlclose(void *handle) {
} }
#if !defined(NO_CGI) #if !defined(NO_CGI)
#define SIGKILL 0 #define SIGKILL (0)
static int kill(pid_t pid, int sig_num) { static int kill(pid_t pid, int sig_num) {
(void)TerminateProcess(pid, sig_num); (void)TerminateProcess(pid, sig_num);
(void)CloseHandle(pid); (void)CloseHandle(pid);
@@ -8856,16 +8856,12 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
/* Check if the config_options and the corresponding enum have compatible /* Check if the config_options and the corresponding enum have compatible
* sizes. */ * sizes. */
/* Could use static_assert, once it is verified that all compilers support static_assert(sizeof(config_options) / sizeof(config_options[0]) ==
* this. */ NUM_OPTIONS + 1,
/* assert(sizeof(config_options)/sizeof(config_options[0]) == "config_options and enum not sync");
* NUM_OPTIONS+1);
*/
if (sizeof(config_options) / sizeof(config_options[0]) != NUM_OPTIONS + 1)
return NULL;
/* Allocate context and initialize reasonable general case defaults. /* Allocate context and initialize reasonable general case defaults.
TODO(lsm): do proper error handling here. */ * TODO(lsm): do proper error handling here. */
if ((ctx = (struct mg_context *)mg_calloc(1, sizeof(*ctx))) == NULL) { if ((ctx = (struct mg_context *)mg_calloc(1, sizeof(*ctx))) == NULL) {
return NULL; return NULL;
} }
@@ -8873,8 +8869,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
if (mg_atomic_inc(&sTlsInit) == 1) { if (mg_atomic_inc(&sTlsInit) == 1) {
if (0 != pthread_key_create(&sTlsKey, NULL)) { if (0 != pthread_key_create(&sTlsKey, NULL)) {
/* Fatal error - abort start. However, this situation should never /* Fatal error - abort start. However, this situation should never
* occur * occur in practice. */
* in practice. */
mg_atomic_dec(&sTlsInit); mg_atomic_dec(&sTlsInit);
mg_cry(fc(ctx), "Cannot initialize thread local storage"); mg_cry(fc(ctx), "Cannot initialize thread local storage");
mg_free(ctx); mg_free(ctx);

View File

@@ -32,7 +32,7 @@
#endif #endif
#ifndef IGNORE_UNUSED_RESULT #ifndef IGNORE_UNUSED_RESULT
#define IGNORE_UNUSED_RESULT(a) (void)((a) && 1) #define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1))
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
@@ -59,7 +59,7 @@
#include <shlobj.h> #include <shlobj.h>
#include <io.h> #include <io.h>
#define getcwd(a, b) _getcwd(a, b) #define getcwd(a, b) (_getcwd(a, b))
#if !defined(__MINGW32__) #if !defined(__MINGW32__)
extern char *_getcwd(char *buf, size_t size); extern char *_getcwd(char *buf, size_t size);
#endif #endif
@@ -81,18 +81,18 @@ static int guard = 0; /* test if any dialog is already open */
#define DIRSEP '\\' #define DIRSEP '\\'
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define sleep(x) Sleep((x)*1000) #define sleep(x) (Sleep((x)*1000))
#define WINCDECL __cdecl #define WINCDECL __cdecl
#define abs_path(rel, abs, abs_size) _fullpath((abs), (rel), (abs_size)) #define abs_path(rel, abs, abs_size) (_fullpath((abs), (rel), (abs_size)))
#else #else
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#define DIRSEP '/' #define DIRSEP '/'
#define WINCDECL #define WINCDECL
#define abs_path(rel, abs, abs_size) realpath((rel), (abs)) #define abs_path(rel, abs, abs_size) (realpath((rel), (abs)))
#endif /* _WIN32 */ #endif /* _WIN32 */
#define MAX_OPTIONS 50 #define MAX_OPTIONS (50)
#define MAX_CONF_FILE_LINE_SIZE (8 * 1024) #define MAX_CONF_FILE_LINE_SIZE (8 * 1024)
struct tuser_data { struct tuser_data {
@@ -1075,9 +1075,9 @@ static void add_control(unsigned char **mem, DLGTEMPLATE *dia, WORD type,
static int get_password(const char *user, const char *realm, char *passwd, static int get_password(const char *user, const char *realm, char *passwd,
unsigned passwd_len) { unsigned passwd_len) {
#define HEIGHT 15 #define HEIGHT (15)
#define WIDTH 280 #define WIDTH (280)
#define LABEL_WIDTH 90 #define LABEL_WIDTH (90)
unsigned char mem[4096], *p; unsigned char mem[4096], *p;
DLGTEMPLATE *dia = (DLGTEMPLATE *)mem; DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
@@ -1259,9 +1259,9 @@ static void add_control(unsigned char **mem, DLGTEMPLATE *dia, WORD type,
} }
static void show_settings_dialog() { static void show_settings_dialog() {
#define HEIGHT 15 #define HEIGHT (15)
#define WIDTH 460 #define WIDTH (460)
#define LABEL_WIDTH 90 #define LABEL_WIDTH (90)
unsigned char mem[4096], *p; unsigned char mem[4096], *p;
const struct mg_option *options; const struct mg_option *options;
@@ -1359,9 +1359,9 @@ static void show_settings_dialog() {
} }
static void change_password_file() { static void change_password_file() {
#define HEIGHT 15 #define HEIGHT (15)
#define WIDTH 320 #define WIDTH (320)
#define LABEL_WIDTH 90 #define LABEL_WIDTH (90)
OPENFILENAME of; OPENFILENAME of;
char path[PATH_MAX] = PASSWORDS_FILE_NAME; char path[PATH_MAX] = PASSWORDS_FILE_NAME;

View File

@@ -138,73 +138,73 @@ MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
#ifdef ARCH_IS_BIG_ENDIAN #ifdef ARCH_IS_BIG_ENDIAN
#define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) #define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
#else #else
#define BYTE_ORDER 0 #define BYTE_ORDER (0)
#endif #endif
#define T_MASK ((md5_word_t)~0) #define T_MASK ((md5_word_t)~0)
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
#define T3 0x242070db #define T3 (0x242070db)
#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
#define T6 0x4787c62a #define T6 (0x4787c62a)
#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
#define T9 0x698098d8 #define T9 (0x698098d8)
#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
#define T13 0x6b901122 #define T13 (0x6b901122)
#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
#define T16 0x49b40821 #define T16 (0x49b40821)
#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
#define T19 0x265e5a51 #define T19 (0x265e5a51)
#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
#define T22 0x02441453 #define T22 (0x02441453)
#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
#define T25 0x21e1cde6 #define T25 (0x21e1cde6)
#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
#define T28 0x455a14ed #define T28 (0x455a14ed)
#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
#define T31 0x676f02d9 #define T31 (0x676f02d9)
#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
#define T35 0x6d9d6122 #define T35 (0x6d9d6122)
#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
#define T38 0x4bdecfa9 #define T38 (0x4bdecfa9)
#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
#define T41 0x289b7ec6 #define T41 (0x289b7ec6)
#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
#define T44 0x04881d05 #define T44 (0x04881d05)
#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
#define T47 0x1fa27cf8 #define T47 (0x1fa27cf8)
#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
#define T50 0x432aff97 #define T50 (0x432aff97)
#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
#define T53 0x655b59c3 #define T53 (0x655b59c3)
#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
#define T57 0x6fa87e4f #define T57 (0x6fa87e4f)
#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
#define T60 0x4e0811a1 #define T60 (0x4e0811a1)
#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
#define T63 0x2ad7d2bb #define T63 (0x2ad7d2bb)
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
@@ -283,6 +283,7 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
#define SET(a, b, c, d, k, s, Ti) \ #define SET(a, b, c, d, k, s, Ti) \
t = a + F(b, c, d) + X[k] + Ti; \ t = a + F(b, c, d) + X[k] + Ti; \
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 0, 7, T1); SET(a, b, c, d, 0, 7, T1);
SET(d, a, b, c, 1, 12, T2); SET(d, a, b, c, 1, 12, T2);
@@ -309,6 +310,7 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
#define SET(a, b, c, d, k, s, Ti) \ #define SET(a, b, c, d, k, s, Ti) \
t = a + G(b, c, d) + X[k] + Ti; \ t = a + G(b, c, d) + X[k] + Ti; \
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 1, 5, T17); SET(a, b, c, d, 1, 5, T17);
SET(d, a, b, c, 6, 9, T18); SET(d, a, b, c, 6, 9, T18);
@@ -335,6 +337,7 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
#define SET(a, b, c, d, k, s, Ti) \ #define SET(a, b, c, d, k, s, Ti) \
t = a + H(b, c, d) + X[k] + Ti; \ t = a + H(b, c, d) + X[k] + Ti; \
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 5, 4, T33); SET(a, b, c, d, 5, 4, T33);
SET(d, a, b, c, 8, 11, T34); SET(d, a, b, c, 8, 11, T34);
@@ -361,6 +364,7 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
#define SET(a, b, c, d, k, s, Ti) \ #define SET(a, b, c, d, k, s, Ti) \
t = a + I(b, c, d) + X[k] + Ti; \ t = a + I(b, c, d) + X[k] + Ti; \
a = ROTATE_LEFT(t, s) + b a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */ /* Do the following 16 operations. */
SET(a, b, c, d, 0, 6, T49); SET(a, b, c, d, 0, 6, T49);
SET(d, a, b, c, 7, 10, T50); SET(d, a, b, c, 7, 10, T50);

View File

@@ -13,9 +13,9 @@ static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
static void munmap(void *addr, int64_t length) { UnmapViewOfFile(addr); } static void munmap(void *addr, int64_t length) { UnmapViewOfFile(addr); }
#define MAP_FAILED NULL #define MAP_FAILED (NULL)
#define MAP_PRIVATE 0 #define MAP_PRIVATE (0)
#define PROT_READ 0 #define PROT_READ (0)
#else #else
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif