Ignore:
Timestamp:
Jan 12, 2003, 11:49:24 AM (23 years ago)
Author:
umoeller
Message:

Misc fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/stringh.c

    r238 r240  
    178178    *string1 = '\0';
    179179    return string1;
     180}
     181
     182/*
     183 *@@ strhCopyBuf:
     184 *      copies pcszSource to pszTarget, taking
     185 *      its length into account.
     186 *
     187 *      Returns:
     188 *
     189 *      --  NO_ERROR
     190 *
     191 *      --  ERROR_INVALID_PARAMETER: pcszSource is
     192 *          null or points to a null byte.
     193 *
     194 *      --  ERROR_FILENAME_EXCED_RANGE: pcszSource
     195 *          is too long to fit into pszTarget.
     196 *
     197 *@@added V1.0.1 (2003-01-05) [umoeller]
     198 */
     199
     200APIRET strhCopyBuf(PSZ pszTarget,
     201                   PCSZ pcszSource,
     202                   ULONG cbTarget)
     203{
     204    ULONG cb;
     205    if (!pcszSource || !*pcszSource)
     206        return ERROR_INVALID_PARAMETER;
     207    cb = strlen(pcszSource) + 1;
     208    if (cb > cbTarget)
     209        return ERROR_FILENAME_EXCED_RANGE;
     210
     211    memcpy(pszTarget,
     212           pcszSource,
     213           cb);
     214    return NO_ERROR;
    180215}
    181216
Note: See TracChangeset for help on using the changeset viewer.