VirtualBox

Changeset 113 in kStuff


Ignore:
Timestamp:
Jul 12, 2018 11:34:27 AM (7 years ago)
Author:
bird
Message:

kHlpInt2Ascii.c: Try make cppcheck happy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kHlp/Generic/kHlpInt2Ascii.c

    r29 r113  
    4949    char *pszRet = psz;
    5050
    51     if (cch >= (lVal < 0 ? 3U : 2U) && psz)
     51    if (psz != NULL)
    5252    {
    53         /* prefix */
    54         if (lVal < 0)
     53        if (cch >= (lVal < 0 ? 3U : 2U))
    5554        {
    56             *psz++ = '-';
    57             cch--;
    58             lVal = -lVal;
     55            /* prefix */
     56            if (lVal < 0)
     57            {
     58                *psz++ = '-';
     59                cch--;
     60                lVal = -lVal;
     61            }
     62
     63            /* the digits */
     64            do
     65            {
     66                *psz++ = s_szDigits[lVal % iBase];
     67                cch--;
     68                lVal /= iBase;
     69            } while (lVal && cch > 1);
     70
     71            /* overflow indicator */
     72            if (lVal)
     73                psz[-1] = '+';
    5974        }
    60 
    61         /* the digits */
    62         do
    63         {
    64             *psz++ = s_szDigits[lVal % iBase];
    65             cch--;
    66             lVal /= iBase;
    67         } while (lVal && cch > 1);
    68 
    69         /* overflow indicator */
    70         if (lVal)
    71             psz[-1] = '+';
     75        else if (cch > 1)
     76            *psz++ = '+';
     77        else if (cch < 1)
     78            return pszRet;
     79        *psz = '\0';
    7280    }
    73     else if (!pszRet)
    74         return pszRet;
    75     else if (cch < 1 || !pszRet)
    76         return pszRet;
    77     else
    78         *psz++ = '+';
    79     *psz = '\0';
    80 
    8181    return pszRet;
    8282}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette