Skip to content

Commit

Permalink
Improve compiling on Ubuntu (#753)
Browse files Browse the repository at this point in the history
# Description
Fixed a few issues when compiling on ubuntu:
- Ensure that the format string of snprintf() is literal (removes a
warning)
- Do not test image plugin if scikit-image (skimage) is not installed


## Type of change
- [x] Bug fix & code cleanup
- [ ] New feature
- [ ] Documentation update
- [ ] Test update

## Checklist for the reviewer
This checklist should be used as a help for the reviewer.

- [ ] Is the change limited to one issue?
- [ ] Does this PR close the issue?
- [ ] Is the code easy to read and understand?
- [ ] Do all new feature have an accompanying new test?
- [ ] Has the documentation been updated as necessary?
  • Loading branch information
jesper-friis authored Dec 27, 2023
2 parents 05e82b5 + a088049 commit 747fbaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dlite-entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -3066,18 +3066,18 @@ static int writedim(int d, char *dest, size_t n, const void **pptr,
char *sep = (compact) ? ", " : ",\n ";
char *end = (compact) ? "]" : "\n ]";
if (d < p->ndims) {
if ((m = snprintf(dest+N, PDIFF(n, N), start)) < 0) goto fail;
if ((m = snprintf(dest+N, PDIFF(n, N), "%s", start)) < 0) goto fail;
N += m;
for (i=0; i < dims[d]; i++) {
if ((m = writedim(d+1, dest+N, PDIFF(n, N), pptr, p, dims,
width, prec, flags)) < 0) return -1;
N += m;
if (i < dims[d]-1) {
if ((m = snprintf(dest+N, PDIFF(n, N), sep)) < 0) goto fail;
if ((m = snprintf(dest+N, PDIFF(n, N), "%s", sep)) < 0) goto fail;
N += m;
}
}
if ((m = snprintf(dest+N, PDIFF(n, N), end)) < 0) goto fail;
if ((m = snprintf(dest+N, PDIFF(n, N), "%s", end)) < 0) goto fail;
N += m;
} else {
if ((m = dlite_type_print(dest+N, PDIFF(n, N), *pptr, p->type, p->size,
Expand Down
6 changes: 6 additions & 0 deletions storages/python/tests-python/test_image.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import sys
from pathlib import Path

import dlite

try:
import skimage
except ImportError:
sys.exit(44) # skip test


thisdir = Path(__file__).absolute().parent
indir = thisdir / 'input'
Expand Down

0 comments on commit 747fbaa

Please sign in to comment.