./src/H5Osdim.c -> H5Osdspace.c ./src/Makefile.in Changed the names of these files to better reflect what they actually do. ./src/H5.c ./src/H5AC.c ./src/H5B.c ./src/H5C.c ./src/H5D.c ./src/H5E.c ./src/H5Eprivate.h ./src/H5Epublic.h ./src/H5F.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gshad.c ./src/H5Gstab.c ./src/H5H.c ./src/H5M.c ./src/H5MF.c ./src/H5O.c ./src/H5Osdtyp.c (./src/H5Odtype.c) ./src/H5P.c ./src/H5T.c ./src/H5detect.c ./src/H5private.h Added an argument to the HRETURN_ERROR(), HGOTO_ERROR(), and HERROR() macros which is a string error message. This allows us to give extra information which can't be represented by the major and minor error numbers. This information was previously in comments just before or after the macro call. The string isn't currently used, but I'm planning to change the test files so they print an error trace when something fails. This should make debugging a little faster since it's often obvious what's wrong if we could just see the error stack without even having to start a debugger.
134 lines
3.9 KiB
C
134 lines
3.9 KiB
C
/****************************************************************************
|
|
* NCSA HDF *
|
|
* Software Development Group *
|
|
* National Center for Supercomputing Applications *
|
|
* University of Illinois at Urbana-Champaign *
|
|
* 605 E. Springfield, Champaign IL 61820 *
|
|
* *
|
|
* For conditions of distribution and use, see the accompanying *
|
|
* hdf/COPYING file. *
|
|
* *
|
|
****************************************************************************/
|
|
|
|
#ifdef RCSID
|
|
static char RcsId[] = "@(#)$Revision$";
|
|
#endif
|
|
|
|
/* $Id$ */
|
|
|
|
/*LINTLIBRARY */
|
|
/*+
|
|
FILE
|
|
H5Dconv.c
|
|
HDF5 trivial datatype converion routines
|
|
|
|
EXPORTED ROUTINES
|
|
|
|
LIBRARY-SCOPED ROUTINES
|
|
|
|
LOCAL ROUTINES
|
|
+ */
|
|
|
|
#include <H5private.h> /* Generic Functions */
|
|
#include <H5Dprivate.h> /* Dataset functions */
|
|
#include <H5Eprivate.h> /* Error handling */
|
|
|
|
#define PABLO_MASK H5D_mask
|
|
|
|
/*--------------------- Locally scoped variables -----------------------------*/
|
|
|
|
/* Interface initialization */
|
|
static intn interface_initialize_g = FALSE;
|
|
#define INTERFACE_INIT NULL
|
|
|
|
/*--------------------------------------------------------------------------
|
|
NAME
|
|
H5D_convert_buf
|
|
PURPOSE
|
|
Byte-Swap a buffer of data
|
|
USAGE
|
|
herr_t H5D_convert_buf(dst, src, len, size)
|
|
VOIDP dst; OUT: Buffer to fill with converted data
|
|
VOIDP src; IN: Buffer to converted data from
|
|
uintn len; IN: Number of bytes to convert
|
|
uintn size; IN: Size of quantity to byte-swap
|
|
RETURNS
|
|
SUCCEED/FAIL
|
|
DESCRIPTION
|
|
This function is a byte-swapping memcpy.
|
|
--------------------------------------------------------------------------*/
|
|
herr_t H5D_convert_buf(void *dst, const void *src, uintn len, uintn size)
|
|
{
|
|
const char *s=(const char *)src;
|
|
char *d=(char *)dst;
|
|
herr_t ret_value = SUCCEED;
|
|
|
|
FUNC_ENTER(H5D_convert_buf, FAIL);
|
|
|
|
/* Clear errors and check args and all the boring stuff. */
|
|
H5ECLEAR;
|
|
assert(dst);
|
|
assert(src);
|
|
assert(len>0);
|
|
assert(size==8 || size==4 || size==2 || size==1);
|
|
|
|
switch(size)
|
|
{
|
|
case 1: /* straight memcpy() */
|
|
HDmemcpy(d,s,len);
|
|
break;
|
|
|
|
case 2: /* 2-byte swapping */
|
|
while(len>0)
|
|
{
|
|
*d++=*(s+1);
|
|
*d++=*s;
|
|
s+=2;
|
|
len-=2;
|
|
} /* end while */
|
|
break;
|
|
|
|
case 4: /* 4-byte swapping */
|
|
while(len>0)
|
|
{
|
|
*d++=*(s+3);
|
|
*d++=*(s+2);
|
|
*d++=*(s+1);
|
|
*d++=*s;
|
|
s+=4;
|
|
len-=4;
|
|
} /* end while */
|
|
break;
|
|
|
|
case 8: /* 8-byte swapping */
|
|
while(len>0)
|
|
{
|
|
*d++=*(s+7);
|
|
*d++=*(s+6);
|
|
*d++=*(s+5);
|
|
*d++=*(s+4);
|
|
*d++=*(s+3);
|
|
*d++=*(s+2);
|
|
*d++=*(s+1);
|
|
*d++=*s;
|
|
s+=8;
|
|
len-=8;
|
|
} /* end while */
|
|
break;
|
|
|
|
default:
|
|
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL,
|
|
"not implemented yet");
|
|
} /* end switch */
|
|
|
|
done:
|
|
if(ret_value == FAIL)
|
|
{ /* Error condition cleanup */
|
|
|
|
} /* end if */
|
|
|
|
/* Normal function cleanup */
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
} /* end H5D_convert_buf() */
|