Ignore:
Timestamp:
Mar 26, 2002, 8:02:50 PM (23 years ago)
Author:
umoeller
Message:

Misc fixes

File:
1 edited

Legend:

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

    r129 r151  
    547547 *         by \n ONLY. If *ppszContents has \r\n line breaks,
    548548 *         they must be converted to pure \n first.
     549 *
     550 *@@changed V0.9.18 (2002-03-24) [umoeller]: fixed leftover duplicate ';' chars with CFGRPL_REMOVEPART
    549551 */
    550552
     
    814816                if ((pArgToDel = strhistr(pszDeletedLine, pszArgNew)))
    815817                {
    816                     ULONG ulOfs = 0;
     818                    // ULONG ulOfs = 0;
    817819                    // pArgToDel now has the position of the
    818820                    // part to be deleted in the old part
    819                     pszLineToInsert = strdup(pszDeletedLine);
     821                    /* pszLineToInsert = strdup(pszDeletedLine);
    820822                    strhFindReplace(&pszLineToInsert,
    821823                                    &ulOfs,
    822824                                    pszArgNew,   // search string
    823825                                    "");         // replacement string
     826                    */
     827
     828                    // V0.9.18 (2002-03-24) [umoeller]
     829                    // the above left duplicate ";" characters in the line
     830                    ULONG ulArgNewLen = strlen(pszArgNew);
     831                    ULONG cbFirst, cb;
     832                    PSZ pAfter = pArgToDel + ulArgNewLen;
     833                    while (*pAfter == ';')
     834                        ++pAfter;
     835
     836                    // now recompose
     837                    cbFirst = pArgToDel - pszDeletedLine;
     838                    cb =   cbFirst                          // length up to pArgToDel
     839                         + strlen(pAfter)                   // length of remainder
     840                         + 1;                               // null terminator;
     841                    if (pszLineToInsert = (PSZ)malloc(cb))
     842                    {
     843                        if (cbFirst)
     844                            memcpy(pszLineToInsert, pszDeletedLine, cbFirst);
     845                        strcpy(pszLineToInsert + cbFirst,
     846                               pAfter);
     847                    }
     848                    else
     849                        arc = ERROR_NOT_ENOUGH_MEMORY;
    824850                }
    825851                else
Note: See TracChangeset for help on using the changeset viewer.