From 86146e8c044a1aea2ea162701b1fc344d19e4dc3 Mon Sep 17 00:00:00 2001
From: Rob Mensching <rob@firegiant.com>
Date: Mon, 7 Nov 2022 23:05:41 -0800
Subject: Very minor cleanup

---
 src/ext/Http/wixext/HttpCompiler.cs           |  3 +--
 src/ext/Iis/wixext/IIsCompiler.cs             |  4 +---
 src/ext/NetFx/wixext/NetFxCompiler.cs         |  2 +-
 src/ext/Util/wixext/UtilCompiler.cs           | 15 +++++++++------
 src/wix/WixToolset.Core/Compiler_Bundle.cs    |  7 ++-----
 src/wix/WixToolset.Core/LocalizationParser.cs |  4 ++--
 6 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/ext/Http/wixext/HttpCompiler.cs b/src/ext/Http/wixext/HttpCompiler.cs
index 6c572470..51fdfebc 100644
--- a/src/ext/Http/wixext/HttpCompiler.cs
+++ b/src/ext/Http/wixext/HttpCompiler.cs
@@ -81,7 +81,6 @@ namespace WixToolset.Http
             string store = null;
             string thumbprint = null;
             var handleExisting = HandleExisting.Replace;
-            string handleExistingValue = null;
 
             foreach (var attrib in node.Attributes())
             {
@@ -96,7 +95,7 @@ namespace WixToolset.Http
                             appId = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                             break;
                         case "HandleExisting":
-                            handleExistingValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
+                            var handleExistingValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                             switch (handleExistingValue)
                             {
                                 case "replace":
diff --git a/src/ext/Iis/wixext/IIsCompiler.cs b/src/ext/Iis/wixext/IIsCompiler.cs
index cb573ad1..1fcf5f61 100644
--- a/src/ext/Iis/wixext/IIsCompiler.cs
+++ b/src/ext/Iis/wixext/IIsCompiler.cs
@@ -67,7 +67,6 @@ namespace WixToolset.Iis
             {
                 case "Component":
                     var componentId = context["ComponentId"];
-                    var directoryId = context["DirectoryId"];
 
                     switch (element.Name.LocalName)
                     {
@@ -265,7 +264,6 @@ namespace WixToolset.Iis
                 }
             }
 
-
             if (null == id)
             {
                 id = this.ParseHelper.CreateIdentifier("crt", componentId, binaryRef, certificatePath);
@@ -351,7 +349,7 @@ namespace WixToolset.Iis
 
             if (null == id)
             {
-                id = this.ParseHelper.CreateIdentifier("wsc", webId);
+                this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
             }
 
             this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
diff --git a/src/ext/NetFx/wixext/NetFxCompiler.cs b/src/ext/NetFx/wixext/NetFxCompiler.cs
index f3c91918..563cd19d 100644
--- a/src/ext/NetFx/wixext/NetFxCompiler.cs
+++ b/src/ext/NetFx/wixext/NetFxCompiler.cs
@@ -425,7 +425,7 @@ namespace WixToolset.Netfx
                             break;
                         case "RollForward":
                             rollForward = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
-                            switch (rollForward.ToLower())
+                            switch (rollForward.ToLowerInvariant())
                             {
                                 case "latestmajor":
                                     rollForward = "LatestMajor";
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs
index d937b4f1..47f82ca6 100644
--- a/src/ext/Util/wixext/UtilCompiler.cs
+++ b/src/ext/Util/wixext/UtilCompiler.cs
@@ -1232,10 +1232,7 @@ namespace WixToolset.Util
                 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name"));
             }
 
-            if (!element.Elements().Any())
-            {
-                this.Messaging.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, element.Name.LocalName, "FileSharePermission"));
-            }
+            var fileSharePermissionCount = 0;
 
             foreach (var child in element.Elements())
             {
@@ -1245,6 +1242,7 @@ namespace WixToolset.Util
                     {
                         case "FileSharePermission":
                             this.ParseFileSharePermissionElement(intermediate, section, child, id);
+                            ++fileSharePermissionCount;
                             break;
                         default:
                             this.ParseHelper.UnexpectedElement(element, child);
@@ -1257,6 +1255,11 @@ namespace WixToolset.Util
                 }
             }
 
+            if (fileSharePermissionCount == 0)
+            {
+                this.Messaging.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, element.Name.LocalName, "FileSharePermission"));
+            }
+
             this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4ConfigureSmbInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64);
             this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4ConfigureSmbUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64);
 
@@ -3521,7 +3524,7 @@ namespace WixToolset.Util
                             }
                             break;
                         case "SelectionLanguage":
-                            string selectionLanguage = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
+                            var selectionLanguage = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                             switch (selectionLanguage)
                             {
                                 case "XPath":
@@ -3653,7 +3656,7 @@ namespace WixToolset.Util
                             }
                             else
                             {
-                                string actionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
+                                var actionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                                 switch (actionValue)
                                 {
                                     case "create":
diff --git a/src/wix/WixToolset.Core/Compiler_Bundle.cs b/src/wix/WixToolset.Core/Compiler_Bundle.cs
index b9cf8e82..1976117c 100644
--- a/src/wix/WixToolset.Core/Compiler_Bundle.cs
+++ b/src/wix/WixToolset.Core/Compiler_Bundle.cs
@@ -11,7 +11,6 @@ namespace WixToolset.Core
     using WixToolset.Data;
     using WixToolset.Data.Burn;
     using WixToolset.Data.Symbols;
-    using WixToolset.Extensibility;
 
     /// <summary>
     /// Compiler of the WiX toolset.
@@ -278,7 +277,7 @@ namespace WixToolset.Core
                         case "ProviderKey":
                             this.ParseBundleProviderKeyAttribute(sourceLineNumbers, node, attrib);
                             break;
-                        // Unknown attributes were reported earlier.
+                            // Unknown attributes were reported earlier.
                     }
                 }
                 else
@@ -852,8 +851,6 @@ namespace WixToolset.Core
             }
         }
 
-
-
         /// <summary>
         /// Parses a BundleCustomData element.
         /// </summary>
@@ -1940,7 +1937,7 @@ namespace WixToolset.Core
                     logPathVariable = String.Concat("WixBundleLog_", id.Id);
                 }
             }
-             else if (logPathVariable != null)
+            else if (logPathVariable != null)
             {
                 this.Core.Write(ErrorMessages.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "LogPathVariable", logPathVariable, "Transaction"));
             }
diff --git a/src/wix/WixToolset.Core/LocalizationParser.cs b/src/wix/WixToolset.Core/LocalizationParser.cs
index 98e17fe5..995efe40 100644
--- a/src/wix/WixToolset.Core/LocalizationParser.cs
+++ b/src/wix/WixToolset.Core/LocalizationParser.cs
@@ -97,10 +97,10 @@ namespace WixToolset.Core
                     switch (attrib.Name.LocalName)
                     {
                         case "Codepage":
-                            codepage = Common.GetValidCodePage(attrib.Value, true, false, sourceLineNumbers);
+                            codepage = Common.GetValidCodePage(attrib.Value, allowNoChange: true, onlyAnsi: false, sourceLineNumbers);
                             break;
                         case "SummaryInformationCodepage":
-                            summaryInformationCodepage = Common.GetValidCodePage(attrib.Value, true, false, sourceLineNumbers);
+                            summaryInformationCodepage = Common.GetValidCodePage(attrib.Value, allowNoChange: true, onlyAnsi: false, sourceLineNumbers);
                             break;
                         case "Culture":
                             culture = attrib.Value;
-- 
cgit v1.2.3-55-g6feb