Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(xmlsec-core) Removed '--enable-size-t' ('size_t' for MSVC builds) option and made 'xmlSecSize' to always be the same as 'size_t'. #719

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/make-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ jobs:
matrix:
include:
- config_flags:
- config_flags: --enable-size-t=no --enable-md5 --enable-ftp
- config_flags: --enable-static --enable-static-linking --without-nss --without-gcrypt --without-gnutls
- config_flags: --enable-static --enable-static-linking --enable-gost --enable-gost2012 --without-openssl --without-nss --without-gcrypt
- config_flags: --enable-static --enable-static-linking --enable-ftp --enable-md5 --enable-gost --enable-gost2012 --without-openssl --without-nss --without-gcrypt
steps:
- name: install dependencies
run: |
Expand Down Expand Up @@ -56,7 +55,6 @@ jobs:
matrix:
include:
- config_flags:
- config_flags: --enable-size-t=no --enable-md5 --enable-ftp
- config_flags: --enable-static-linking=yes --without-nss --without-gcrypt --without-gnutls
steps:
- name: install dependencies
Expand Down Expand Up @@ -95,7 +93,6 @@ jobs:
matrix:
include:
- config_flags:
- config_flags: --enable-size-t=no --enable-md5 --enable-ftp
steps:
- name: Set up Homebrew
id: set-up-homebrew
Expand Down Expand Up @@ -150,13 +147,7 @@ jobs:
config_flags: --enable-unicode=yes
- msystem: MINGW64
arch: x86_64
config_flags: --enable-unicode=no
- msystem: MINGW64
arch: x86_64
config_flags: --enable-size-t=no --enable-md5 --enable-ftp
- msystem: MINGW64
arch: x86_64
config_flags: --enable-static --enable-static-linking
config_flags: --enable-static --enable-static-linking --enable-unicode=no --enable-md5 --enable-ftp
defaults:
run:
shell: msys2 {0}
Expand Down
3 changes: 0 additions & 3 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T

/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
Expand Down
22 changes: 0 additions & 22 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -305,28 +305,6 @@ AC_DEFUN([AX_FIND_FOLDER],[
done
])

dnl ==========================================================================
dnl check do we have size_t and its size,
dnl TODO: will need to replace this and the xmlSecSize define with
dnl typedef on next ABI refresh
dnl ==========================================================================
AC_CHECK_SIZEOF(size_t)

XMLSEC_USE_SIZE_T="no"
AC_ARG_ENABLE([size-t], [AS_HELP_STRING([--enable-size-t],[enable xmsSecSize typedef to size_t (yes)])])
AC_MSG_CHECKING(for using size_t)
if test "z$enable_size_t" = "zno" ; then
XMLSEC_USE_SIZE_T="no"
AC_MSG_RESULT([no (deprecated)])
else
XMLSEC_USE_SIZE_T="yes"
AC_MSG_RESULT([yes])
fi

if test "z$XMLSEC_USE_SIZE_T" != "zyes" -a "$ac_cv_sizeof_size_t" -ne "4" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SIZE_T"
fi

dnl ==========================================================================
dnl find libxml
dnl ==========================================================================
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1>XML Security Library</h1>
<br>
<br>
<ul>
<li>TODO</li>
<li>(xmlsec-core) Removed '--enable-size-t' ('size_t' for MSVC builds) option and made 'xmlSecSize' to always be the same as 'size_t'.</li>
<li>Several other small fixes (see <a href="https://github.com/lsh123/xmlsec/commits/master">more details</a>).</li>
</ul>
</li>
Expand Down
9 changes: 2 additions & 7 deletions include/xmlsec/xmlsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ typedef void* xmlSecPtr;
*
* Size of something.
*/
#ifdef XMLSEC_NO_SIZE_T
#define xmlSecSize unsigned int
#define XMLSEC_SIZE_MAX UINT_MAX
#define XMLSEC_SIZE_FMT "%u"
#else /* XMLSEC_NO_SIZE_T */

typedef size_t xmlSecSize;
#define xmlSecSize size_t
#define XMLSEC_SIZE_MIN ((xmlSecSize)0)
#define XMLSEC_SIZE_MAX SIZE_MAX
#define XMLSEC_SIZE_FMT XMLSEC_SIZE_T_FMT
#endif /* XMLSEC_NO_SIZE_T */
#define XMLSEC_SIZE_MIN ((xmlSecSize)0)

/**
* xmlSecByte:
Expand Down
12 changes: 1 addition & 11 deletions src/cast_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,10 @@

#endif /* (ULONG_MAX > XMLSEC_SIZE_MAX) */

