Skip to content

Commit

Permalink
Fix validation errors (#417)
Browse files Browse the repository at this point in the history
* Change Metadata.ValueNotNulTerminated to warning.

* Fix typo in KTXmetalPixelFormat key.
  • Loading branch information
MarkCallow authored May 5, 2021
1 parent 6a38a06 commit 78cd2b0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/ktx2check/ktx2check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ struct {
ERROR | 0x0087, "Unrecognized metadata \"%s\" found with KTX or ktx prefix found."
};
issue ValueNotNulTerminated {
ERROR | 0x0088, "%s value missing required NUL termination."
WARNING | 0x0088, "%s value missing encouraged NUL termination."
};
issue InvalidValue {
ERROR | 0x0089, "%s has invalid value."
Expand Down Expand Up @@ -748,7 +748,7 @@ vector<ktxValidator::metadataValidator> ktxValidator::metadataValidators {
{ "KTXorientation", &ktxValidator::validateOrientation },
{ "KTXglFormat", &ktxValidator::validateGlFormat },
{ "KTXdxgiFormat__", &ktxValidator::validateDxgiFormat },
{ "KTXMetalPixelFormat", &ktxValidator::validateMetalPixelFormat },
{ "KTXmetalPixelFormat", &ktxValidator::validateMetalPixelFormat },
{ "KTXswizzle", &ktxValidator::validateSwizzle },
{ "KTXwriter", &ktxValidator::validateWriter },
{ "KTXwriterScParams", &ktxValidator::validateWriterScParams },
Expand Down Expand Up @@ -1638,7 +1638,7 @@ ktxValidator::validateOrientation(validationContext& ctx, char* key,
}

if (value[valueLen-1] != '\0')
addIssue(logger::eError, Metadata.ValueNotNulTerminated, key);
addIssue(logger::eWarning, Metadata.ValueNotNulTerminated, key);

if (valueLen != ctx.dimensionCount + 1)
addIssue(logger::eError, Metadata.InvalidValue, key);
Expand Down Expand Up @@ -1687,7 +1687,7 @@ ktxValidator::validateSwizzle(validationContext& ctx, char* key,
uint8_t* value, uint32_t valueLen)
{
if (value[valueLen-1] != '\0')
addIssue(logger::eError, Metadata.ValueNotNulTerminated, key);
addIssue(logger::eWarning, Metadata.ValueNotNulTerminated, key);
if (!regex_match((char*)value, regex("^[rgba01]{4}$")))
addIssue(logger::eError, Metadata.InvalidValue, key);
}
Expand All @@ -1697,15 +1697,15 @@ ktxValidator::validateWriter(validationContext& ctx, char* key,
uint8_t* value, uint32_t valueLen)
{
if (value[valueLen-1] != '\0')
addIssue(logger::eError, Metadata.ValueNotNulTerminated, key);
addIssue(logger::eWarning, Metadata.ValueNotNulTerminated, key);
}

void
ktxValidator::validateWriterScParams(validationContext& ctx, char* key,
uint8_t* value, uint32_t valueLen)
{
if (value[valueLen-1] != '\0')
addIssue(logger::eError, Metadata.ValueNotNulTerminated, key);
addIssue(logger::eWarning, Metadata.ValueNotNulTerminated, key);
}

void
Expand Down

0 comments on commit 78cd2b0

Please sign in to comment.