Browse Source

Fixed a few warnings.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/804/head
Dimitar Dobrev 8 years ago
parent
commit
120e386ad9
  1. 1
      src/AST/Module.cs
  2. 25
      src/Core/Toolchains/MSVCToolchain.cs

1
src/AST/Module.cs

@ -60,6 +60,5 @@ namespace CppSharp.AST
private string sharedLibraryName; private string sharedLibraryName;
private string symbolsLibraryName; private string symbolsLibraryName;
private string templatesLibraryName;
} }
} }

25
src/Core/Toolchains/MSVCToolchain.cs

@ -305,7 +305,7 @@ namespace CppSharp
var dirPrefix = windowsSdkMajorVer + "."; var dirPrefix = windowsSdkMajorVer + ".";
var includeDir = var includeDir =
(from dir in Directory.EnumerateDirectories(parentIncludeDir).OrderByDescending(d => d) (from dir in Directory.EnumerateDirectories(parentIncludeDir).OrderByDescending(d => d)
where Path.GetFileName(dir).StartsWith(dirPrefix) where Path.GetFileName(dir).StartsWith(dirPrefix, StringComparison.Ordinal)
select Path.Combine(windowsKitSdk.Directory, include, dir)).FirstOrDefault(); select Path.Combine(windowsKitSdk.Directory, include, dir)).FirstOrDefault();
if (!string.IsNullOrEmpty(includeDir)) if (!string.IsNullOrEmpty(includeDir))
includes.Add(Path.Combine(includeDir, Path.GetFileName(path))); includes.Add(Path.Combine(includeDir, Path.GetFileName(path)));
@ -570,22 +570,22 @@ namespace CppSharp
var hive = (RegistryHive)0; var hive = (RegistryHive)0;
subKey = null; subKey = null;
if (keyPath.StartsWith("HKEY_CLASSES_ROOT\\")) if (keyPath.StartsWith("HKEY_CLASSES_ROOT\\", StringComparison.Ordinal))
{ {
hive = RegistryHive.ClassesRoot; hive = RegistryHive.ClassesRoot;
subKey = keyPath.Substring(18); subKey = keyPath.Substring(18);
} }
else if (keyPath.StartsWith("HKEY_USERS\\")) else if (keyPath.StartsWith("HKEY_USERS\\", StringComparison.Ordinal))
{ {
hive = RegistryHive.Users; hive = RegistryHive.Users;
subKey = keyPath.Substring(11); subKey = keyPath.Substring(11);
} }
else if (keyPath.StartsWith("HKEY_LOCAL_MACHINE\\")) else if (keyPath.StartsWith("HKEY_LOCAL_MACHINE\\", StringComparison.Ordinal))
{ {
hive = RegistryHive.LocalMachine; hive = RegistryHive.LocalMachine;
subKey = keyPath.Substring(19); subKey = keyPath.Substring(19);
} }
else if (keyPath.StartsWith("HKEY_CURRENT_USER\\")) else if (keyPath.StartsWith("HKEY_CURRENT_USER\\", StringComparison.Ordinal))
{ {
hive = RegistryHive.CurrentUser; hive = RegistryHive.CurrentUser;
subKey = keyPath.Substring(18); subKey = keyPath.Substring(18);
@ -609,11 +609,9 @@ namespace CppSharp
try try
{ {
var query = new SetupConfiguration(); var query = new SetupConfiguration();
var query2 = (ISetupConfiguration2)query; var query2 = (ISetupConfiguration2) query;
var e = query2.EnumAllInstances(); var e = query2.EnumAllInstances();
var helper = (ISetupHelper)query;
int fetched; int fetched;
var instances = new ISetupInstance[1]; var instances = new ISetupInstance[1];
do do
@ -621,7 +619,7 @@ namespace CppSharp
e.Next(1, instances, out fetched); e.Next(1, instances, out fetched);
if (fetched > 0) if (fetched > 0)
{ {
var instance = (ISetupInstance2)instances[0]; var instance = (ISetupInstance2) instances[0];
if (instance.GetInstallationPath() != vsDir) continue; if (instance.GetInstallationPath() != vsDir) continue;
var packages = instance.GetPackages(); var packages = instance.GetPackages();
var vc_tools = from package in packages var vc_tools = from package in packages
@ -696,11 +694,11 @@ namespace CppSharp
/// <returns>Success of the operation</returns> /// <returns>Success of the operation</returns>
private static bool GetVs2017Instances(ICollection<ToolchainVersion> versions) private static bool GetVs2017Instances(ICollection<ToolchainVersion> versions)
{ {
const int REGDB_E_CLASSNOTREG = unchecked((int)0x80040154); const int REGDB_E_CLASSNOTREG = unchecked((int) 0x80040154);
try try
{ {
var query = new SetupConfiguration(); var query = new SetupConfiguration();
var query2 = (ISetupConfiguration2)query; var query2 = (ISetupConfiguration2) query;
var e = query2.EnumAllInstances(); var e = query2.EnumAllInstances();
int fetched; int fetched;
var instances = new ISetupInstance[1]; var instances = new ISetupInstance[1];
@ -709,12 +707,11 @@ namespace CppSharp
e.Next(1, instances, out fetched); e.Next(1, instances, out fetched);
if (fetched > 0) if (fetched > 0)
{ {
var instance = (ISetupInstance2)instances[0]; var instance = (ISetupInstance2) instances[0];
var packages = instance.GetPackages();
var toolchain = new ToolchainVersion var toolchain = new ToolchainVersion
{ {
Directory = instance.GetInstallationPath() + @"\Common7\IDE", Directory = instance.GetInstallationPath() + @"\Common7\IDE",
Version = Single.Parse(instance.GetInstallationVersion().Remove(2)), Version = float.Parse(instance.GetInstallationVersion().Remove(2)),
Value = null // Not used currently Value = null // Not used currently
}; };
versions.Add(toolchain); versions.Add(toolchain);

Loading…
Cancel
Save