1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: improve support for non-macro htonll and htobe64

This commit is contained in:
Albert Lee
2025-05-16 01:46:47 +00:00
committed by Sébastien Helleu
parent aa6cbf911e
commit 69d3787b5e
3 changed files with 13 additions and 6 deletions
+2
View File
@@ -218,6 +218,8 @@ check_symbol_exists("malloc_trim" "malloc.h" HAVE_MALLOC_TRIM)
check_function_exists(mallinfo HAVE_MALLINFO)
check_function_exists(mallinfo2 HAVE_MALLINFO2)
check_symbol_exists("htonll" "sys/types.h;netinet/in.h;inttypes.h" HAVE_HTONLL)
check_symbol_exists("eat_newline_glitch" "term.h" HAVE_EAT_NEWLINE_GLITCH)
# Check for Large File Support
+1
View File
@@ -49,6 +49,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
#cmakedefine HAVE_MALLINFO2
#cmakedefine HAVE_MALLOC_H
#cmakedefine HAVE_MALLOC_TRIM
#cmakedefine HAVE_HTONLL
#cmakedefine HAVE_EAT_NEWLINE_GLITCH
#cmakedefine HAVE_ASPELL_VERSION_STRING
#cmakedefine HAVE_ENCHANT_GET_VERSION
+10 -6
View File
@@ -36,10 +36,18 @@
/* Bring in htobe64 */
#ifdef __ANDROID__
#define _BSD_SOURCE
#define BE_INT64 htobe64
#include <endian.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define htobe64 OSSwapHostToBigInt64
#define BE_INT64 OSSwapHostToBigInt64
#elif defined(HAVE_HTONLL)
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
#define BE_INT64 htonll
#else
#define BE_INT64 htobe64
#endif
#include "weechat.h"
@@ -49,10 +57,6 @@
#include "core-string.h"
#include "../plugins/plugin.h"
#ifdef htonll
#define htobe64 htonll
#endif
char *weecrypto_hash_algo_string[] = {
"crc32",
"md5",
@@ -536,7 +540,7 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
int rc, offset, length;
unsigned long bin_code;
moving_factor_swapped = htobe64 (moving_factor);
moving_factor_swapped = BE_INT64 (moving_factor);
rc = weecrypto_hmac (secret, length_secret,
&moving_factor_swapped, sizeof (moving_factor_swapped),
GCRY_MD_SHA1,