Skip to content

Commit

Permalink
Update functions.sh: Don't output obvious message
Browse files Browse the repository at this point in the history
Also rename a variable so it better reflects what it is, and shorten a message.
  • Loading branch information
EricClaeys authored Jan 22, 2025
1 parent 58c2b60 commit 5839465
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ function checkPixelValue()
# Assume each number has already been checked, e.g., it's not a string.
function checkWidthHeight()
{
local NAME="${1}"
local NAME_PREFIX="${1}"
local ITEM="${2}"
local WIDTH="${3}"
local HEIGHT="${4}"
Expand All @@ -776,20 +776,22 @@ function checkWidthHeight()

# Width and height must both be 0 or non-zero.
if [[ (${WIDTH} -gt 0 && ${HEIGHT} -eq 0) || (${WIDTH} -eq 0 && ${HEIGHT} -gt 0) ]]; then
ERR+="${WSNs}${NAME} Width${WSNe} (${WSVs}${WIDTH}${WSVe})"
ERR+=" and ${WSNs}${NAME} Height${WSNe} (${WSVs}${HEIGHT}${WSVe})"
ERR+="${WSNs}${NAME_PREFIX} Width${WSNe} (${WSVs}${WIDTH}${WSVe})"
ERR+=" and ${WSNs}Height${WSNe} (${WSVs}${HEIGHT}${WSVe})"
ERR+=" must both be either 0 or non-zero.\n"
ERR+="The ${ITEM} will NOT be resized since it would look unnatural.\n"
ERR+="FIX: Either set both numbers to 0 to not resize,"
ERR+=" or set both numbers to something greater than 0."
#x isn't the FIX obvious given the error message?
#x ERR+="FIX: Either set both numbers to 0 to not resize,"
#x ERR+=" or set both numbers to something greater than 0."

elif [[ ${WIDTH} -gt 0 && ${HEIGHT} -gt 0 &&
${SENSOR_WIDTH} -eq ${WIDTH} && ${SENSOR_HEIGHT} -eq ${HEIGHT} ]]; then
ERR+="Resizing a ${ITEM} to the same size as the sensor does nothing useful.\n"
ERR+="FIX: Check ${WSNs}${NAME} Width${WSNe} (${WIDTH}) and"
ERR+=" ${WSNs}${NAME} Height${WSNe} (${HEIGHT})"
ERR+=" and set them to something other than the sensor size"
ERR+=" (${WSVs}${SENSOR_WIDTH} x ${SENSOR_HEIGHT}${WSVe})."
#x isn't the FIX obvious given the error message?
#x ERR+="FIX: Check ${WSNs}${NAME_PREFIX} Width${WSNe} (${WIDTH}) and"
#x ERR+=" ${WSNs}Height${WSNe} (${HEIGHT})"
#x ERR+=" and set them to something other than the sensor size"
#x ERR+=" (${WSVs}${SENSOR_WIDTH} x ${SENSOR_HEIGHT}${WSVe})."
fi

[[ -z ${ERR} ]] && return 0
Expand Down

0 comments on commit 5839465

Please sign in to comment.