summaryrefslogtreecommitdiffstats
path: root/src/H5detect.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-11-21 22:25:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-11-21 22:25:46 (GMT)
commita20adf6924c76294b5005b2b699547d3201dbab8 (patch)
tree609c6ff757950c92232ab30d6126b4b01175083d /src/H5detect.c
parentb1439fa81031bd227b16c37027a07ab4e4c0f938 (diff)
downloadhdf5-a20adf6924c76294b5005b2b699547d3201dbab8.zip
hdf5-a20adf6924c76294b5005b2b699547d3201dbab8.tar.gz
hdf5-a20adf6924c76294b5005b2b699547d3201dbab8.tar.bz2
[svn-r23048] Description:
Bring r20456 from Coverity branch to trunk: fixed coverity 678, 679 Tested on: Mac OSX/64 10.8.2 (amazon) w/debug (too minor to require h5committest)
Diffstat (limited to 'src/H5detect.c')
-rw-r--r--src/H5detect.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/H5detect.c b/src/H5detect.c
index 87a4fd5..d6f6a3b 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -120,7 +120,7 @@ static void print_results(int nd, detected_t *d, int na, malign_t *m);
static void iprint(detected_t *);
static int byte_cmp(int, const void *, const void *);
static int bit_cmp(int, int *, volatile void *, volatile void *);
-static void fix_order(int, int, int, int *, const char **);
+static void fix_order(int, int, int *, const char **);
static int imp_bit(int, int *, volatile void *, volatile void *);
static unsigned long find_bias(int, int, int *, void *);
static void precision (detected_t*);
@@ -293,7 +293,7 @@ precision (detected_t *d)
#define DETECT_F(TYPE,VAR,INFO) { \
volatile TYPE _v1, _v2, _v3; \
unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \
- int _i, _j, _first = (-1), _last = (-1); \
+ int _i, _j, _last = (-1); \
char *_mesg; \
\
memset(&INFO, 0, sizeof(INFO)); \
@@ -315,15 +315,11 @@ precision (detected_t *d)
memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \
_j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \
if(_j >= 0) { \
- if(0 == _i || INFO.perm[_i - 1] != _j) { \
- INFO.perm[_i] = _j; \
- _last = _i; \
- if(_first < 0) \
- _first = _i; \
- } \
+ INFO.perm[_i] = _j; \
+ _last = _i; \
} \
} \
- fix_order(sizeof(TYPE), _first, _last, INFO.perm, (const char**)&_mesg); \
+ fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \
\
if(!strcmp(_mesg, "VAX")) \
INFO.is_vax = TRUE; \
@@ -973,11 +969,11 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b)
*-------------------------------------------------------------------------
*/
static void
-fix_order(int n, int first, int last, int *perm, const char **mesg)
+fix_order(int n, int last, int *perm, const char **mesg)
{
int i;
- if (first + 1 < last) {
+ if (last > 1) {
/*
* We have at least three points to consider.
*/
@@ -998,6 +994,9 @@ fix_order(int n, int first, int last, int *perm, const char **mesg)
} else {
/*
* Bi-endian machines like VAX.
+ * (NOTE: This is not an actual determination of the VAX-endianess.
+ * It could have some other endianess and fall into this
+ * case - JKM & QAK)
*/
assert(0 == n % 2);
if (mesg) *mesg = "VAX";