Changeset 98368 in vbox for trunk/src/bldprogs/scmrw.cpp
- Timestamp:
- Jan 31, 2023 3:46:52 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scmrw.cpp
r98366 r98368 677 677 * Strip trailing blanks (space & tab). 678 678 * 679 * @returns True if modified, false if not.679 * @returns Modification state. 680 680 * @param pIn The input stream. 681 681 * @param pOut The output stream. 682 682 * @param pSettings The settings. 683 683 */ 684 boolrewrite_StripTrailingBlanks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)684 SCMREWRITERRES rewrite_StripTrailingBlanks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 685 685 { 686 686 if (!pSettings->fStripTrailingBlanks) 687 return false;687 return kScmUnmodified; 688 688 689 689 bool fModified = false; … … 706 706 } 707 707 if (RT_FAILURE(rc)) 708 return false;708 return kScmUnmodified; 709 709 } 710 710 if (fModified) 711 711 ScmVerbose(pState, 2, " * Stripped trailing blanks\n"); 712 return fModified ;712 return fModified ? kScmModified : kScmUnmodified; 713 713 } 714 714 … … 716 716 * Expand tabs. 717 717 * 718 * @returns True if modified, false if not.718 * @returns Modification state. 719 719 * @param pIn The input stream. 720 720 * @param pOut The output stream. 721 721 * @param pSettings The settings. 722 722 */ 723 boolrewrite_ExpandTabs(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)723 SCMREWRITERRES rewrite_ExpandTabs(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 724 724 { 725 725 if (!pSettings->fConvertTabs) 726 return false;726 return kScmUnmodified; 727 727 728 728 size_t const cchTab = pSettings->cchTab; … … 764 764 } 765 765 if (RT_FAILURE(rc)) 766 return false;766 return kScmUnmodified; 767 767 } 768 768 if (fModified) 769 769 ScmVerbose(pState, 2, " * Expanded tabs\n"); 770 return fModified ;770 return fModified ? kScmModified : kScmUnmodified; 771 771 } 772 772 … … 774 774 * Worker for rewrite_ForceNativeEol, rewrite_ForceLF and rewrite_ForceCRLF. 775 775 * 776 * @returns true if modifications were made, false if not.776 * @returns Modification state. 777 777 * @param pIn The input stream. 778 778 * @param pOut The output stream. … … 781 781 * @param pszDesiredSvnEol The desired svn:eol-style. 782 782 */ 783 static boolrewrite_ForceEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings,784 SCMEOL enmDesiredEol, const char *pszDesiredSvnEol)783 static SCMREWRITERRES rewrite_ForceEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings, 784 SCMEOL enmDesiredEol, const char *pszDesiredSvnEol) 785 785 { 786 786 if (!pSettings->fConvertEol) 787 return false;787 return kScmUnmodified; 788 788 789 789 bool fModified = false; … … 801 801 int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 802 802 if (RT_FAILURE(rc)) 803 return false;803 return kScmUnmodified; 804 804 } 805 805 if (fModified) … … 828 828 829 829 /** @todo also check the subversion svn:eol-style state! */ 830 return fModified ;830 return fModified ? kScmModified : kScmUnmodified; 831 831 } 832 832 … … 834 834 * Force native end of line indicator. 835 835 * 836 * @returns true if modifications were made, false if not.836 * @returns Modification state. 837 837 * @param pIn The input stream. 838 838 * @param pOut The output stream. 839 839 * @param pSettings The settings. 840 840 */ 841 boolrewrite_ForceNativeEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)841 SCMREWRITERRES rewrite_ForceNativeEol(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 842 842 { 843 843 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) … … 851 851 * Force the stream to use LF as the end of line indicator. 852 852 * 853 * @returns true if modifications were made, false if not.853 * @returns Modification state. 854 854 * @param pIn The input stream. 855 855 * @param pOut The output stream. 856 856 * @param pSettings The settings. 857 857 */ 858 boolrewrite_ForceLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)858 SCMREWRITERRES rewrite_ForceLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 859 859 { 860 860 return rewrite_ForceEol(pState, pIn, pOut, pSettings, SCMEOL_LF, "LF"); … … 864 864 * Force the stream to use CRLF as the end of line indicator. 865 865 * 866 * @returns true if modifications were made, false if not.866 * @returns Modification state. 867 867 * @param pIn The input stream. 868 868 * @param pOut The output stream. 869 869 * @param pSettings The settings. 870 870 */ 871 boolrewrite_ForceCRLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)871 SCMREWRITERRES rewrite_ForceCRLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 872 872 { 873 873 return rewrite_ForceEol(pState, pIn, pOut, pSettings, SCMEOL_CRLF, "CRLF"); … … 878 878 * at the end of the file. 879 879 * 880 * @returns true if modifications were made, false if not.880 * @returns Modification state. 881 881 * @param pIn The input stream. 882 882 * @param pOut The output stream. … … 885 885 * @remarks ASSUMES trailing white space has been removed already. 886 886 */ 887 boolrewrite_AdjustTrailingLines(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)887 SCMREWRITERRES rewrite_AdjustTrailingLines(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 888 888 { 889 889 if ( !pSettings->fStripTrailingLines 890 890 && !pSettings->fForceTrailingLine 891 891 && !pSettings->fForceFinalEol) 892 return false;892 return kScmUnmodified; 893 893 894 894 size_t const cLines = ScmStreamCountLines(pIn); … … 896 896 /* Empty files remains empty. */ 897 897 if (cLines <= 1) 898 return false;898 return kScmUnmodified; 899 899 900 900 /* Figure out if we need to adjust the number of lines or not. */ … … 918 918 if ( !fFixMissingEol 919 919 && cLines == cLinesNew) 920 return false;920 return kScmUnmodified; 921 921 922 922 /* Copy the number of lines we've arrived at. */ … … 941 941 942 942 ScmVerbose(pState, 2, " * Adjusted trailing blank lines\n"); 943 return true;943 return kScmModified; 944 944 } 945 945 … … 947 947 * Make sure there is no svn:executable property on the current file. 948 948 * 949 * @returns false- the state carries these kinds of changes.949 * @returns kScmUnmodified - the state carries these kinds of changes. 950 950 * @param pState The rewriter state. 951 951 * @param pIn The input stream. … … 953 953 * @param pSettings The settings. 954 954 */ 955 boolrewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)955 SCMREWRITERRES rewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 956 956 { 957 957 RT_NOREF2(pIn, pOut); 958 958 if ( !pSettings->fSetSvnExecutable 959 959 || !ScmSvnIsInWorkingCopy(pState)) 960 return false;960 return kScmUnmodified; 961 961 962 962 int rc = ScmSvnQueryProperty(pState, "svn:executable", NULL); … … 968 968 ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc); 969 969 } 970 return false;970 return kScmUnmodified; 971 971 } 972 972 … … 974 974 * Make sure there is no svn:keywords property on the current file. 975 975 * 976 * @returns false- the state carries these kinds of changes.976 * @returns kScmUnmodified - the state carries these kinds of changes. 977 977 * @param pState The rewriter state. 978 978 * @param pIn The input stream. … … 980 980 * @param pSettings The settings. 981 981 */ 982 boolrewrite_SvnNoKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)982 SCMREWRITERRES rewrite_SvnNoKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 983 983 { 984 984 RT_NOREF2(pIn, pOut); 985 985 if ( !pSettings->fSetSvnExecutable 986 986 || !ScmSvnIsInWorkingCopy(pState)) 987 return false;987 return kScmUnmodified; 988 988 989 989 int rc = ScmSvnQueryProperty(pState, "svn:keywords", NULL); … … 995 995 ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc); 996 996 } 997 return false;997 return kScmUnmodified; 998 998 } 999 999 … … 1001 1001 * Make sure there is no svn:eol-style property on the current file. 1002 1002 * 1003 * @returns false- the state carries these kinds of changes.1003 * @returns kScmUnmodified - the state carries these kinds of changes. 1004 1004 * @param pState The rewriter state. 1005 1005 * @param pIn The input stream. … … 1007 1007 * @param pSettings The settings. 1008 1008 */ 1009 boolrewrite_SvnNoEolStyle(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)1009 SCMREWRITERRES rewrite_SvnNoEolStyle(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1010 1010 { 1011 1011 RT_NOREF2(pIn, pOut); 1012 1012 if ( !pSettings->fSetSvnExecutable 1013 1013 || !ScmSvnIsInWorkingCopy(pState)) 1014 return false;1014 return kScmUnmodified; 1015 1015 1016 1016 int rc = ScmSvnQueryProperty(pState, "svn:eol-style", NULL); … … 1022 1022 ScmError(pState, rc, "ScmSvnSetProperty: %Rrc\n", rc); 1023 1023 } 1024 return false;1024 return kScmUnmodified; 1025 1025 } 1026 1026 … … 1028 1028 * Makes sure the svn properties are appropriate for a binary. 1029 1029 * 1030 * @returns false- the state carries these kinds of changes.1030 * @returns kScmUnmodified - the state carries these kinds of changes. 1031 1031 * @param pState The rewriter state. 1032 1032 * @param pIn The input stream. … … 1034 1034 * @param pSettings The settings. 1035 1035 */ 1036 boolrewrite_SvnBinary(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)1036 SCMREWRITERRES rewrite_SvnBinary(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1037 1037 { 1038 1038 RT_NOREF2(pIn, pOut); 1039 1039 if ( !pSettings->fSetSvnExecutable 1040 1040 || !ScmSvnIsInWorkingCopy(pState)) 1041 return false;1041 return kScmUnmodified; 1042 1042 1043 1043 /* remove svn:eol-style and svn:keywords */ … … 1071 1071 ScmError(pState, rc, "ScmSvnQueryProperty: %Rrc\n", rc); 1072 1072 1073 return false;1073 return kScmUnmodified; 1074 1074 } 1075 1075 … … 1077 1077 * Make sure the Id and Revision keywords are expanded. 1078 1078 * 1079 * @returns false- the state carries these kinds of changes.1079 * @returns kScmUnmodified - the state carries these kinds of changes. 1080 1080 * @param pState The rewriter state. 1081 1081 * @param pIn The input stream. … … 1083 1083 * @param pSettings The settings. 1084 1084 */ 1085 boolrewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)1085 SCMREWRITERRES rewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1086 1086 { 1087 1087 RT_NOREF2(pIn, pOut); 1088 1088 if ( !pSettings->fSetSvnKeywords 1089 1089 || !ScmSvnIsInWorkingCopy(pState)) 1090 return false;1090 return kScmUnmodified; 1091 1091 1092 1092 char *pszKeywords; … … 1123 1123 RTStrFree(pszKeywords); 1124 1124 1125 return false;1125 return kScmUnmodified; 1126 1126 } 1127 1127 … … 1129 1129 * Checks the svn:sync-process value and that parent is exported too. 1130 1130 * 1131 * @returns false- the state carries these kinds of changes.1131 * @returns kScmUnmodified - the state carries these kinds of changes. 1132 1132 * @param pState The rewriter state. 1133 1133 * @param pIn The input stream. … … 1135 1135 * @param pSettings The settings. 1136 1136 */ 1137 boolrewrite_SvnSyncProcess(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)1137 SCMREWRITERRES rewrite_SvnSyncProcess(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1138 1138 { 1139 1139 RT_NOREF2(pIn, pOut); 1140 1140 if ( pSettings->fSkipSvnSyncProcess 1141 1141 || !ScmSvnIsInWorkingCopy(pState)) 1142 return false;1142 return kScmUnmodified; 1143 1143 1144 1144 char *pszSyncProcess; … … 1177 1177 ScmError(pState, rc, "ScmSvnQueryProperty: %Rrc\n", rc); 1178 1178 1179 return false;1179 return kScmUnmodified; 1180 1180 } 1181 1181 … … 1183 1183 * Checks the that there is no bidirectional unicode fun in the file. 1184 1184 * 1185 * @returns false- the state carries these kinds of changes.1185 * @returns kScmUnmodified - the state carries these kinds of changes. 1186 1186 * @param pState The rewriter state. 1187 1187 * @param pIn The input stream. … … 1189 1189 * @param pSettings The settings. 1190 1190 */ 1191 boolrewrite_UnicodeChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)1191 SCMREWRITERRES rewrite_UnicodeChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 1192 1192 { 1193 1193 RT_NOREF2(pIn, pOut); 1194 1194 if (pSettings->fSkipUnicodeChecks) 1195 return false;1195 return kScmUnmodified; 1196 1196 1197 1197 /* … … 1239 1239 } 1240 1240 1241 return false;1241 return kScmUnmodified; 1242 1242 } 1243 1243 … … 1872 1872 * Updates the copyright year and/or license text. 1873 1873 * 1874 * @returns true if modifications were made, false if not.1874 * @returns Modification state. 1875 1875 * @param pState The rewriter state. 1876 1876 * @param pIn The input stream. … … 1879 1879 * @param enmCommentStyle The comment style used by the file. 1880 1880 */ 1881 static bool rewrite_Copyright_Common(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings,1882 SCMCOMMENTSTYLE enmCommentStyle)1881 static SCMREWRITERRES rewrite_Copyright_Common(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, 1882 PCSCMSETTINGSBASE pSettings, SCMCOMMENTSTYLE enmCommentStyle) 1883 1883 { 1884 1884 if ( !pSettings->fUpdateCopyrightYear 1885 1885 && pSettings->enmUpdateLicense == kScmLicense_LeaveAlone) 1886 return false;1886 return kScmUnmodified; 1887 1887 1888 1888 /* … … 2124 2124 { 2125 2125 RTStrFree(Info.pszContributedBy); 2126 return false;2126 return kScmUnmodified; 2127 2127 } 2128 2128 } /* for each source line */ 2129 2129 2130 2130 RTStrFree(Info.pszContributedBy); 2131 return true;2131 return kScmModified; 2132 2132 } 2133 2133 } … … 2137 2137 NOREF(pState); NOREF(pOut); 2138 2138 RTStrFree(Info.pszContributedBy); 2139 return false;2139 return kScmUnmodified; 2140 2140 } 2141 2141 2142 2142 2143 2143 /** Copyright updater for C-style comments. */ 2144 boolrewrite_Copyright_CstyleComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2144 SCMREWRITERRES rewrite_Copyright_CstyleComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2145 2145 { 2146 2146 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_C); … … 2148 2148 2149 2149 /** Copyright updater for hash-prefixed comments. */ 2150 boolrewrite_Copyright_HashComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2150 SCMREWRITERRES rewrite_Copyright_HashComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2151 2151 { 2152 2152 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Hash); … … 2154 2154 2155 2155 /** Copyright updater for REM-prefixed comments. */ 2156 boolrewrite_Copyright_RemComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2156 SCMREWRITERRES rewrite_Copyright_RemComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2157 2157 { 2158 2158 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, determineBatchFileCommentStyle(pIn)); … … 2160 2160 2161 2161 /** Copyright updater for python comments. */ 2162 boolrewrite_Copyright_PythonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2162 SCMREWRITERRES rewrite_Copyright_PythonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2163 2163 { 2164 2164 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Python); … … 2166 2166 2167 2167 /** Copyright updater for semicolon-prefixed comments. */ 2168 bool rewrite_Copyright_SemicolonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2168 SCMREWRITERRES rewrite_Copyright_SemicolonComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, 2169 PCSCMSETTINGSBASE pSettings) 2169 2170 { 2170 2171 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Semicolon); … … 2172 2173 2173 2174 /** Copyright updater for sql comments. */ 2174 boolrewrite_Copyright_SqlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2175 SCMREWRITERRES rewrite_Copyright_SqlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2175 2176 { 2176 2177 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Sql); … … 2178 2179 2179 2180 /** Copyright updater for tick-prefixed comments. */ 2180 boolrewrite_Copyright_TickComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2181 SCMREWRITERRES rewrite_Copyright_TickComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2181 2182 { 2182 2183 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Tick); … … 2184 2185 2185 2186 /** Copyright updater for XML comments. */ 2186 boolrewrite_Copyright_XmlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2187 SCMREWRITERRES rewrite_Copyright_XmlComment(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2187 2188 { 2188 2189 return rewrite_Copyright_Common(pState, pIn, pOut, pSettings, kScmCommentStyle_Xml); … … 2203 2204 * @param pSettings The settings. 2204 2205 */ 2205 boolrewrite_Makefile_kup(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)2206 SCMREWRITERRES rewrite_Makefile_kup(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 2206 2207 { 2207 2208 RT_NOREF2(pOut, pSettings); … … 2209 2210 /* These files should be zero bytes. */ 2210 2211 if (pIn->cb == 0) 2211 return false;2212 return kScmUnmodified; 2212 2213 ScmVerbose(pState, 2, " * Truncated file to zero bytes\n"); 2213 return true;2214 return kScmModified; 2214 2215 } 2215 2216 … … 2436 2437 uint32_t iDepth = pParser->iDepth; 2437 2438 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 } 2439 2443 2440 2444 pParser->aDepth[iDepth].enmToken = enmToken; … … 2980 2984 pParser->pchLine = pchLine = ScmStreamGetLine(pParser->pIn, &pParser->cchLine, &pParser->enmEol); 2981 2985 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 } 2983 2990 cchLine = pParser->cchLine; 2984 2991 pParser->iLine++; … … 4007 4014 * Rewrite a kBuild makefile. 4008 4015 * 4009 * @returns true if modifications were made, false if not.4016 * @returns Modification state. 4010 4017 * @param pIn The input stream. 4011 4018 * @param pOut The output stream. … … 4018 4025 * - line continuation slashes should only be preceded by one space. 4019 4026 */ 4020 boolrewrite_Makefile_kmk(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)4027 SCMREWRITERRES rewrite_Makefile_kmk(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 4021 4028 { 4022 4029 if (!pSettings->fStandarizeKmk) 4023 return false;4030 return kScmUnmodified; 4024 4031 4025 4032 /* … … 4173 4180 } 4174 4181 4175 return fModified ;4182 return fModified ? kScmModified : kScmUnmodified; 4176 4183 } 4177 4184 … … 4295 4302 * Flower box marker comments in C and C++ code. 4296 4303 * 4297 * @returns true if modifications were made, false if not.4304 * @returns Modification state. 4298 4305 * @param pIn The input stream. 4299 4306 * @param pOut The output stream. 4300 4307 * @param pSettings The settings. 4301 4308 */ 4302 boolrewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)4309 SCMREWRITERRES rewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 4303 4310 { 4304 4311 if (!pSettings->fFixFlowerBoxMarkers) 4305 return false;4312 return kScmUnmodified; 4306 4313 4307 4314 /* … … 4363 4370 int rc = ScmStreamSeekAbsolute(pIn, offSaved); 4364 4371 if (RT_FAILURE(rc)) 4365 return false;4372 return kScmUnmodified; 4366 4373 } 4367 4374 4368 4375 int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 4369 4376 if (RT_FAILURE(rc)) 4370 return false;4377 return kScmUnmodified; 4371 4378 4372 4379 /* Do blank line accounting so we can ensure at least two blank lines … … 4379 4386 if (cChanges > 0) 4380 4387 ScmVerbose(pState, 2, " * Converted %zu flower boxer markers\n", cChanges); 4381 return cChanges != 0 ;4388 return cChanges != 0 ? kScmModified : kScmUnmodified; 4382 4389 } 4383 4390 … … 4488 4495 * Doxygen todos in C and C++ code. 4489 4496 * 4490 * @returns true if modifications were made, false if not.4497 * @returns Modification state. 4491 4498 * @param pState The rewriter state. 4492 4499 * @param pIn The input stream. … … 4494 4501 * @param pSettings The settings. 4495 4502 */ 4496 boolrewrite_Fix_C_and_CPP_Todos(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)4503 SCMREWRITERRES rewrite_Fix_C_and_CPP_Todos(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 4497 4504 { 4498 4505 if (!pSettings->fFixTodos) 4499 return false;4506 return kScmUnmodified; 4500 4507 4501 4508 /* … … 4566 4573 int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 4567 4574 if (RT_FAILURE(rc)) 4568 return false;4575 return kScmUnmodified; 4569 4576 } 4570 4577 if (cChanges > 0) 4571 4578 ScmVerbose(pState, 2, " * Converted %zu todo statements.\n", cChanges); 4572 return cChanges != 0 ;4579 return cChanges != 0 ? kScmModified : kScmUnmodified; 4573 4580 } 4574 4581 … … 4671 4678 * Fix err.h/errcore.h usage. 4672 4679 * 4673 * @returns true if modifications were made, false if not.4680 * @returns Modification state. 4674 4681 * @param pIn The input stream. 4675 4682 * @param pOut The output stream. 4676 4683 * @param pSettings The settings. 4677 4684 */ 4678 boolrewrite_Fix_Err_H(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)4685 SCMREWRITERRES rewrite_Fix_Err_H(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 4679 4686 { 4680 4687 if (!pSettings->fFixErrH) 4681 return false;4688 return kScmUnmodified; 4682 4689 4683 4690 static struct … … 4868 4875 if ( iIncludeLevel <= iUsageLevel 4869 4876 || iIncludeLevel <= 1 /* we cannot safely eliminate errcore.h includes atm. */) 4870 return false;4877 return kScmUnmodified; 4871 4878 4872 4879 unsigned cChanges = 0; … … 4912 4919 int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 4913 4920 if (RT_FAILURE(rc)) 4914 return false;4921 return kScmUnmodified; 4915 4922 } 4916 4923 ScmVerbose(pState, 2, " * Converted %zu err.h/errcore.h include statements.\n", cChanges); 4917 return true;4924 return kScmModified; 4918 4925 } 4919 4926 … … 5014 5021 * Fix header file include guards and \#pragma once. 5015 5022 * 5016 * @returns true if modifications were made, false if not.5023 * @returns Modification state. 5017 5024 * @param pIn The input stream. 5018 5025 * @param pOut The output stream. 5019 5026 * @param pSettings The settings. 5020 5027 */ 5021 boolrewrite_FixHeaderGuards(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)5028 SCMREWRITERRES rewrite_FixHeaderGuards(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 5022 5029 { 5023 5030 if (!pSettings->fFixHeaderGuards) 5024 return false;5031 return kScmUnmodified; 5025 5032 5026 5033 /* always skip .cpp.h files */ … … 5028 5035 if ( cchFilename > sizeof(".cpp.h") 5029 5036 && RTStrICmpAscii(&pState->pszFilename[cchFilename - sizeof(".cpp.h") + 1], ".cpp.h") == 0) 5030 return false;5037 return kScmUnmodified; 5031 5038 5032 5039 RTERRINFOSTATIC ErrInfo; … … 5164 5171 rc = ScmStreamPutEol(pOut, enmEol); 5165 5172 if (RT_FAILURE(rc)) 5166 return false;5173 return kScmUnmodified; 5167 5174 break; 5168 5175 } … … 5176 5183 rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 5177 5184 if (RT_FAILURE(rc)) 5178 return false;5185 return kScmUnmodified; 5179 5186 } 5180 5187 else … … 5268 5275 rc = ScmStreamPutLine(pOut, RT_STR_TUPLE("#endif"), enmEol); 5269 5276 if (RT_FAILURE(rc)) 5270 return false;5277 return kScmUnmodified; 5271 5278 } 5272 5279 … … 5312 5319 rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 5313 5320 if (RT_FAILURE(rc)) 5314 return false;5321 return kScmUnmodified; 5315 5322 } 5316 5323 … … 5325 5332 rc = ScmStreamSeekByLine(pIn, iEndIfIn); 5326 5333 if (RT_FAILURE(rc)) 5327 return false;5334 return kScmUnmodified; 5328 5335 rc = ScmStreamSeekByLine(pOut, iEndIfOut); 5329 5336 if (RT_FAILURE(rc)) 5330 return false;5337 return kScmUnmodified; 5331 5338 5332 5339 pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol); … … 5343 5350 rc = ScmStreamPutLine(pOut, szTmp, cchTmp, enmEol); 5344 5351 if (RT_FAILURE(rc)) 5345 return false;5352 return kScmUnmodified; 5346 5353 5347 5354 /* Copy out the remaining lines (assumes no #pragma once here). */ … … 5350 5357 rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol); 5351 5358 if (RT_FAILURE(rc)) 5352 return false;5353 } 5354 } 5355 5356 return fRet ;5359 return kScmUnmodified; 5360 } 5361 } 5362 5363 return fRet ? kScmModified : kScmUnmodified; 5357 5364 } 5358 5365 … … 5363 5370 * PAGE_BASE_MASK. 5364 5371 * 5365 * @returns true if modifications were made, false if not.5372 * @returns kScmUnmodified - requires manual fix. 5366 5373 * @param pIn The input stream. 5367 5374 * @param pOut The output stream. 5368 5375 * @param pSettings The settings. 5369 5376 */ 5370 boolrewrite_PageChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)5377 SCMREWRITERRES rewrite_PageChecks(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 5371 5378 { 5372 5379 RT_NOREF(pOut); 5373 5380 if (!pSettings->fOnlyGuestHostPage && !pSettings->fNoASMMemPageUse) 5374 return false;5381 return kScmUnmodified; 5375 5382 5376 5383 static RTSTRTUPLE const g_aWords[] = … … 5435 5442 } 5436 5443 5437 return false;5444 return kScmUnmodified; 5438 5445 } 5439 5446 … … 5443 5450 * status codes (HRESULT). 5444 5451 * 5445 * @returns true if modifications were made, false if not.5452 * @returns kScmUnmodified - requires manual fix. 5446 5453 * @param pIn The input stream. 5447 5454 * @param pOut The output stream. … … 5450 5457 * @note Used in Main to avoid ambiguity when just using rc. 5451 5458 */ 5452 boolrewrite_ForceHrcVrcInsteadOfRc(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)5459 SCMREWRITERRES rewrite_ForceHrcVrcInsteadOfRc(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 5453 5460 { 5454 5461 RT_NOREF(pOut); 5455 5462 if (!pSettings->fOnlyHrcVrcInsteadOfRc) 5456 return false;5463 return kScmUnmodified; 5457 5464 5458 5465 static const SCMMATCHWORD s_aHresultVrc[] = … … 5556 5563 } 5557 5564 5558 return false;5565 return kScmUnmodified; 5559 5566 } 5560 5567 … … 5563 5570 * Rewrite a C/C++ source or header file. 5564 5571 * 5565 * @returns true if modifications were made, false if not.5572 * @returns Modification state. 5566 5573 * @param pIn The input stream. 5567 5574 * @param pOut The output stream. … … 5591 5598 * - string.h -> iprt/string.h, stdarg.h -> iprt/stdarg.h, etc. 5592 5599 */ 5593 boolrewrite_C_and_CPP(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)5600 SCMREWRITERRES rewrite_C_and_CPP(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 5594 5601 { 5595 5602 5596 5603 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.