* Snapshot version 1.12 release 1-3. Update version to 1.12.1-4. * First cut of the H5 public API documentation. (#80) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Full set of current H5F documentation. (#105) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Migrated documentation for SWMR functions. * Catching up on MDC functions. * Integrated the H5F MDC function documentation. * Added MDC and parallel H5F functions. * Slightly updated main page. * Added doxygen/dox/H5AC_cache_config_t.dox to MANIFEST. * Doxygen - added (mostly) beginner functions (#112) * Doxygen - added (mostly) beginner functions * Removed duplicate H5Pset_szip function * Add src/H5module.h to MANIFEST. * close #195. (#196) * Update HDF5PluginMacros.cmake * Update HDF5PluginMacros.cmake * Avoid aligned access for references by decoding into temporary buffer and then copying the result into the actual buffer. Update test to be more thorough with using compound datatype fields everywhere. (#206) * Modify temporary rpath for testing in java example scripts. (#230) * Fix undefined left shifting of negative numbers (#338) Undefined Bahavior Sanitizer errored here about left shifting negative numbers. * Fixes various warnings noticed on Windows (#425) * Fixes various warnings noticed on Windows - Adds a prototype for our implementation of vasprintf - Return type of H5_get_utf16_str() is now non-const - Fixes possible uninitialized return type in Wremove_utf8 - Better isolation of fork() code in accum.c:test_swmr_write_big() - Better isolation of non-zlib code in dsets.c:test_filter_delete() - Removed unused variable in trefer.c:test_reference_cmpnd_obj() * Fixes clang-format issues * Fixed clang-tidy readability-misleading-indentation warnings (#427) * Fixed clang-tidy readability-misleading-indentation warnings * Reformatted src/H5Zscaleoffset.c with clang v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Fixed clang-tidy readability-redundant-control-flow warnings (#428) * Fixed clang-tidy readability-redundant-control-flow warnings Just removed useless trailing return statements. * Removed blank lines from h5diffgentest.c with clang-format v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Removed bad function pointer casts (#434) * Removed bad function pointer casts In one case fixed the actual function signature to be correct. * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * fix block coordinate printing example (#437) Co-authored-by: Gerd Heber <gheber@hdfgroup.org> Co-authored-by: bljhdf <58825073+bljhdf@users.noreply.github.com> Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org> Co-authored-by: Quincey Koziol <quincey@koziol.cc> Co-authored-by: Sean McBride <sean@rogue-research.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Mike Smith <grimbough@gmail.com>
96 lines
3.5 KiB
C
96 lines
3.5 KiB
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* Copyright by The HDF Group. *
|
|
* 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 COPYING file, which can be found at the root of the source code *
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
|
* If you do not have access to either file, you may request a copy from *
|
|
* help@hdfgroup.org. *
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
/*
|
|
* Purpose: Tests the plugin module (H5PL)
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "H5PLextern.h"
|
|
|
|
#define H5Z_FILTER_DYNLIBUD 300
|
|
#define MULTIPLIER 3
|
|
|
|
static size_t H5Z_filter_dynlibud(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_DYNLIBUD[1] = {{
|
|
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
|
H5Z_FILTER_DYNLIBUD, /* Filter id number */
|
|
1, 1, /* Encoding and decoding enabled */
|
|
"dynlibud", /* Filter name for debugging */
|
|
NULL, /* The "can apply" callback */
|
|
NULL, /* The "set local" callback */
|
|
H5Z_filter_dynlibud, /* The actual filter function */
|
|
}};
|
|
|
|
H5PL_type_t
|
|
H5PLget_plugin_type(void)
|
|
{
|
|
return H5PL_TYPE_FILTER;
|
|
}
|
|
const void *
|
|
H5PLget_plugin_info(void)
|
|
{
|
|
return H5Z_DYNLIBUD;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Function: H5Z_filter_dynlibud
|
|
*
|
|
* Purpose: A dynlib2 filter method that multiplies the original value
|
|
* during write and divide the original value during read. It
|
|
* will be built as a shared library. plugin.c test will load
|
|
* and use this filter library.
|
|
*
|
|
* Return: Success: Data chunk size
|
|
*
|
|
* Failure: 0
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
static size_t
|
|
H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
|
|
size_t *buf_size, void **buf)
|
|
{
|
|
char * int_ptr = (char *)*buf; /* Pointer to the data values */
|
|
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
|
|
|
/* Check for the correct number of parameters */
|
|
if (cd_nelmts > 0)
|
|
return (0);
|
|
|
|
/* Assignment to eliminate unused parameter warning. */
|
|
cd_values = cd_values;
|
|
|
|
if (flags & H5Z_FLAG_REVERSE) { /*read*/
|
|
/* Subtract the original value with MULTIPLIER */
|
|
while (buf_left > 0) {
|
|
char temp = *int_ptr;
|
|
*int_ptr = (int8_t)(temp - MULTIPLIER);
|
|
int_ptr++;
|
|
buf_left -= sizeof(*int_ptr);
|
|
} /* end while */
|
|
} /* end if */
|
|
else { /*write*/
|
|
/* Add the original value with MULTIPLIER */
|
|
while (buf_left > 0) {
|
|
char temp = *int_ptr;
|
|
*int_ptr = (int8_t)(temp + MULTIPLIER);
|
|
int_ptr++;
|
|
buf_left -= sizeof(*int_ptr);
|
|
} /* end while */
|
|
} /* end else */
|
|
|
|
return nbytes;
|
|
} /* end H5Z_filter_dynlibud() */
|