Changeset 2869 for trunk/kLdr/kLdrHlp.c


Ignore:
Timestamp:
Nov 12, 2006, 3:47:25 AM (19 years ago)
Author:
bird
Message:

the simple testcase works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrHlp.c

    r2867 r2869  
    386386 *
    387387 * @returns 0 on success.
    388  * @returns KLDR_ERR_BUFFER_OVERFLOW on if the buffer is too small (it'll be partially filled).
     388 * @returns KLDR_ERR_BUFFER_OVERFLOW on if the buffer is too small.
    389389 * @returns KLDR_ERR_SYMBOL_NOT_FOUND if not found. (Yeah, abusing the status code, but it's only internally...)
    390390 * @returns OS specfic status code on other error.
     
    407407            kLdrHlpMemCopy(pszVal, pszValue, cch + 1);
    408408        else
    409         {
    410409            rc = KLDR_ERR_BUFFER_OVERFLOW;
    411             if (cchVal > 1)
    412             {
    413                 kLdrHlpMemCopy(pszVal, pszValue, *pcchVal);
    414                 pszVal[*pcchVal - 1] = '\0';
    415             }
    416         }
    417410    }
    418411    else
     
    425418    SetLastError(0);
    426419    cch = GetEnvironmentVariable(pszVar, pszVal, cchVal);
    427     if (cch < cchVal)
     420    if (cch > 0 && cch < cchVal)
    428421        return 0;
    429422
     
    796789    const uint8_t *pb = (const uint8_t *)pv;
    797790    const uint8_t  b = (uint8_t)ch;
    798     while (cb)
     791    while (cb-- > 0)
    799792    {
    800793        if (*pb == b)
     
    811804    const uint8_t *pb1 = (const uint8_t *)pv1;
    812805    const uint8_t *pb2 = (const uint8_t *)pv2;
    813     while (cb)
     806    while (cb-- > 0)
    814807    {
    815808        if (*pb1 != *pb2)
Note: See TracChangeset for help on using the changeset viewer.