Ignore:
Timestamp:
Jul 8, 2002, 6:53:23 PM (23 years ago)
Author:
umoeller
Message:

Misc updates.

File:
1 edited

Legend:

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

    r154 r187  
    3434 *         iterative appends, you can pre-allocate memory to
    3535 *         avoid excessive reallocations.
     36 *
     37 *      These functions are also used internally by the
     38 *      WarpIN BSString class (and related classes).
    3639 *
    3740 *      Usage:
     
    139142{
    140143    memset(pxstr, 0, sizeof(XSTRING));
     144
    141145    if (ulPreAllocate)
    142146    {
     
    186190{
    187191    memset(pxstr, 0, sizeof(XSTRING));
     192
    188193    if (ulPreAllocate)
    189194    {
     
    362367    if (pxstr->psz)
    363368        free(pxstr->psz);
     369
    364370    memset(pxstr, 0, sizeof(XSTRING));
    365371}
     
    441447    // else: we have enough memory
    442448
    443     return (pxstr->cbAllocated);
     449    return pxstr->cbAllocated;
    444450}
    445451
     
    485491        xstrInit(pxstr, ulPreAllocate);
    486492
    487     return (pxstr);
     493    return pxstr;
    488494}
    489495
     
    542548{
    543549    if (!pxstr)
    544         return (0);         // V0.9.9 (2001-02-14) [umoeller]
     550        return 0;         // V0.9.9 (2001-02-14) [umoeller]
    545551
    546552    xstrClear(pxstr);
     
    556562    // else null string: cbAllocated and ulLength are 0 already
    557563
    558     return (pxstr->ulLength);
     564    return pxstr->ulLength;
    559565}
    560566
     
    570576              PSZ pszNew)                   // in: heap PSZ to use
    571577{
    572     return (xstrset2(pxstr, pszNew, 0));
     578    return xstrset2(pxstr, pszNew, 0);
    573579}
    574580
     
    621627
    622628ULONG xstrcpy(PXSTRING pxstr,               // in/out: string
    623               PCSZ pcszSource,       // in: source, can be NULL
     629              PCSZ pcszSource,              // in: source, can be NULL
    624630              ULONG ulSourceLength)         // in: length of pcszSource or 0
    625631{
    626632    if (!pxstr)
    627         return (0);         // V0.9.9 (2001-02-14) [umoeller]
     633        return 0;         // V0.9.9 (2001-02-14) [umoeller]
    628634
    629635    if (pcszSource)
     
    647653                   pcszSource,
    648654                   ulSourceLength);
    649             *(pxstr->psz + ulSourceLength) = '\0';
     655            pxstr->psz[ulSourceLength] = '\0';
    650656                    // V0.9.9 (2001-02-16) [umoeller]
    651657                    // we must do this or otherwise we require pcszSource
     
    670676    pxstr->ulLength = ulSourceLength;
    671677
    672     return (pxstr->ulLength);
     678    return pxstr->ulLength;
    673679}
    674680
     
    684690{
    685691    if (!pcstrSource)
    686         return (0);
    687 
    688     return (xstrcpy(pxstr, pcstrSource->psz, pcstrSource->ulLength));
     692        return 0;
     693
     694    return xstrcpy(pxstr, pcstrSource->psz, pcstrSource->ulLength);
    689695}
    690696
     
    758764                       ulSourceLength);
    759765
    760                 *(pxstr->psz + pxstr->ulLength + ulSourceLength) = '\0';
     766                pxstr->psz[pxstr->ulLength + ulSourceLength] = '\0';
    761767                        // V0.9.9 (2001-02-16) [umoeller]
    762768                        // we must do this or otherwise we require pcszSource
     
    774780    }
    775781
    776     return (ulrc);
     782    return ulrc;
    777783}
    778784
     
    816822    if ((pxstr) && (c))
    817823    {
    818         // ULONG   ulSourceLength = 1;
    819824        // 1) memory management
    820825        xstrReserve(pxstr,
     
    833838    } // end if ((pxstr) && (c))
    834839
    835     return (ulrc);
     840    return ulrc;
    836841}
    837842
     
    847852{
    848853    if (!pcstrSource)
    849         return (0);
    850 
    851     return (xstrcat(pxstr,
    852                     pcstrSource->psz,
    853                     pcstrSource->ulLength));
     854        return 0;
     855
     856    return xstrcat(pxstr,
     857                   pcstrSource->psz,
     858                   pcstrSource->ulLength);
    854859}
    855860
     
    10231028    } // end checks
    10241029
    1025     return (ulrc);
     1030    return ulrc;
    10261031}
    10271032
     
    10941099    }
    10951100
    1096     return (pReturn);
     1101    return pReturn;
    10971102}
    10981103
     
    12101215    } // end if ((pxstr) && (pstrSearch) && (pstrReplace))
    12111216
    1212     return (ulrc);
     1217    return ulrc;
    12131218}
    12141219
     
    12461251    xstrInitSet(&xstrReplace, (PSZ)pcszReplace);
    12471252
    1248     return (xstrFindReplace(pxstr, pulOfs, &xstrFind, &xstrReplace, ShiftTable, &fRepeat));
     1253    return xstrFindReplace(pxstr, pulOfs, &xstrFind, &xstrReplace, ShiftTable, &fRepeat);
    12491254}
    12501255
     
    13251330 */
    13261331
    1327 ULONG xstrEncode(PXSTRING pxstr,            // in/out: string to convert
     1332ULONG xstrEncode(PXSTRING pxstr,     // in/out: string to convert
    13281333                 PCSZ pcszEncode)    // in: characters to encode (e.g. "%,();=")
    13291334{
     
    13831388    }
    13841389
    1385     return (ulrc);
     1390    return ulrc;
    13861391}
    13871392
     
    14641469    }
    14651470
    1466     return (ulrc);
     1471    return ulrc;
    14671472}
    14681473
     
    14761481ULONG xstrDecode(PXSTRING pxstr)
    14771482{
    1478     return (xstrDecode2(pxstr, '%'));
     1483    return xstrDecode2(pxstr, '%');
    14791484}
    14801485
     
    16831688    printf("New string is: \"%s\" (%d/%d/%d)\n", str.psz, str.ulLength, str.cbAllocated, str.ulDelta);
    16841689
    1685     return (0);
     1690    return 0;
    16861691} */
    16871692
Note: See TracChangeset for help on using the changeset viewer.