Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs

Issue 10908249: Remove windows line ending from repo files (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: fix copyright headers Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs
diff --git a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs
index 2db604a1e24ff696a7e3d3802b430b38218ea64b..57ea2537f0254d62f67aa145832b7379bc779fd4 100644
--- a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs
+++ b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs
@@ -1,101 +1,101 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using System.IO;
-using System.Text.RegularExpressions;
-
-namespace NaCl.Build.CPPTasks
-{
- class GCCUtilities
- {
- public const int s_CommandLineLength = 256;
-
- public static string Convert_Path_Windows_To_Posix(string path)
- {
- return path.Replace('\\', '/');
- }
-
- public static string Convert_Path_Posix_To_Windows(string path)
- {
- path = path.Replace('/', '\\');
- // also make double backslashes a single slash
- // TODO: speed this up by iterating instead of two replaces
- return path.Replace("\\\\", "\\");
- }
-
- // replace GCC error are warning output to Visual Studio format to support going to source code from error output.
- public static string Convert_Output_GCC_to_VS(string line)
- {
- string result;
- foreach (GCCRegexLineConverter converter in s_RegexConverters)
- {
- result = converter.Convert(line);
- if (result.Length > 0)
- {
- return result;
- }
- }
-
- return line;
- }
-
- private class GCCRegexLineConverter
- {
- public Regex OutputExpression { get; set; }
-
- //public string OutputIdentifier { get; set; }
- public string FilenameIdentifier { get; set; }
- public string RemainderIdentifier { get; set; }
-
- // returns empty string if cannot convert.
- public string Convert(string line)
- {
- //Regex expression = new Regex(OutputIdentifier);
- if (OutputExpression.IsMatch(line))
- {
- string filename = OutputExpression.Replace(line, FilenameIdentifier);
-
- // GetFullPath may throw an exception.
- try
- {
- string fullPath = Path.GetFullPath(filename);
- string remainder = OutputExpression.Replace(line, RemainderIdentifier);
-
- string newLine = fullPath + remainder;
-
- return newLine;
- }
- catch
- {
- }
- }
-
- return string.Empty;
- }
- } // GCCRegexLineConverter
-
- private static readonly List<GCCRegexLineConverter> s_RegexConverters = new List<GCCRegexLineConverter>
- {
- new GCCRegexLineConverter
- {
- OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*):([1-9]\d*):(.*$)"),
- FilenameIdentifier = @"$1",
- RemainderIdentifier = @"($2,$3):$4"
- },
- new GCCRegexLineConverter
- {
- OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*):(.*$)"),
- FilenameIdentifier = @"$1",
- RemainderIdentifier = @"($2):$3"
- },
- new GCCRegexLineConverter
- {
- OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:]*.*?):([1-9]\d*):(.*$)"),
- FilenameIdentifier = @"$2",
- RemainderIdentifier = @"($3):'$1' $4"
- }
- };
- } // GCCUtilities
-} // namespace
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace NaCl.Build.CPPTasks
+{
+ class GCCUtilities
+ {
+ public const int s_CommandLineLength = 256;
+
+ public static string Convert_Path_Windows_To_Posix(string path)
+ {
+ return path.Replace('\\', '/');
+ }
+
+ public static string Convert_Path_Posix_To_Windows(string path)
+ {
+ path = path.Replace('/', '\\');
+ // also make double backslashes a single slash
+ // TODO: speed this up by iterating instead of two replaces
+ return path.Replace("\\\\", "\\");
+ }
+
+ // replace GCC error are warning output to Visual Studio format to support going to source code from error output.
+ public static string Convert_Output_GCC_to_VS(string line)
+ {
+ string result;
+ foreach (GCCRegexLineConverter converter in s_RegexConverters)
+ {
+ result = converter.Convert(line);
+ if (result.Length > 0)
+ {
+ return result;
+ }
+ }
+
+ return line;
+ }
+
+ private class GCCRegexLineConverter
+ {
+ public Regex OutputExpression { get; set; }
+
+ //public string OutputIdentifier { get; set; }
+ public string FilenameIdentifier { get; set; }
+ public string RemainderIdentifier { get; set; }
+
+ // returns empty string if cannot convert.
+ public string Convert(string line)
+ {
+ //Regex expression = new Regex(OutputIdentifier);
+ if (OutputExpression.IsMatch(line))
+ {
+ string filename = OutputExpression.Replace(line, FilenameIdentifier);
+
+ // GetFullPath may throw an exception.
+ try
+ {
+ string fullPath = Path.GetFullPath(filename);
+ string remainder = OutputExpression.Replace(line, RemainderIdentifier);
+
+ string newLine = fullPath + remainder;
+
+ return newLine;
+ }
+ catch
+ {
+ }
+ }
+
+ return string.Empty;
+ }
+ } // GCCRegexLineConverter
+
+ private static readonly List<GCCRegexLineConverter> s_RegexConverters = new List<GCCRegexLineConverter>
+ {
+ new GCCRegexLineConverter
+ {
+ OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*):([1-9]\d*):(.*$)"),
+ FilenameIdentifier = @"$1",
+ RemainderIdentifier = @"($2,$3):$4"
+ },
+ new GCCRegexLineConverter
+ {
+ OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*):(.*$)"),
+ FilenameIdentifier = @"$1",
+ RemainderIdentifier = @"($2):$3"
+ },
+ new GCCRegexLineConverter
+ {
+ OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:]*.*?):([1-9]\d*):(.*$)"),
+ FilenameIdentifier = @"$2",
+ RemainderIdentifier = @"($3):'$1' $4"
+ }
+ };
+ } // GCCUtilities
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698