Skip to content

Commit e90a0ed

Browse files
authored
fixed remaining codeql issues (#38)
* fixed remaining codeql issues * clang-format update
1 parent fddc059 commit e90a0ed

3 files changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/clang-format-check.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
name: clang-format Check
22
on:
33
pull_request:
4+
45
jobs:
56
formatting-check:
67
name: Formatting Check
78
runs-on: ubuntu-latest
89
if: "!contains(github.event.head_commit.message, 'skip-ci')"
910
steps:
10-
- uses: actions/checkout@v4.1.1
11+
- uses: actions/checkout@v4.1.7
12+
1113
- name: Run clang-format style check for C programs.
12-
uses: DoozyX/clang-format-lint-action@v0.14
14+
uses: DoozyX/clang-format-lint-action@v0.18.2
1315
with:
1416
source: '.'
1517
extensions: 'c,h,cpp,hpp'

.github/workflows/clang-format-fix.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
1-
name: clang-format Check
1+
# NOTE: This action requires write permissions to be set in your GitHub
2+
# repo/fork for it to be able to commit changes.
3+
#
4+
# This is currently enabled via:
5+
#
6+
# settings > Actions > General > Workflow permissions
7+
#
8+
# which you will need to set to "Read and write permissions"
9+
#
10+
name: clang-format Commit Changes
211
on:
312
workflow_dispatch:
413
push:
14+
15+
permissions:
16+
contents: read
17+
518
jobs:
619
formatting-check:
7-
name: Formatting Check
20+
name: Commit Format Changes
821
runs-on: ubuntu-latest
922
if: "!contains(github.event.head_commit.message, 'skip-ci')"
23+
permissions:
24+
contents: write # In order to allow EndBug/add-and-commit to commit changes
1025
steps:
11-
- uses: actions/checkout@v4.1.1
26+
- uses: actions/checkout@v4.1.7
27+
1228
- name: Run clang-format style check for C programs.
13-
uses: DoozyX/clang-format-lint-action@v0.14
29+
uses: DoozyX/clang-format-lint-action@v0.18.2
1430
with:
1531
source: '.'
1632
extensions: 'c,h,cpp,hpp'
1733
clangFormatVersion: 10
1834
inplace: True
1935
style: file
2036
# exclude: './config '
21-
- uses: EndBug/add-and-commit@v7
37+
38+
- uses: EndBug/add-and-commit@v9.1.3
2239
with:
2340
author_name: github-actions
2441
author_email: github-actions[bot]@users.noreply.github.com

src/H5LS.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ herr_t readLSConf(char *fname, cache_storage_t *LS) {
187187
if (get_replacement_policy_from_str(mac) > 0)
188188
LS->replacement_policy = get_replacement_policy_from_str(mac);
189189
} else {
190-
LOG_WARN(-1, "Unknown configuration setup:", ip);
190+
snprintf(error_msg, ERROR_MSG_SIZE, "Unknown configuration setup: %s",
191+
ip);
192+
LOG_WARN(-1, "%s", error_msg);
191193
}
192194
}
193195
if (LS->mspace_total < LS->write_buffer_size) {
@@ -202,7 +204,7 @@ herr_t readLSConf(char *fname, cache_storage_t *LS) {
202204
struct stat sb;
203205
if (strcmp(LS->type, "GPU") == 0 || strcmp(LS->type, "MEMORY") == 0 ||
204206
(stat(LS->path, &sb) == 0 && S_ISDIR(sb.st_mode))) {
205-
return 0;
207+
return SUCCEED;
206208
} else {
207209
int ret = snprintf(error_msg, ERROR_MSG_SIZE,
208210
"H5LSset: path %s does not exist\n", LS->path);
@@ -212,6 +214,7 @@ herr_t readLSConf(char *fname, cache_storage_t *LS) {
212214
LOG_ERROR(-1, "%s", error_msg);
213215
MPI_Abort(MPI_COMM_WORLD, 112);
214216
}
217+
return SUCCEED;
215218
}
216219

217220
/*-------------------------------------------------------------------------
@@ -295,14 +298,15 @@ herr_t H5LSset(cache_storage_t *LS, char *type, char *path,
295298
struct stat sb;
296299
if (strcmp(type, "GPU") == 0 || strcmp(type, "MEMORY") == 0 ||
297300
(stat(path, &sb) == 0 && S_ISDIR(sb.st_mode))) {
298-
return 0;
301+
return SUCCEED;
299302
} else {
300303
LOG_ERROR(-1,
301304
"ERROR in name space for cache storage: %s does "
302305
"not exist\n",
303306
path);
304307
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
305308
}
309+
return SUCCEED;
306310
} /* end H5LSset */
307311

308312
/*-------------------------------------------------------------------------
@@ -451,7 +455,7 @@ herr_t H5LSclaim_space(cache_storage_t *LS, hsize_t size, cache_claim_t type,
451455
}
452456
}
453457

454-
return 0;
458+
return SUCCEED;
455459
}
456460

457461
/*-------------------------------------------------------------------------
@@ -490,7 +494,7 @@ herr_t H5LSremove_cache(cache_storage_t *LS, cache_t *cache) {
490494
#ifndef NDEBUG
491495
LOG_INFO(-1, "H5LSremove_space DONE");
492496
#endif
493-
return 0;
497+
return SUCCEED;
494498
} /* end H5LSremove_cache() */
495499

496500
/*-------------------------------------------------------------------------

0 commit comments

Comments
 (0)