diff options
Diffstat (limited to 'src/H5Opline.c')
-rw-r--r-- | src/H5Opline.c | 155 |
1 files changed, 77 insertions, 78 deletions
diff --git a/src/H5Opline.c b/src/H5Opline.c index 0afd028..90e9626 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -12,23 +12,23 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Wednesday, April 15, 1998 + * Programmer: Robb Matzke + * Wednesday, April 15, 1998 * - * Purpose: Data filter pipeline message. + * Purpose: Data filter pipeline message. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5Z_FRIEND /*suppress error about including H5Zpkg */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Zpkg.h" /* Data filters */ /* PRIVATE PROTOTYPES */ @@ -45,25 +45,25 @@ static herr_t H5O__pline_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_PLINE -#define H5O_SHARED_DECODE H5O_pline_shared_decode -#define H5O_SHARED_DECODE_REAL H5O__pline_decode -#define H5O_SHARED_ENCODE H5O_pline_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_pline_encode -#define H5O_SHARED_SIZE H5O_pline_shared_size -#define H5O_SHARED_SIZE_REAL H5O_pline_size -#define H5O_SHARED_DELETE H5O__pline_shared_delete +#define H5O_SHARED_TYPE H5O_MSG_PLINE +#define H5O_SHARED_DECODE H5O_pline_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__pline_decode +#define H5O_SHARED_ENCODE H5O_pline_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_pline_encode +#define H5O_SHARED_SIZE H5O_pline_shared_size +#define H5O_SHARED_SIZE_REAL H5O_pline_size +#define H5O_SHARED_DELETE H5O__pline_shared_delete #undef H5O_SHARED_DELETE_REAL -#define H5O_SHARED_LINK H5O__pline_shared_link +#define H5O_SHARED_LINK H5O__pline_shared_link #undef H5O_SHARED_LINK_REAL -#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_pline_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__pline_debug -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#define H5O_SHARED_DEBUG H5O_pline_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__pline_debug +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ @@ -103,12 +103,12 @@ H5FL_DEFINE(H5O_pline_t); /*------------------------------------------------------------------------- * Function: H5O__pline_decode * - * Purpose: Decodes a filter pipeline message. + * Purpose: Decodes a filter pipeline message. * - * Return: Success: Ptr to the native message. - * Failure: NULL + * Return: Success: Ptr to the native message. + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -286,7 +286,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) size_t name_length; /* Length of filter name */ /* Filter ID */ - UINT16ENCODE(p, filter->id); + UINT16ENCODE(p, filter->id); /* Skip writing the name length & name if the filter is an internal filter */ if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED) { @@ -310,26 +310,26 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) } /* end else */ /* Filter flags */ - UINT16ENCODE(p, filter->flags); + UINT16ENCODE(p, filter->flags); /* # of filter parameters */ - UINT16ENCODE(p, filter->cd_nelmts); + UINT16ENCODE(p, filter->cd_nelmts); /* Encode name, if there is one to encode */ - if(name_length > 0) { + if(name_length > 0) { /* Store name, with null terminator */ - H5MM_memcpy(p, name, name_length); - p += name_length; + H5MM_memcpy(p, name, name_length); + p += name_length; /* Pad out name to alignment, in older versions */ if(pline->version == H5O_PLINE_VERSION_1) while(name_length++ % 8) *p++ = 0; - } /* end if */ + } /* end if */ /* Filter parameters */ - for(j = 0; j < filter->cd_nelmts; j++) - UINT32ENCODE(p, filter->cd_values[j]); + for(j = 0; j < filter->cd_nelmts; j++) + UINT32ENCODE(p, filter->cd_values[j]); /* Align the parameters for older versions of the format */ if(pline->version == H5O_PLINE_VERSION_1) @@ -369,7 +369,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) /* Allocate pipeline message, if not provided */ if(!dst && NULL == (dst = H5FL_MALLOC(H5O_pline_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Shallow copy basic fields */ *dst = *src; @@ -426,7 +426,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) done: if(!ret_value && dst) { H5O__pline_reset(dst); - if(!_dst) + if(!_dst) H5O__pline_free(dst); } /* end if */ @@ -459,8 +459,8 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) /* Message header */ ret_value = (size_t)(1 + /*version */ - 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ + 1 + /*number of filters */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ /* Calculate size of each filter in pipeline */ for(i = 0; i < pline->nused; i++) { @@ -479,13 +479,13 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) name_len = name ? HDstrlen(name) + 1 : 0; } /* end else */ - ret_value += 2 + /*filter identification number */ - (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ - 2 + /*flags */ - 2 + /*number of client data values */ - (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ + ret_value += 2 + /*filter identification number */ + (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ + 2 + /*flags */ + 2 + /*number of client data values */ + (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ - ret_value += pline->filter[i].cd_nelmts * 4; + ret_value += pline->filter[i].cd_nelmts * 4; if(pline->version == H5O_PLINE_VERSION_1) if(pline->filter[i].cd_nelmts % 2) ret_value += 4; @@ -523,8 +523,7 @@ H5O__pline_reset(void *mesg) HDassert(pline); /* Free the filter information and array */ - if (pline->filter) { - + if(pline->filter) { /* Free information for each filter */ for(i = 0; i < pline->nused; i++) { if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name) @@ -661,36 +660,36 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, /* Loop over all the filters */ for(i = 0; i < pline->nused; i++) { - char name[32]; - - HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter identification:", - (unsigned)(pline->filter[i].id)); - if(pline->filter[i].name) - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:", - pline->filter[i].name); - else - HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:"); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Flags:", - pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Num CD values:", - pline->filter[i].cd_nelmts); + char name[32]; + + HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); + HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter identification:", + (unsigned)(pline->filter[i].id)); + if(pline->filter[i].name) + HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:", + pline->filter[i].name); + else + HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:"); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Flags:", + pline->filter[i].flags); + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + "Num CD values:", + pline->filter[i].cd_nelmts); - /* Filter parameters */ - for(j = 0; j < pline->filter[i].cd_nelmts; j++) { - char field_name[32]; + /* Filter parameters */ + for(j = 0; j < pline->filter[i].cd_nelmts; j++) { + char field_name[32]; - HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); - HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), - field_name, - pline->filter[i].cd_values[j]); - } /* end for */ + HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); + HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), + field_name, + pline->filter[i].cd_values[j]); + } /* end for */ } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) |