Skip to content

Commit

Permalink
codeql/cpp-wrong-type-format-argument (#173)
Browse files Browse the repository at this point in the history
fixes codeql/cpp/wrong-type-format-argument issues
  • Loading branch information
michaeldsmith authored Jan 25, 2025
1 parent 470d9f3 commit b96ab2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/IlmCtl/CtlType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ void Type::childElementV(size_t *offset, TypePtr *type, const std::string path,
offsets=((SizeVector *)va_arg(ap, SizeVector *));
while(offsets->size()!=0) {
if(sizes.size()==0) {
throw(DatatypeExc("too many dimensions specified for matrix (or array) vector element (at least %d too many)", offsets->size()));
throw(DatatypeExc("too many dimensions specified for matrix (or array) vector element (at least %zu too many)", offsets->size()));
}
if(offset[0]>=sizes[0]) {
throw(DatatypeExc("out of range matrix (or array) vector element (%u>=%u)", offset[0], sizes[0]));
throw(DatatypeExc("out of range matrix (or array) vector element (%zu>=%zu)", offset[0], sizes[0]));
}
*offset=*offset+array_type->elementType()->objectSize()*((*offsets)[0]);
*type=array_type->elementType();
Expand All @@ -150,7 +150,7 @@ void Type::childElementV(size_t *offset, TypePtr *type, const std::string path,
}

if(u>=sizes[0]) {
throw(DatatypeExc("out of range matrix (or array) element specification (%u>=%u)", u, sizes[0]));
throw(DatatypeExc("out of range matrix (or array) element specification (%u>=%zu)", u, sizes[0]));
}

*offset=*offset+u*array_type->elementType()->objectSize();
Expand Down
4 changes: 2 additions & 2 deletions lib/IlmCtl/CtlTypeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void TypeStorage::_set(const char *src, CDataType_e src_type,
out=out+type()->objectSize();
}
} else {
throw(DatatypeExc("unexpected data objectSize (%d)", data_type->objectSize()));
throw(DatatypeExc("unexpected data objectSize (%zu)", data_type->objectSize()));
}
return;
}
Expand Down Expand Up @@ -547,7 +547,7 @@ void TypeStorage::_get(char *dst, CDataType_e dst_type,
in=in+type()->objectSize();
}
} else {
throw(DatatypeExc("unexpected data objectSize (%d)", data_type->objectSize()));
throw(DatatypeExc("unexpected data objectSize (%zu)", data_type->objectSize()));
}
return;
}
Expand Down

0 comments on commit b96ab2a

Please sign in to comment.