From 59a9d9a0c67ea2a848a6aaad544db651a9fa4192 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Mar 2013 13:21:28 -0500 Subject: [svn-r23403] Refactor windows code: windows uses ';' as path separator windows default path is different windows find files needs '*.*' --- MANIFEST | 1 - src/H5PL.c | 11 ++++++--- src/H5PLpublic.h | 13 +++++++++- test/plugin_lib/CMakeLists.txt | 8 ++---- test/plugin_lib/dynlib1.c | 8 +++++- test/plugin_lib/dynlib1.h | 55 ------------------------------------------ 6 files changed, 29 insertions(+), 67 deletions(-) delete mode 100644 test/plugin_lib/dynlib1.h diff --git a/MANIFEST b/MANIFEST index 3b6e913..17de021 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1096,7 +1096,6 @@ ./test/chunk_info.c ./test/plugin_lib/dynlib1.c -./test/plugin_lib/dynlib1.h ./test/plugin_lib/Makefile.in ./test/testfiles/err_compat_1 diff --git a/src/H5PL.c b/src/H5PL.c index bc0b90e..5fb8147 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -35,8 +35,6 @@ /* Local Macros */ /****************/ -#define H5PL_DEFAULT_PATH "/usr:/usr/lib:/usr/local" -#define H5PL_PATH_SEPARATOR ":" #define H5PL_MAX_PATH_NUM 16 /****************************/ @@ -45,6 +43,8 @@ /****************************/ /* Windows support */ #ifdef H5_HAVE_WIN32_API +#define H5PL_DEFAULT_PATH ".;/ProgramData;/Users/Public" +#define H5PL_PATH_SEPARATOR ";" /* Handle for dynamic library */ #define H5PL_HANDLE HINSTANCE @@ -77,6 +77,8 @@ ret_val = get_filter_info(); \ typedef const H5Z_class2_t *(__cdecl *get_filter_info_t)(); #else /* H5_HAVE_WIN32_API */ +#define H5PL_DEFAULT_PATH "/usr:/usr/lib:/usr/local" +#define H5PL_PATH_SEPARATOR ":" /* Handle for dynamic library */ #define H5PL_HANDLE void * @@ -425,10 +427,13 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, void **info) HANDLE hFind; char *pathname = NULL; htri_t ret_value = FALSE; + char service[2048]; FUNC_ENTER_STATIC - if((hFind = FindFirstFile(dir, &fdFile)) == INVALID_HANDLE_VALUE) + /* Specify a file mask. *.* = We want everything! */ + sprintf(service, "%s*.*", dir); + if((hFind = FindFirstFile(service, &fdFile)) == INVALID_HANDLE_VALUE) HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory") do { diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index 65a94cc..6b17197 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -21,7 +21,7 @@ #define _H5PLpublic_H /* Public headers needed by this file */ -#include "H5public.h" +#include "H5Zpublic.h" /****************************/ /* Library Public Typedefs */ @@ -36,12 +36,23 @@ typedef enum H5PL_type_t { } H5PL_type_t; +/* plugins always export */ +#if defined (_MSC_VER) /* MSVC Compiler Case */ + #define H5PLUGIN_DLL __declspec(dllexport) +#elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ + #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) +#endif + #ifdef __cplusplus extern "C" { #endif + H5PLUGIN_DLL const H5PL_type_t H5PL_get_plugin_type(void); + H5PLUGIN_DLL const H5Z_class2_t* H5PL_get_plugin_info(void); + #ifdef __cplusplus } #endif + #endif /* _H5PLpublic_H */ diff --git a/test/plugin_lib/CMakeLists.txt b/test/plugin_lib/CMakeLists.txt index e45e848..6435688 100644 --- a/test/plugin_lib/CMakeLists.txt +++ b/test/plugin_lib/CMakeLists.txt @@ -34,10 +34,6 @@ SET (H5_TEST_PLUGIN_LIB_SRCS ${HDF5_TEST_PLUGIN_LIB_SOURCE_DIR}/dynlib1.c ) -SET (H5_TEST_PLUGIN_LIB_HDRS - ${HDF5_TEST_PLUGIN_LIB_SOURCE_DIR}/dynlib1.h -) - #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation #----------------------------------------------------------------------------- @@ -45,7 +41,7 @@ SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) -ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${H5_TEST_PLUGIN_LIB_SRCS} ${H5_TEST_PLUGIN_LIB_HDRS}) +ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${H5_TEST_PLUGIN_LIB_SRCS}) TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) #SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_PLUGIN_LIB_TARGET}") H5_SET_LIB_OPTIONS ( @@ -84,4 +80,4 @@ TARGET_LINK_LIBRARIES (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET}) SET_TARGET_PROPERTIES (plugin PROPERTIES FOLDER test) ADD_TEST (NAME H5PLUGIN-plugin COMMAND $) -SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/plugins) +SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/plugins/ diff --git a/test/plugin_lib/dynlib1.c b/test/plugin_lib/dynlib1.c index 1f4fff8..d663bd7 100644 --- a/test/plugin_lib/dynlib1.c +++ b/test/plugin_lib/dynlib1.c @@ -19,7 +19,13 @@ * * Purpose: Tests the plugin module (H5PL) */ -#include "dynlib1.h" + +#include +#include +#include + +static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ diff --git a/test/plugin_lib/dynlib1.h b/test/plugin_lib/dynlib1.h deleted file mode 100644 index fba626f..0000000 --- a/test/plugin_lib/dynlib1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) - */ -#ifndef DYNLIB1_H__ -#define DYNLIB1_H__ - -#include -#include -#include - -/* plugins always export */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllexport) - #define H5PLUGIN_DLLVAR extern __declspec(dllexport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #define H5PLUGIN_DLLVAR extern __attribute__ ((visibility("default"))) - #endif - -#define FILTER_DYNLIB1_VERS 1 - -#ifdef __cplusplus -extern "C" { -#endif - - H5PLUGIN_DLL const H5PL_type_t H5PL_get_plugin_type(void); - H5PLUGIN_DLL const H5Z_class2_t* H5PL_get_plugin_info(void); - -/* Local prototypes for filter functions */ - static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLIB1_H__ */ -- cgit v0.12