VirtualBox

Changeset 98368 in vbox for trunk/src/bldprogs/scmrw.cpp


Ignore:
Timestamp:
Jan 31, 2023 3:46:52 PM (23 months ago)
Author:
vboxsync
Message:

scm: Changed the rewriter return code to include a lazy option which makes the caller check for modifications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/scmrw.cpp

    r98366 r98368  
    677677 * Strip trailing blanks (space & tab).
    678678 *
    679  * @returns True if modified, false if not.
     679 * @returns Modification state.
    680680 * @param   pIn                 The input stream.
    681681 * @param   pOut                The output stream.
    682682 * @param   pSettings           The settings.
    683683 */
    684 bool rewrite_StripTrailingBlanks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     684SCMREWRITERRES rewrite_StripTrailingBlanks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    685685{
    686686    if (!pSettings->fStripTrailingBlanks)
    687         return false;
     687        return kScmUnmodified;
    688688
    689689    bool        fModified = false;
     
    706706        }
    707707        if (RT_FAILURE(rc))
    708             return false;
     708            return kScmUnmodified;
    709709    }
    710710    if (fModified)
    711711        ScmVerbose(pState, 2, " * Stripped trailing blanks\n");
    712     return fModified;
     712    return fModified ? kScmModified : kScmUnmodified;
    713713}
    714714
     
    716716 * Expand tabs.
    717717 *
    718  * @returns True if modified, false if not.
     718 * @returns Modification state.
    719719 * @param   pIn                 The input stream.
    720720 * @param   pOut                The output stream.
    721721 * @param   pSettings           The settings.
    722722 */
    723 bool rewrite_ExpandTabs(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     723SCMREWRITERRES rewrite_ExpandTabs(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    724724{
    725725    if (!pSettings->fConvertTabs)
    726         return false;
     726        return kScmUnmodified;
    727727
    728728    size_t const    cchTab = pSettings->cchTab;
     
    764764        }
    765765        if (RT_FAILURE(rc))
    766             return false;
     766            return kScmUnmodified;
    767767    }
    768768    if (fModified)
    769769        ScmVerbose(pState, 2, " * Expanded tabs\n");
    770     return fModified;
     770    return fModified ? kScmModified : kScmUnmodified;
    771771}
    772772
     
    774774 * Worker for rewrite_ForceNativeEol, rewrite_ForceLF and rewrite_ForceCRLF.
    775775 *
    776  * @returns true if modifications were made, false if not.
     776 * @returns Modification state.
    777777 * @param   pIn                 The input stream.
    778778 * @param   pOut                The output stream.
     
    781781 * @param   pszDesiredSvnEol    The desired svn:eol-style.
    782782 */
    783 static bool rewrite_ForceEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings,
    784                              SCMEOL enmDesiredEol, const char *pszDesiredSvnEol)
     783static SCMREWRITERRES rewrite_ForceEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings,
     784                                       SCMEOL enmDesiredEol, const char *pszDesiredSvnEol)
    785785{
    786786    if (!pSettings->fConvertEol)
    787         return false;
     787        return kScmUnmodified;
    788788
    789789    bool        fModified = false;
     
    801801        int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    802802        if (RT_FAILURE(rc))
    803             return false;
     803            return kScmUnmodified;
    804804    }
    805805    if (fModified)
     
    828828
    829829    /** @todo also check the subversion svn:eol-style state! */
    830     return fModified;
     830    return fModified ? kScmModified : kScmUnmodified;
    831831}
    832832
     
    834834 * Force native end of line indicator.
    835835 *
    836  * @returns true if modifications were made, false if not.
     836 * @returns Modification state.
    837837 * @param   pIn                 The input stream.
    838838 * @param   pOut                The output stream.
    839839 * @param   pSettings           The settings.
    840840 */
    841 bool rewrite_ForceNativeEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     841SCMREWRITERRES rewrite_ForceNativeEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    842842{
    843843#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     
    851851 * Force the stream to use LF as the end of line indicator.
    852852 *
    853  * @returns true if modifications were made, false if not.
     853 * @returns Modification state.
    854854 * @param   pIn                 The input stream.
    855855 * @param   pOut                The output stream.
    856856 * @param   pSettings           The settings.
    857857 */
    858 bool rewrite_ForceLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     858SCMREWRITERRES rewrite_ForceLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    859859{
    860860    return rewrite_ForceEol(pState, pIn, pOut, pSettings, SCMEOL_LF, "LF");
     
    864864 * Force the stream to use CRLF as the end of line indicator.
    865865 *
    866  * @returns true if modifications were made, false if not.
     866 * @returns Modification state.
    867867 * @param   pIn                 The input stream.
    868868 * @param   pOut                The output stream.
    869869 * @param   pSettings           The settings.
    870870 */
    871 bool rewrite_ForceCRLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     871SCMREWRITERRES rewrite_ForceCRLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    872872{
    873873    return rewrite_ForceEol(pState, pIn, pOut, pSettings, SCMEOL_CRLF, "CRLF");
     
    878878 * at the end of the file.
    879879 *
    880  * @returns true if modifications were made, false if not.
     880 * @returns Modification state.
    881881 * @param   pIn                 The input stream.
    882882 * @param   pOut                The output stream.
     
    885885 * @remarks ASSUMES trailing white space has been removed already.
    886886 */
    887 bool rewrite_AdjustTrailingLines(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     887SCMREWRITERRES rewrite_AdjustTrailingLines(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    888888{
    889889    if (   !pSettings->fStripTrailingLines
    890890        && !pSettings->fForceTrailingLine
    891891        && !pSettings->fForceFinalEol)
    892         return false;
     892        return kScmUnmodified;
    893893
    894894    size_t const cLines = ScmStreamCountLines(pIn);
     
    896896    /* Empty files remains empty. */
    897897    if (cLines <= 1)
    898         return false;
     898        return kScmUnmodified;
    899899
    900900    /* Figure out if we need to adjust the number of lines or not. */
     
    918918    if (   !fFixMissingEol
    919919        && cLines == cLinesNew)
    920         return false;
     920        return kScmUnmodified;
    921921
    922922    /* Copy the number of lines we've arrived at. */
     
    941941
    942942    ScmVerbose(pState, 2, " * Adjusted trailing blank lines\n");
    943     return true;
     943    return kScmModified;
    944944}
    945945
     
    947947 * Make sure there is no svn:executable property on the current file.
    948948 *
    949  * @returns false - the state carries these kinds of changes.
     949 * @returns kScmUnmodified - the state carries these kinds of changes.
    950950 * @param   pState              The rewriter state.
    951951 * @param   pIn                 The input stream.
     
    953953 * @param   pSettings           The settings.
    954954 */
    955 bool rewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     955SCMREWRITERRES rewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    956956{
    957957    RT_NOREF2(pIn, pOut);
    958958    if (   !pSettings->fSetSvnExecutable
    959959        || !ScmSvnIsInWorkingCopy(pState))
    960         return false;
     960        return kScmUnmodified;
    961961
    962962    int rc = ScmSvnQueryProperty(pState, "svn:executable", NULL);
     
    968968            ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc);
    969969    }
    970     return false;
     970    return kScmUnmodified;
    971971}
    972972
     
    974974 * Make sure there is no svn:keywords property on the current file.
    975975 *
    976  * @returns false - the state carries these kinds of changes.
     976 * @returns kScmUnmodified - the state carries these kinds of changes.
    977977 * @param   pState              The rewriter state.
    978978 * @param   pIn                 The input stream.
     
    980980 * @param   pSettings           The settings.
    981981 */
    982 bool rewrite_SvnNoKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     982SCMREWRITERRES rewrite_SvnNoKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    983983{
    984984    RT_NOREF2(pIn, pOut);
    985985    if (   !pSettings->fSetSvnExecutable
    986986        || !ScmSvnIsInWorkingCopy(pState))
    987         return false;
     987        return kScmUnmodified;
    988988
    989989    int rc = ScmSvnQueryProperty(pState, "svn:keywords", NULL);
     
    995995            ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc);
    996996    }
    997     return false;
     997    return kScmUnmodified;
    998998}
    999999
     
    10011001 * Make sure there is no svn:eol-style property on the current file.
    10021002 *
    1003  * @returns false - the state carries these kinds of changes.
     1003 * @returns kScmUnmodified - the state carries these kinds of changes.
    10041004 * @param   pState              The rewriter state.
    10051005 * @param   pIn                 The input stream.
     
    10071007 * @param   pSettings           The settings.
    10081008 */
    1009 bool rewrite_SvnNoEolStyle(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1009SCMREWRITERRES rewrite_SvnNoEolStyle(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    10101010{
    10111011    RT_NOREF2(pIn, pOut);
    10121012    if (   !pSettings->fSetSvnExecutable
    10131013        || !ScmSvnIsInWorkingCopy(pState))
    1014         return false;
     1014        return kScmUnmodified;
    10151015
    10161016    int rc = ScmSvnQueryProperty(pState, "svn:eol-style", NULL);
     
    10221022            ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc);
    10231023    }
    1024     return false;
     1024    return kScmUnmodified;
    10251025}
    10261026
     
    10281028 * Makes sure the svn properties are appropriate for a binary.
    10291029 *
    1030  * @returns false - the state carries these kinds of changes.
     1030 * @returns kScmUnmodified - the state carries these kinds of changes.
    10311031 * @param   pState              The rewriter state.
    10321032 * @param   pIn                 The input stream.
     
    10341034 * @param   pSettings           The settings.
    10351035 */
    1036 bool rewrite_SvnBinary(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1036SCMREWRITERRES rewrite_SvnBinary(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    10371037{
    10381038    RT_NOREF2(pIn, pOut);
    10391039    if (   !pSettings->fSetSvnExecutable
    10401040        || !ScmSvnIsInWorkingCopy(pState))
    1041         return false;
     1041        return kScmUnmodified;
    10421042
    10431043    /* remove svn:eol-style and svn:keywords */
     
    10711071        ScmError(pState, rc, "ScmSvnQueryProperty: %Rrc\n", rc);
    10721072
    1073     return false;
     1073    return kScmUnmodified;
    10741074}
    10751075
     
    10771077 * Make sure the Id and Revision keywords are expanded.
    10781078 *
    1079  * @returns false - the state carries these kinds of changes.
     1079 * @returns kScmUnmodified - the state carries these kinds of changes.
    10801080 * @param   pState              The rewriter state.
    10811081 * @param   pIn                 The input stream.
     
    10831083 * @param   pSettings           The settings.
    10841084 */
    1085 bool rewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1085SCMREWRITERRES rewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    10861086{
    10871087    RT_NOREF2(pIn, pOut);
    10881088    if (   !pSettings->fSetSvnKeywords
    10891089        || !ScmSvnIsInWorkingCopy(pState))
    1090         return false;
     1090        return kScmUnmodified;
    10911091
    10921092    char *pszKeywords;
     
    11231123        RTStrFree(pszKeywords);
    11241124
    1125     return false;
     1125    return kScmUnmodified;
    11261126}
    11271127
     
    11291129 * Checks the svn:sync-process value and that parent is exported too.
    11301130 *
    1131  * @returns false - the state carries these kinds of changes.
     1131 * @returns kScmUnmodified - the state carries these kinds of changes.
    11321132 * @param   pState              The rewriter state.
    11331133 * @param   pIn                 The input stream.
     
    11351135 * @param   pSettings           The settings.
    11361136 */
    1137 bool rewrite_SvnSyncProcess(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1137SCMREWRITERRES rewrite_SvnSyncProcess(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    11381138{
    11391139    RT_NOREF2(pIn, pOut);
    11401140    if (   pSettings->fSkipSvnSyncProcess
    11411141        || !ScmSvnIsInWorkingCopy(pState))
    1142         return false;
     1142        return kScmUnmodified;
    11431143
    11441144    char *pszSyncProcess;
     
    11771177        ScmError(pState, rc, "ScmSvnQueryProperty: %Rrc\n", rc);
    11781178
    1179     return false;
     1179    return kScmUnmodified;
    11801180}
    11811181
     
    11831183 * Checks the that there is no bidirectional unicode fun in the file.
    11841184 *
    1185  * @returns false - the state carries these kinds of changes.
     1185 * @returns kScmUnmodified - the state carries these kinds of changes.
    11861186 * @param   pState              The rewriter state.
    11871187 * @param   pIn                 The input stream.
     
    11891189 * @param   pSettings           The settings.
    11901190 */
    1191 bool rewrite_UnicodeChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1191SCMREWRITERRES rewrite_UnicodeChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    11921192{
    11931193    RT_NOREF2(pIn, pOut);
    11941194    if (pSettings->fSkipUnicodeChecks)
    1195         return false;
     1195        return kScmUnmodified;
    11961196
    11971197    /*
     
    12391239    }
    12401240
    1241     return false;
     1241    return kScmUnmodified;
    12421242}
    12431243
     
    18721872 * Updates the copyright year and/or license text.
    18731873 *
    1874  * @returns true if modifications were made, false if not.
     1874 * @returns Modification state.
    18751875 * @param   pState              The rewriter state.
    18761876 * @param   pIn                 The input stream.
     
    18791879 * @param   enmCommentStyle     The comment style used by the file.
    18801880 */
    1881 static bool rewrite_Copyright_Common(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings,
    1882                                      SCMCOMMENTSTYLE enmCommentStyle)
     1881static SCMREWRITERRES rewrite_Copyright_Common(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut,
     1882                                                 PCSCMSETTINGSBASE pSettings, SCMCOMMENTSTYLE enmCommentStyle)
    18831883{
    18841884    if (   !pSettings->fUpdateCopyrightYear
    18851885        && pSettings->enmUpdateLicense == kScmLicense_LeaveAlone)
    1886         return false;
     1886        return kScmUnmodified;
    18871887
    18881888    /*
     
    21242124                    {
    21252125                        RTStrFree(Info.pszContributedBy);
    2126                         return false;
     2126                        return kScmUnmodified;
    21272127                    }
    21282128                } /* for each source line */
    21292129
    21302130                RTStrFree(Info.pszContributedBy);
    2131                 return true;
     2131                return kScmModified;
    21322132            }
    21332133        }
     
    21372137    NOREF(pState); NOREF(pOut);
    21382138    RTStrFree(Info.pszContributedBy);
    2139     return false;
     2139    return kScmUnmodified;
    21402140}
    21412141
    21422142
    21432143/** Copyright updater for C-style comments.   */
    2144 bool rewrite_Copyright_CstyleComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2144SCMREWRITERRES rewrite_Copyright_CstyleComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21452145{
    21462146    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_C);
     
    21482148
    21492149/** Copyright updater for hash-prefixed comments.   */
    2150 bool rewrite_Copyright_HashComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2150SCMREWRITERRES rewrite_Copyright_HashComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21512151{
    21522152    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Hash);
     
    21542154
    21552155/** Copyright updater for REM-prefixed comments.   */
    2156 bool rewrite_Copyright_RemComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2156SCMREWRITERRES rewrite_Copyright_RemComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21572157{
    21582158    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, determineBatchFileCommentStyle(pIn));
     
    21602160
    21612161/** Copyright updater for python comments.   */
    2162 bool rewrite_Copyright_PythonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2162SCMREWRITERRES rewrite_Copyright_PythonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21632163{
    21642164    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Python);
     
    21662166
    21672167/** Copyright updater for semicolon-prefixed comments.   */
    2168 bool rewrite_Copyright_SemicolonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2168SCMREWRITERRES rewrite_Copyright_SemicolonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut,
     2169                                                  PCSCMSETTINGSBASE pSettings)
    21692170{
    21702171    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Semicolon);
     
    21722173
    21732174/** Copyright updater for sql  comments.   */
    2174 bool rewrite_Copyright_SqlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2175SCMREWRITERRES rewrite_Copyright_SqlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21752176{
    21762177    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Sql);
     
    21782179
    21792180/** Copyright updater for tick-prefixed comments.   */
    2180 bool rewrite_Copyright_TickComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2181SCMREWRITERRES rewrite_Copyright_TickComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21812182{
    21822183    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Tick);
     
    21842185
    21852186/** Copyright updater for XML comments.   */
    2186 bool rewrite_Copyright_XmlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2187SCMREWRITERRES rewrite_Copyright_XmlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    21872188{
    21882189    return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Xml);
     
    22032204 * @param   pSettings           The settings.
    22042205 */
    2205 bool rewrite_Makefile_kup(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     2206SCMREWRITERRES rewrite_Makefile_kup(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    22062207{
    22072208    RT_NOREF2(pOut, pSettings);
     
    22092210    /* These files should be zero bytes. */
    22102211    if (pIn->cb == 0)
    2211         return false;
     2212        return kScmUnmodified;
    22122213    ScmVerbose(pState, 2, " * Truncated file to zero bytes\n");
    2213     return true;
     2214    return kScmModified;
    22142215}
    22152216
     
    24362437    uint32_t iDepth = pParser->iDepth;
    24372438    if (iDepth + 1 >= RT_ELEMENTS(pParser->aDepth))
    2438         return ScmError(pParser->pState, VERR_ASN1_TOO_DEEPLY_NESTED /*?*/, "%u: Too deep if/define nesting!\n", pParser->iLine);
     2439    {
     2440        ScmError(pParser->pState, VERR_ASN1_TOO_DEEPLY_NESTED /*?*/, "%u: Too deep if/define nesting!\n", pParser->iLine);
     2441        return false;
     2442    }
    24392443
    24402444    pParser->aDepth[iDepth].enmToken       = enmToken;
     
    29802984            pParser->pchLine = pchLine = ScmStreamGetLine(pParser->pIn, &pParser->cchLine, &pParser->enmEol);
    29812985            if (!pchLine)
    2982                 return ScmError(pParser->pState, VERR_INTERNAL_ERROR_3, "ScmStreamGetLine unexpectedly returned NULL!");
     2986            {
     2987                ScmError(pParser->pState, VERR_INTERNAL_ERROR_3, "ScmStreamGetLine unexpectedly returned NULL!");
     2988                return false;
     2989            }
    29832990            cchLine = pParser->cchLine;
    29842991            pParser->iLine++;
     
    40074014 * Rewrite a kBuild makefile.
    40084015 *
    4009  * @returns true if modifications were made, false if not.
     4016 * @returns Modification state.
    40104017 * @param   pIn                 The input stream.
    40114018 * @param   pOut                The output stream.
     
    40184025 *      - line continuation slashes should only be preceded by one space.
    40194026 */
    4020 bool rewrite_Makefile_kmk(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     4027SCMREWRITERRES rewrite_Makefile_kmk(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    40214028{
    40224029    if (!pSettings->fStandarizeKmk)
    4023         return false;
     4030        return kScmUnmodified;
    40244031
    40254032    /*
     
    41734180    }
    41744181
    4175     return fModified;
     4182    return fModified ? kScmModified : kScmUnmodified;
    41764183}
    41774184
     
    42954302 * Flower box marker comments in C and C++ code.
    42964303 *
    4297  * @returns true if modifications were made, false if not.
     4304 * @returns Modification state.
    42984305 * @param   pIn                 The input stream.
    42994306 * @param   pOut                The output stream.
    43004307 * @param   pSettings           The settings.
    43014308 */
    4302 bool rewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     4309SCMREWRITERRES rewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    43034310{
    43044311    if (!pSettings->fFixFlowerBoxMarkers)
    4305         return false;
     4312        return kScmUnmodified;
    43064313
    43074314    /*
     
    43634370            int rc = ScmStreamSeekAbsolute(pIn, offSaved);
    43644371            if (RT_FAILURE(rc))
    4365                 return false;
     4372                return kScmUnmodified;
    43664373        }
    43674374
    43684375        int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    43694376        if (RT_FAILURE(rc))
    4370             return false;
     4377            return kScmUnmodified;
    43714378
    43724379        /* Do blank line accounting so we can ensure at least two blank lines
     
    43794386    if (cChanges > 0)
    43804387        ScmVerbose(pState, 2, " * Converted %zu flower boxer markers\n", cChanges);
    4381     return cChanges != 0;
     4388    return cChanges != 0 ? kScmModified : kScmUnmodified;
    43824389}
    43834390
     
    44884495 * Doxygen todos in C and C++ code.
    44894496 *
    4490  * @returns true if modifications were made, false if not.
     4497 * @returns Modification state.
    44914498 * @param   pState              The rewriter state.
    44924499 * @param   pIn                 The input stream.
     
    44944501 * @param   pSettings           The settings.
    44954502 */
    4496 bool rewrite_Fix_C_and_CPP_Todos(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     4503SCMREWRITERRES rewrite_Fix_C_and_CPP_Todos(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    44974504{
    44984505    if (!pSettings->fFixTodos)
    4499         return false;
     4506        return kScmUnmodified;
    45004507
    45014508    /*
     
    45664573        int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    45674574        if (RT_FAILURE(rc))
    4568             return false;
     4575            return kScmUnmodified;
    45694576    }
    45704577    if (cChanges > 0)
    45714578        ScmVerbose(pState, 2, " * Converted %zu todo statements.\n", cChanges);
    4572     return cChanges != 0;
     4579    return cChanges != 0 ? kScmModified : kScmUnmodified;
    45734580}
    45744581
     
    46714678 * Fix err.h/errcore.h usage.
    46724679 *
    4673  * @returns true if modifications were made, false if not.
     4680 * @returns Modification state.
    46744681 * @param   pIn                 The input stream.
    46754682 * @param   pOut                The output stream.
    46764683 * @param   pSettings           The settings.
    46774684 */
    4678 bool rewrite_Fix_Err_H(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     4685SCMREWRITERRES rewrite_Fix_Err_H(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    46794686{
    46804687    if (!pSettings->fFixErrH)
    4681         return false;
     4688        return kScmUnmodified;
    46824689
    46834690    static struct
     
    48684875    if (   iIncludeLevel <= iUsageLevel
    48694876        || iIncludeLevel <= 1 /* we cannot safely eliminate errcore.h includes atm. */)
    4870         return false;
     4877        return kScmUnmodified;
    48714878
    48724879    unsigned cChanges = 0;
     
    49124919        int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    49134920        if (RT_FAILURE(rc))
    4914             return false;
     4921            return kScmUnmodified;
    49154922    }
    49164923    ScmVerbose(pState, 2, " * Converted %zu err.h/errcore.h include statements.\n", cChanges);
    4917     return true;
     4924    return kScmModified;
    49184925}
    49194926
     
    50145021 * Fix header file include guards and \#pragma once.
    50155022 *
    5016  * @returns true if modifications were made, false if not.
     5023 * @returns Modification state.
    50175024 * @param   pIn                 The input stream.
    50185025 * @param   pOut                The output stream.
    50195026 * @param   pSettings           The settings.
    50205027 */
    5021 bool rewrite_FixHeaderGuards(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     5028SCMREWRITERRES rewrite_FixHeaderGuards(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    50225029{
    50235030    if (!pSettings->fFixHeaderGuards)
    5024         return false;
     5031        return kScmUnmodified;
    50255032
    50265033    /* always skip .cpp.h files */
     
    50285035    if (   cchFilename > sizeof(".cpp.h")
    50295036        && RTStrICmpAscii(&pState->pszFilename[cchFilename - sizeof(".cpp.h") + 1], ".cpp.h") == 0)
    5030         return false;
     5037        return kScmUnmodified;
    50315038
    50325039    RTERRINFOSTATIC ErrInfo;
     
    51645171                rc = ScmStreamPutEol(pOut, enmEol);
    51655172                if (RT_FAILURE(rc))
    5166                     return false;
     5173                    return kScmUnmodified;
    51675174                break;
    51685175            }
     
    51765183            rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    51775184            if (RT_FAILURE(rc))
    5178                 return false;
     5185                return kScmUnmodified;
    51795186        }
    51805187        else
     
    52685275        rc = ScmStreamPutLine(pOut, RT_STR_TUPLE("#endif"), enmEol);
    52695276        if (RT_FAILURE(rc))
    5270             return false;
     5277            return kScmUnmodified;
    52715278    }
    52725279
     
    53125319        rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    53135320        if (RT_FAILURE(rc))
    5314             return false;
     5321            return kScmUnmodified;
    53155322    }
    53165323
     
    53255332        rc = ScmStreamSeekByLine(pIn, iEndIfIn);
    53265333        if (RT_FAILURE(rc))
    5327             return false;
     5334            return kScmUnmodified;
    53285335        rc = ScmStreamSeekByLine(pOut, iEndIfOut);
    53295336        if (RT_FAILURE(rc))
    5330             return false;
     5337            return kScmUnmodified;
    53315338
    53325339        pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol);
     
    53435350        rc = ScmStreamPutLine(pOut, szTmp, cchTmp, enmEol);
    53445351        if (RT_FAILURE(rc))
    5345             return false;
     5352            return kScmUnmodified;
    53465353
    53475354        /* Copy out the remaining lines (assumes no #pragma once here). */
     
    53505357            rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
    53515358            if (RT_FAILURE(rc))
    5352                 return false;
    5353         }
    5354     }
    5355 
    5356     return fRet;
     5359                return kScmUnmodified;
     5360        }
     5361    }
     5362
     5363    return fRet ? kScmModified : kScmUnmodified;
    53575364}
    53585365
     
    53635370 * PAGE_BASE_MASK.
    53645371 *
    5365  * @returns true if modifications were made, false if not.
     5372 * @returns kScmUnmodified - requires manual fix.
    53665373 * @param   pIn                 The input stream.
    53675374 * @param   pOut                The output stream.
    53685375 * @param   pSettings           The settings.
    53695376 */
    5370 bool rewrite_PageChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     5377SCMREWRITERRES rewrite_PageChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    53715378{
    53725379    RT_NOREF(pOut);
    53735380    if (!pSettings->fOnlyGuestHostPage && !pSettings->fNoASMMemPageUse)
    5374         return false;
     5381        return kScmUnmodified;
    53755382
    53765383    static RTSTRTUPLE const g_aWords[] =
     
    54355442    }
    54365443
    5437     return false;
     5444    return kScmUnmodified;
    54385445}
    54395446
     
    54435450 * status codes (HRESULT).
    54445451 *
    5445  * @returns true if modifications were made, false if not.
     5452 * @returns kScmUnmodified - requires manual fix.
    54465453 * @param   pIn                 The input stream.
    54475454 * @param   pOut                The output stream.
     
    54505457 * @note Used in Main to avoid ambiguity when just using rc.
    54515458 */
    5452 bool rewrite_ForceHrcVrcInsteadOfRc(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     5459SCMREWRITERRES rewrite_ForceHrcVrcInsteadOfRc(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    54535460{
    54545461    RT_NOREF(pOut);
    54555462    if (!pSettings->fOnlyHrcVrcInsteadOfRc)
    5456         return false;
     5463        return kScmUnmodified;
    54575464
    54585465    static const SCMMATCHWORD s_aHresultVrc[] =
     
    55565563    }
    55575564
    5558     return false;
     5565    return kScmUnmodified;
    55595566}
    55605567
     
    55635570 * Rewrite a C/C++ source or header file.
    55645571 *
    5565  * @returns true if modifications were made, false if not.
     5572 * @returns Modification state.
    55665573 * @param   pIn                 The input stream.
    55675574 * @param   pOut                The output stream.
     
    55915598 *      - string.h -> iprt/string.h, stdarg.h -> iprt/stdarg.h, etc.
    55925599 */
    5593 bool rewrite_C_and_CPP(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     5600SCMREWRITERRES rewrite_C_and_CPP(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
    55945601{
    55955602
    55965603    RT_NOREF4(pState, pIn, pOut, pSettings);
    5597     return false;
    5598 }
    5599 
     5604    return kScmUnmodified;
     5605}
     5606
Note: See TracChangeset for help on using the changeset viewer.

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