mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
Fix JNI bug, fix warnings noticed in MSVC CI, be modern & portable (#1480)
This commit is contained in:
parent
b9470be379
commit
1fb3743f04
@ -813,7 +813,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
|
|||||||
if (NULL == (this_str = (char *)HDmalloc(this_len)))
|
if (NULL == (this_str = (char *)HDmalloc(this_len)))
|
||||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
|
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
|
||||||
|
|
||||||
if (HDsnprintf(this_str, "%g", this_len, tmp_double) < 0)
|
if (HDsnprintf(this_str, this_len, "%g", tmp_double) < 0)
|
||||||
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
|
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1160,11 +1160,11 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
|
|||||||
|
|
||||||
H5Otoken_to_str(tid, &oi.token, &token_str);
|
H5Otoken_to_str(tid, &oi.token, &token_str);
|
||||||
|
|
||||||
size_t this_len = 64 + strlen(token_str) + 1;
|
size_t that_len = 64 + strlen(token_str) + 1;
|
||||||
if (NULL == (this_str = (char *)HDmalloc(this_len)))
|
if (NULL == (this_str = HDmalloc(that_len)))
|
||||||
H5_OUT_OF_MEMORY_ERROR(
|
H5_OUT_OF_MEMORY_ERROR(
|
||||||
ENVONLY, "h5str_sprintf: failed to allocate string buffer");
|
ENVONLY, "h5str_sprintf: failed to allocate string buffer");
|
||||||
if (HDsnprintf(this_str, this_len, "%lu:%s", oi.fileno, token_str) <
|
if (HDsnprintf(this_str, that_len, "%lu:%s", oi.fileno, token_str) <
|
||||||
0)
|
0)
|
||||||
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
|
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
|
||||||
|
|
||||||
|
@ -393,8 +393,8 @@ static const unsigned char LogTable256[] = {
|
|||||||
static inline unsigned H5_ATTR_UNUSED
|
static inline unsigned H5_ATTR_UNUSED
|
||||||
H5VM_log2_gen(uint64_t n)
|
H5VM_log2_gen(uint64_t n)
|
||||||
{
|
{
|
||||||
unsigned r; /* r will be log2(n) */
|
unsigned r; /* r will be log2(n) */
|
||||||
register unsigned int t, tt, ttt; /* temporaries */
|
unsigned int t, tt, ttt; /* temporaries */
|
||||||
|
|
||||||
if ((ttt = (unsigned)(n >> 32)))
|
if ((ttt = (unsigned)(n >> 32)))
|
||||||
if ((tt = (unsigned)(n >> 48)))
|
if ((tt = (unsigned)(n >> 48)))
|
||||||
|
@ -862,7 +862,7 @@ H5_nanosleep(uint64_t nanosec)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
const uint64_t nanosec_per_sec = 1000 * 1000 * 1000;
|
const uint64_t nanosec_per_sec = 1000 * 1000L * 1000;
|
||||||
struct timespec sleeptime; /* Struct to hold time to sleep */
|
struct timespec sleeptime; /* Struct to hold time to sleep */
|
||||||
|
|
||||||
/* Set up time to sleep
|
/* Set up time to sleep
|
||||||
@ -1033,7 +1033,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
|
|||||||
HDfree(arg);
|
HDfree(arg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
register char *cp; /* pointer into current token */
|
char *cp; /* pointer into current token */
|
||||||
|
|
||||||
/* short command line option */
|
/* short command line option */
|
||||||
optchar = argv[H5_optind][sp];
|
optchar = argv[H5_optind][sp];
|
||||||
|
@ -166,8 +166,7 @@ test_non_extendible(hid_t file)
|
|||||||
if (file_size != (max_size[0] * sizeof(int))) {
|
if (file_size != (max_size[0] * sizeof(int))) {
|
||||||
H5_FAILED();
|
H5_FAILED();
|
||||||
HDputs(" Wrong file size.");
|
HDputs(" Wrong file size.");
|
||||||
HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size,
|
HDprintf(" got: %" PRIuHSIZE "\n ans: %" PRIuHSIZE "\n", file_size, max_size[0] * sizeof(int));
|
||||||
(unsigned long)max_size[0] * sizeof(int));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,11 +985,11 @@ test_path_absolute(hid_t fapl)
|
|||||||
if (NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
|
if (NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
|
||||||
TEST_ERROR
|
TEST_ERROR
|
||||||
for (i = 0; i < N_EXT_FILES; i++) {
|
for (i = 0; i < N_EXT_FILES; i++) {
|
||||||
HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath, H5_DIR_SEPS, (int)i + 1);
|
HDsnprintf(filename, sizeof(filename), "%s%sextern_%zur.raw", cwdpath, H5_DIR_SEPS, i + 1);
|
||||||
#if defined(H5_HAVE_WINDOW_PATH)
|
#if defined(H5_HAVE_WINDOW_PATH)
|
||||||
/* For windows, test path-absolute case (\dir\file.raw) for the second file */
|
/* For windows, test path-absolute case (\dir\file.raw) for the second file */
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
|
HDsnprintf(filename, sizeof(filename), "%s%sextern_%zur.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
|
||||||
#endif
|
#endif
|
||||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||||
FAIL_STACK_ERROR
|
FAIL_STACK_ERROR
|
||||||
|
Loading…
Reference in New Issue
Block a user