diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-02-18 12:16:27 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-02-18 12:16:27 (GMT) |
commit | 5655953a2adcdcfe2f0d5599a52d36fbea405817 (patch) | |
tree | 352bf3ad7afc1b1277ad9218c33c8ad3aa06f852 /src/H5Z.c | |
parent | 7ff7845b3a18a3e32fbf84f089f4a01ba9329274 (diff) | |
download | hdf5-5655953a2adcdcfe2f0d5599a52d36fbea405817.zip hdf5-5655953a2adcdcfe2f0d5599a52d36fbea405817.tar.gz hdf5-5655953a2adcdcfe2f0d5599a52d36fbea405817.tar.bz2 |
[svn-r6415] Purpose:
Code cleanup
Description:
Changed hard-coded magic number (32) for the maximum number of filters
in a filter pipeline to use a symbolic constant (H5Z_MAX_NFILTERS)
instead. This limit could (and probably should) be removed to allow an
unlimited number of filters in a pipeline.
Platforms tested:
FreeBSD 4.7 (sleipnir)
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 35 |
1 files changed, 21 insertions, 14 deletions
@@ -1,20 +1,27 @@ -/* - * Copyright (C) 1998-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> - * Thursday, April 16, 1998 - * - * Purpose: Functions for data filters. - */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" #include "H5Oprivate.h" #include "H5Zprivate.h" -/* Interface initialization */ +/* Pablo mask */ #define PABLO_MASK H5Z_mask + +/* Interface initialization */ #define INTERFACE_INIT H5Z_init_interface static int interface_initialize_g = 0; static herr_t H5Z_init_interface (void); @@ -215,7 +222,7 @@ H5Z_register (H5Z_filter_t id, const char *comment, H5Z_func_t func) } if (i>=H5Z_table_used_g) { if (H5Z_table_used_g>=H5Z_table_alloc_g) { - size_t n = MAX(32, 2*H5Z_table_alloc_g); + size_t n = MAX(H5Z_MAX_NFILTERS, 2*H5Z_table_alloc_g); H5Z_class_t *table = H5MM_realloc(H5Z_table_g, n*sizeof(H5Z_class_t)); if (!table) @@ -394,13 +401,13 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * Check filter limit. We do it here for early warnings although we may * decide to relax this restriction in the future. */ - if (pline->nfilters>=32) + if (pline->nfilters>=H5Z_MAX_NFILTERS) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline"); /* Allocate additional space in the pipeline if it's full */ if (pline->nfilters>=pline->nalloc) { H5O_pline_t x; - x.nalloc = MAX(32, 2*pline->nalloc); + x.nalloc = MAX(H5Z_MAX_NFILTERS, 2*pline->nalloc); x.filter = H5MM_realloc(pline->filter, x.nalloc*sizeof(x.filter[0])); if (NULL==x.filter) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline"); @@ -516,7 +523,7 @@ H5Z_pipeline(H5F_t UNUSED *f, const H5O_pline_t *pline, unsigned flags, assert(nbytes && *nbytes>0); assert(buf_size && *buf_size>0); assert(buf && *buf); - assert(!pline || pline->nfilters<32); + assert(!pline || pline->nfilters<H5Z_MAX_NFILTERS); if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ for (i=pline->nfilters; i>0; --i) { |