summaryrefslogtreecommitdiffstats
path: root/src/H5PL.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5PL.c')
-rw-r--r--src/H5PL.c141
1 files changed, 76 insertions, 65 deletions
diff --git a/src/H5PL.c b/src/H5PL.c
index 738db90..1806ea6 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -23,11 +23,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5PLprivate.h" /* Plugin */
-#include "H5Zprivate.h" /* Filter pipeline */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5PLprivate.h" /* Plugin */
+#include "H5Zprivate.h" /* Filter pipeline */
/****************/
@@ -40,7 +40,19 @@
/* Macros for supporting
* both Windows and Unix */
/****************************/
-/* Windows support */
+/* Windows support
+ *
+ * SPECIAL WINDOWS NOTE
+ *
+ * Some of the Win32 API functions expand to fooA or fooW depending on
+ * whether UNICODE or _UNICODE are defined. You MUST explicitly use
+ * the A version of the functions to force char * behavior until we
+ * work out a scheme for proper Windows Unicode support.
+ *
+ * If you do not do this, people will be unable to incorporate our
+ * source code into their own CMake builds if they define UNICODE.
+ */
+
#ifdef H5_HAVE_WIN32_API
#define H5PL_PATH_SEPARATOR ";"
@@ -49,7 +61,7 @@
#define H5PL_HANDLE HINSTANCE
/* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
-#define H5PL_OPEN_DLIB(S) LoadLibraryEx(TEXT(S), NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
+#define H5PL_OPEN_DLIB(S) LoadLibraryExA(S, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
/* Get the address of a symbol in dynamic library */
#define H5PL_GET_LIB_FUNC(H,N) GetProcAddress(H,N)
@@ -96,9 +108,9 @@ typedef const void *(*H5PL_get_plugin_info_t)(void);
/* Type for the list of info for opened plugin libraries */
typedef struct H5PL_table_t {
- H5PL_type_t pl_type; /* plugin type */
- int pl_id; /* ID for the plugin */
- H5PL_HANDLE handle; /* plugin handle */
+ H5PL_type_t pl_type; /* plugin type */
+ int pl_id; /* ID for the plugin */
+ H5PL_HANDLE handle; /* plugin handle */
} H5PL_table_t;
@@ -128,8 +140,8 @@ static herr_t H5PL__close(H5PL_HANDLE handle);
/*******************/
/* Table for opened plugin libraries */
-static size_t H5PL_table_alloc_g = 0;
-static size_t H5PL_table_used_g = 0;
+static size_t H5PL_table_alloc_g = 0;
+static size_t H5PL_table_used_g = 0;
static H5PL_table_t *H5PL_table_g = NULL;
/* Table of location paths for plugin libraries */
@@ -173,15 +185,15 @@ H5PL__init_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5PL_no_plugin
+ * Function: H5PL_no_plugin
*
- * Purpose: Quick way for filter module to query whether to load plugin
+ * Purpose: Quick way for filter module to query whether to load plugin
*
- * Return: TRUE: No plugin loading during data reading
+ * Return: TRUE: No plugin loading during data reading
*
- * FALSE: Load plugin during data reading
+ * FALSE: Load plugin during data reading
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 20 February 2013
*
*-------------------------------------------------------------------------
@@ -201,18 +213,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL_term_interface
+ * Function: H5PL_term_interface
*
- * Purpose: Terminate the H5PL interface: release all memory, reset all
- * global variables to initial values. This only happens if all
- * types have been destroyed from other interfaces.
+ * Purpose: Terminate the H5PL interface: release all memory, reset all
+ * global variables to initial values. This only happens if all
+ * types have been destroyed from other interfaces.
*
- * Return: Success: Positive if any action was taken that might
- * affect some other interface; zero otherwise.
+ * Return: Success: Positive if any action was taken that might
+ * affect some other interface; zero otherwise.
*
- * Failure: Negative.
+ * Failure: Negative.
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 20 February 2013
*
*-------------------------------------------------------------------------
@@ -227,13 +239,13 @@ H5PL_term_interface(void)
if(H5_interface_initialize_g) {
size_t u; /* Local index variable */
- /* Close opened dynamic libraries */
+ /* Close opened dynamic libraries */
for(u = 0; u < H5PL_table_used_g; u++)
H5PL__close((H5PL_table_g[u]).handle);
- /* Free the table of dynamic libraries */
- H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g);
- H5PL_table_used_g = H5PL_table_alloc_g = 0;
+ /* Free the table of dynamic libraries */
+ H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g);
+ H5PL_table_used_g = H5PL_table_alloc_g = 0;
/* Free the table of search paths */
for(u = 0; u < H5PL_num_paths_g; u++)
@@ -242,7 +254,7 @@ H5PL_term_interface(void)
H5PL_num_paths_g = 0;
H5PL_path_found_g = FALSE;
- H5_interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
i = 1;
} /* end if */
@@ -251,15 +263,15 @@ H5PL_term_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5PL_load
+ * Function: H5PL_load
*
- * Purpose: Given the plugin type and identifier, this function searches
+ * Purpose: Given the plugin type and identifier, this function searches
* and/or loads a dynamic plugin library first among the already
* opened libraries then in the designated location paths.
*
- * Return: Non-NULL on success/NULL on failure
+ * Return: Non-NULL on success/NULL on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -314,13 +326,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__init_path_table
+ * Function: H5PL__init_path_table
*
- * Purpose: Initialize the path table.
+ * Purpose: Initialize the path table.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* 18 March 2013
*
*-------------------------------------------------------------------------
@@ -369,18 +381,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__find
+ * Function: H5PL__find
*
* Purpose: Given a path, this function opens the directory and envokes
* another function to go through all files to find the right
* plugin library. Two function definitions are for Unix and
* Windows.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -457,17 +469,17 @@ done:
static htri_t
H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
{
- WIN32_FIND_DATA fdFile;
- HANDLE hFind;
- char *pathname = NULL;
- char service[2048];
- htri_t ret_value = FALSE;
+ WIN32_FIND_DATAA fdFile;
+ HANDLE hFind;
+ char *pathname = NULL;
+ char service[2048];
+ htri_t ret_value = FALSE;
FUNC_ENTER_STATIC
/* Specify a file mask. *.* = We want everything! */
sprintf(service, "%s\\*.dll", dir);
- if((hFind = FindFirstFile(service, &fdFile)) == INVALID_HANDLE_VALUE)
+ if((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory")
do {
@@ -480,7 +492,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
/* Allocate & initialize the path name */
pathname_len = HDstrlen(dir) + HDstrlen(fdFile.cFileName) + 2;
- if(NULL == (pathname = (char *)H5MM_malloc(pathname_len)))
+ if(NULL == (pathname = (char *)H5MM_malloc(pathname_len)))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")
HDsnprintf(pathname, pathname_len, "%s\\%s", dir, fdFile.cFileName);
@@ -495,10 +507,10 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
HGOTO_DONE(TRUE)
} /* end if */
else
- HDassert(pathname);
+ HDassert(pathname);
pathname = (char *)H5MM_xfree(pathname);
} /* end if */
- } while(FindNextFile(hFind, &fdFile)); /* Find the next file. */
+ } while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */
done:
if(hFind)
@@ -512,17 +524,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__open
+ * Function: H5PL__open
*
* Purpose: Iterates through all files to find the right plugin library.
* It loads the dynamic plugin library and keeps it on the list
- * of loaded libraries.
+ * of loaded libraries.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -600,16 +612,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__search_table
+ * Function: H5PL__search_table
*
* Purpose: Search in the list of already opened dynamic libraries
* to see if the one we are looking for is already opened.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -631,12 +643,12 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info)
const H5Z_class2_t *plugin_info;
if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info")))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
- if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)()))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
+ if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
- *info = plugin_info;
+ *info = plugin_info;
HGOTO_DONE(TRUE)
} /* end if */
} /* end for */
@@ -648,13 +660,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__close
+ * Function: H5PL__close
*
* Purpose: Closes the handle for dynamic library
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -668,4 +680,3 @@ H5PL__close(H5PL_HANDLE handle)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5PL__close() */
-