summaryrefslogtreecommitdiff
path: root/expat
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2022-10-21 22:23:53 -0400
committerSean McBride <sean@rogue-research.com>2022-10-26 14:57:46 -0400
commitce15e2c21963b6f85bb34db0f414bc2b998a9b19 (patch)
tree65fa9bee674effc61d83cfa469b85e13dcbf71ce /expat
parente3c91d07709b5c16c1b74a9641c1de96c1e7b1f3 (diff)
downloadlibexpat-git-ce15e2c21963b6f85bb34db0f414bc2b998a9b19.tar.gz
Fixed cppcheck 2.9 warnings
The warnings were: variableScope,expat/tests/chardata.c:83,style,The scope of the variable 'buffer' can be reduced. constParameter,expat/tests/memcheck.c:85,style,Parameter 'ptr' can be declared as pointer to const variableScope,expat/tests/structdata.c:106,style,The scope of the variable 'i' can be reduced.
Diffstat (limited to 'expat')
-rw-r--r--expat/tests/chardata.c2
-rw-r--r--expat/tests/memcheck.c4
-rw-r--r--expat/tests/structdata.c3
3 files changed, 4 insertions, 5 deletions
diff --git a/expat/tests/chardata.c b/expat/tests/chardata.c
index d1989a84..d3a9784b 100644
--- a/expat/tests/chardata.c
+++ b/expat/tests/chardata.c
@@ -80,13 +80,13 @@ CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) {
int
CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) {
- char buffer[1024];
int len = xmlstrlen(expected);
int count;
assert(storage != NULL);
count = (storage->count < 0) ? 0 : storage->count;
if (len != count) {
+ char buffer[1024];
sprintf(buffer, "wrong number of data characters: got %d, expected %d",
count, len);
fail(buffer);
diff --git a/expat/tests/memcheck.c b/expat/tests/memcheck.c
index 48822e5d..b9ac6d07 100644
--- a/expat/tests/memcheck.c
+++ b/expat/tests/memcheck.c
@@ -49,7 +49,7 @@ typedef struct allocation_entry {
static AllocationEntry *alloc_head = NULL;
static AllocationEntry *alloc_tail = NULL;
-static AllocationEntry *find_allocation(void *ptr);
+static AllocationEntry *find_allocation(const void *ptr);
/* Allocate some memory and keep track of it. */
void *
@@ -82,7 +82,7 @@ tracking_malloc(size_t size) {
}
static AllocationEntry *
-find_allocation(void *ptr) {
+find_allocation(const void *ptr) {
AllocationEntry *entry;
for (entry = alloc_head; entry != NULL; entry = entry->next) {
diff --git a/expat/tests/structdata.c b/expat/tests/structdata.c
index d40e6c4b..9d27d4ea 100644
--- a/expat/tests/structdata.c
+++ b/expat/tests/structdata.c
@@ -103,7 +103,6 @@ void
StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
int count) {
char buffer[1024];
- int i;
assert(storage != NULL);
assert(expected != NULL);
@@ -113,7 +112,7 @@ StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
StructData_Dispose(storage);
fail(buffer);
} else {
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
const StructDataEntry *got = &storage->entries[i];
const StructDataEntry *want = &expected[i];