Paul Vriens : oleaut32/tests:
Use GetModuleHandle and check only once for availability of some
functions .
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 17 06:30:49 CDT 2007
Module: wine
Branch: master
Commit: c31ead476827472e7895f0151ffd026ada1d3327
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c31ead476827472e7895f0151ffd026ada1d3327
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Fri Aug 17 11:07:43 2007 +0200
oleaut32/tests: Use GetModuleHandle and check only once for availability of some functions.
---
dlls/oleaut32/tests/vartest.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index e0d419c..9c5dd52 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -51,17 +51,12 @@ static INT (WINAPI *pVariantTimeToDosDateTime)(double,USHORT*,USHORT *);
#define CHECKPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func); \
if (!p##func) { trace("function " # func " not available, not testing it\n"); return; }
- /* Is a given function exported from oleaut32? */
-#define HAVE_FUNC(func) ((void*)GetProcAddress(hOleaut32, #func) != NULL)
-
/* Have IRecordInfo data type? */
-#define HAVE_OLEAUT32_RECORD HAVE_FUNC(SafeArraySetRecordInfo)
-/* Have CY data type? */
-#define HAVE_OLEAUT32_CY HAVE_FUNC(VarCyAdd)
+static int HAVE_OLEAUT32_RECORD = 0;
/* Have I8/UI8 data type? */
-#define HAVE_OLEAUT32_I8 HAVE_FUNC(VarI8FromI1)
+static int HAVE_OLEAUT32_I8 = 0;
/* Is this an ancient version with support for only I2/I4/R4/R8/DATE? */
-#define IS_ANCIENT (!HAVE_FUNC(VarI1FromI2))
+static int IS_ANCIENT = 0;
/* When comparing floating point values we cannot expect an exact match
* because the rounding errors depend on the exact algorithm.
@@ -99,6 +94,20 @@ static INT (WINAPI *pVariantTimeToDosDateTime)(double,USHORT*,USHORT *);
#define R8_MAX DBL_MAX
#define R8_MIN DBL_MIN
+static void init(void)
+{
+ hOleaut32 = GetModuleHandle("oleaut32.dll");
+
+ /* Is a given function exported from oleaut32? */
+#define HAVE_FUNC(func) ((void*)GetProcAddress(hOleaut32, #func) != NULL)
+
+ HAVE_OLEAUT32_I8 = HAVE_FUNC(VarI8FromI1);
+ HAVE_OLEAUT32_RECORD = HAVE_FUNC(SafeArraySetRecordInfo);
+ IS_ANCIENT = (!HAVE_FUNC(VarI1FromI2));
+
+#undef HAVE_FUNC
+}
+
/* Functions to set a DECIMAL */
static void setdec(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG64 lo64)
{
@@ -8203,7 +8212,7 @@ static void test_VarImp(void)
START_TEST(vartest)
{
- hOleaut32 = LoadLibraryA("oleaut32.dll");
+ init();
test_VariantInit();
test_VariantClear();
More information about the wine-cvs
mailing list