Chore: introduce macro ARRAY_SIZE

This commit is contained in:
李通洲
2024-10-18 16:15:48 +08:00
parent 5497cb64c2
commit b257134d74
67 changed files with 142 additions and 135 deletions
+3 -3
View File
@@ -146,9 +146,9 @@ void ffPrintDisplay(FFDisplayOptions* options)
if(result->refreshRate > 0)
{
if(options->preciseRefreshRate)
snprintf(refreshRate, sizeof(refreshRate), "%g", ((int) (result->refreshRate * 1000 + 0.5)) / 1000.0);
snprintf(refreshRate, ARRAY_SIZE(refreshRate), "%g", ((int) (result->refreshRate * 1000 + 0.5)) / 1000.0);
else
snprintf(refreshRate, sizeof(refreshRate), "%i", (uint32_t) (result->refreshRate + 0.5));
snprintf(refreshRate, ARRAY_SIZE(refreshRate), "%i", (uint32_t) (result->refreshRate + 0.5));
}
else
refreshRate[0] = 0;
@@ -157,7 +157,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
if (result->serial)
{
const uint8_t* nums = (uint8_t*) &result->serial;
snprintf(buf, sizeof(buf), "%2X-%2X-%2X-%2X", nums[0], nums[1], nums[2], nums[3]);
snprintf(buf, ARRAY_SIZE(buf), "%2X-%2X-%2X-%2X", nums[0], nums[1], nums[2], nums[3]);
}
else
buf[0] = '\0';