/* Safe cast with limits check: size_t -> xmlSecSize (assume size_t >= 0) */
#if (SIZE_MAX > XMLSEC_SIZE_MAX)

#define XMLSEC_SAFE_CAST_SIZE_T_TO_SIZE(srcVal, dstVal, errorAction, errorObject) \
XMLSEC_SAFE_CAST_MAX_CHECK(size_t, (srcVal), XMLSEC_SIZE_T_FMT, \
xmlSecSize, (dstVal), XMLSEC_SIZE_FMT, XMLSEC_SIZE_MIN, XMLSEC_SIZE_MAX, \
errorAction, (errorObject))

#else /* (SIZE_MAX > XMLSEC_SIZE_MAX) */

/* Safe cast with limits check: size_t -> xmlSecSize (same type) */
#define XMLSEC_SAFE_CAST_SIZE_T_TO_SIZE(srcVal, dstVal, errorAction, errorObject) \
(dstVal) = (srcVal);

#endif /* (SIZE_MAX > XMLSEC_SIZE_MAX) */

/******************************************************************************
*
Expand Down
5 changes: 0 additions & 5 deletions win32/Makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,6 @@ CFLAGS = $(CFLAGS) /D "XMLSEC_NO_GOST" /D "XMLSEC_NO_GOST2012"
CFLAGS = $(CFLAGS) /I$(BASEDIR) /I$(BASEDIR)\include
CFLAGS = $(CFLAGS) /I$(INCPREFIX)

!if "$(WITH_SIZE_T)" == "1"
CFLAGS = $(CFLAGS)
!else
CFLAGS = $(CFLAGS) /D "XMLSEC_NO_SIZE_T"
!endif

!if "$(WITH_LEGACY_CRYPTO)" == "1"
CFLAGS = $(CFLAGS)
Expand Down
6 changes: 0 additions & 6 deletions win32/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ var withMSCrypto = 0;
var withMSCng = 0;
var withLibXSLT = 1;
var withIconv = 1;
var withSizeT = 1;
var withFTP = 0; /* disable ftp by default */
var withHTTP = 1;
var withLegacyCrypto = 0;
Expand Down Expand Up @@ -121,7 +120,6 @@ function usage()
txt += " (\"" + withCrypto + "\");\n"
txt += " xslt: LibXSLT is used (" + (withLibXSLT? "yes" : "no") + ")\n";
txt += " iconv: Use the iconv library (" + (withIconv? "yes" : "no") + ")\n";
txt += " size_t: Use the size_t (" + (withSizeT ? "yes" : "no") + ")\n";
txt += " ftp: Enable FTP support (" + (withFTP ? "yes" : "no") + ")\n";
txt += " http: Enable HTTP support (" + (withHTTP ? "yes" : "no") + ")\n";
txt += " legacy - crypto: Use the size_t (" + (withLegacyCrypto ? "yes" : "no") + ")\n";
Expand Down Expand Up @@ -197,7 +195,6 @@ function discoverVersion()
vf.WriteLine("WITH_MSCNG=" + withMSCng);
vf.WriteLine("WITH_LIBXSLT=" + (withLibXSLT ? "1" : "0"));
vf.WriteLine("WITH_ICONV=" + (withIconv ? "1" : "0"));
vf.WriteLine("WITH_SIZE_T=" + (withSizeT ? "1" : "0"));
vf.WriteLine("WITH_FTP=" + (withFTP ? "1" : "0"));
vf.WriteLine("WITH_HTTP=" + (withHTTP ? "1" : "0"));
vf.WriteLine("WITH_LEGACY_CRYPTO=" + (withLegacyCrypto ? "1" : "0"));
Expand Down Expand Up @@ -336,8 +333,6 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
withLibXSLT = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "iconv")
withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "size_t")
withSizeT = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "ftp")
withFTP = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "http")
Expand Down Expand Up @@ -488,7 +483,6 @@ txtOut += " Use MSCrypto: " + boolToStr(withMSCrypto) + "\n";
txtOut += " Use MSCng: " + boolToStr(withMSCng) + "\n";
txtOut += " Use LibXSLT: " + boolToStr(withLibXSLT) + "\n";
txtOut += " Use iconv: " + boolToStr(withIconv) + "\n";
txtOut += " Use size_t: " + boolToStr(withSizeT) + "\n";
txtOut += " Use legacy crypto: " + boolToStr(withLegacyCrypto) + "\n";
txtOut += " Support FTP: " + boolToStr(withFTP) + "\n";
txtOut += " Support HTTP: " + boolToStr(withHTTP) + "\n";
Expand Down
Loading