mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-03 10:06:01 +01:00
resolve major compiler warnings produced by distutils
This commit is contained in:
parent
171cf1662b
commit
9f4176a8b6
@ -12,7 +12,7 @@ pytrexio_module = Extension('_pytrexio',
|
||||
include_dirs=['/usr/include/hdf5/serial'],
|
||||
#runtime_library_dirs=['/usr/lib/x86_64-linux-gnu/hdf5/serial'],
|
||||
libraries=['hdf5', 'hdf5_hl'],
|
||||
#extra_compile_args=['-I/usr/include/hdf5/serial'],
|
||||
extra_compile_args=['-Wno-discarded-qualifiers'],
|
||||
extra_link_args=['-L/usr/lib/x86_64-linux-gnu/hdf5/serial']
|
||||
)
|
||||
|
||||
|
@ -545,6 +545,10 @@ trexio_open(const char* file_name, const char mode,
|
||||
result->mode = mode;
|
||||
result->one_based = false; // Need to be flipped in Fortran interface
|
||||
int irc = pthread_mutex_init ( &(result->thread_lock), NULL);
|
||||
if (irc != 0) {
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
assert (irc == 0);
|
||||
|
||||
trexio_exit_code rc;
|
||||
@ -1717,7 +1721,7 @@ trexio_read_$group_dset$ (trexio_t* const file, char** dset_out, const uint32_t
|
||||
}
|
||||
|
||||
char * pch;
|
||||
for (uint64_t i=0; i < dset_dim; i++) {
|
||||
for (uint64_t i=0; i < (uint64_t) dset_dim; i++) {
|
||||
|
||||
pch = i == 0 ? strtok(str_compiled, TREXIO_DELIM) : strtok(NULL, TREXIO_DELIM) ;
|
||||
if (pch == NULL) {
|
||||
@ -1777,7 +1781,7 @@ trexio_write_$group_dset$_low (trexio_t* const file, const char* dset_in, const
|
||||
return TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
pch_len = strlen(pch);
|
||||
pch_len = strlen(pch) + 1;
|
||||
|
||||
if (pch_len > max_str_len) {
|
||||
FREE(dset_str[0]);
|
||||
@ -1837,7 +1841,7 @@ trexio_write_$group_dset$ (trexio_t* const file, const char** dset_in, const uin
|
||||
if (str_compiled == NULL) return TREXIO_ALLOCATION_FAILED;
|
||||
|
||||
strcpy(str_compiled, "");
|
||||
for (uint64_t i=0; i < dset_dim; i++) {
|
||||
for (uint64_t i=0; i < (uint64_t) dset_dim; i++) {
|
||||
strcat(str_compiled, dset_in[i]);
|
||||
strcat(str_compiled, TREXIO_DELIM);
|
||||
}
|
||||
@ -1994,8 +1998,6 @@ trexio_read_$group_str$ (trexio_t* const file, char* const str, const uint32_t m
|
||||
if (str == NULL) return TREXIO_INVALID_ARG_2;
|
||||
if (max_str_len <= 0) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
trexio_exit_code rc = TREXIO_FAILURE;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
case TREXIO_TEXT:
|
||||
|
@ -456,8 +456,6 @@ trexio_text_read_$group$ (trexio_text_t* const file)
|
||||
}
|
||||
// END REPEAT GROUP_DSET_NUM
|
||||
|
||||
size_t tmp_len;
|
||||
|
||||
// START REPEAT GROUP_DSET_STR
|
||||
/* Allocate arrays */
|
||||
$group$->$group_dset$ = CALLOC(size_$group_dset$, $group_dset_dtype$);
|
||||
@ -485,7 +483,8 @@ trexio_text_read_$group$ (trexio_text_t* const file)
|
||||
,*/
|
||||
char* tmp_$group_dset$;
|
||||
if(size_$group_dset$ != 0) tmp_$group_dset$ = CALLOC(size_$group_dset$*32, char);
|
||||
tmp_len = 0;
|
||||
|
||||
size_t tmp_$group_dset$_len = 0;
|
||||
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
|
||||
$group$->$group_dset$[i] = tmp_$group_dset$;
|
||||
/* conventional fcanf with "%s" only return the string before the first space character
|
||||
@ -501,8 +500,8 @@ trexio_text_read_$group$ (trexio_text_t* const file)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmp_len = strlen($group$->$group_dset$[i]);
|
||||
tmp_$group_dset$ += tmp_len + 1;
|
||||
tmp_$group_dset$_len = strlen($group$->$group_dset$[i]);
|
||||
tmp_$group_dset$ += tmp_$group_dset$_len + 1;
|
||||
}
|
||||
// END REPEAT GROUP_DSET_STR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user