[PATCH] edid-decode: Fix Visual Studio builds. Use static crt while release compiles.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix Visual Studio build with project file edited and getsubopt from musl.
Uses static crt while release build to get rid of msvcrt.dll

Signed-off-by: Wencey Wang <wenceywang@xxxxxxxxxxx>
---
 vs/edid-decode.vcxproj         |  9 +++++--
 vs/edid-decode.vcxproj.filters | 12 +++++++++
 vs/getopt.h                    |  3 +++
 vs/getsubopt.c                 | 46 ++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 vs/getsubopt.c

diff --git a/vs/edid-decode.vcxproj b/vs/edid-decode.vcxproj
index c9213ab..7b840ac 100644
--- a/vs/edid-decode.vcxproj
+++ b/vs/edid-decode.vcxproj
@@ -21,13 +21,13 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
+    <PlatformToolset>v143</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
+    <PlatformToolset>v143</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
@@ -85,6 +85,7 @@
       <ConformanceMode>true</ConformanceMode>
       <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DisableSpecificWarnings>4244; 4018; 4267; 4996; 26451; 6385; 6001</DisableSpecificWarnings>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -94,6 +95,8 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\calc-gtf-cvt.cpp" />
+    <ClCompile Include="..\calc-ovt.cpp" />
     <ClCompile Include="getopt.c" />
     <ClCompile Include="..\edid-decode.cpp" />
     <ClCompile Include="..\parse-base-block.cpp" />
@@ -102,8 +105,10 @@
     <ClCompile Include="..\parse-displayid-block.cpp" />
     <ClCompile Include="..\parse-ls-ext-block.cpp" />
     <ClCompile Include="..\parse-vtb-ext-block.cpp" />
+    <ClCompile Include="getsubopt.c" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="..\oui.h" />
     <ClInclude Include="getopt.h" />
     <ClInclude Include="unistd.h" />
     <ClInclude Include="..\edid-decode.h" />
diff --git a/vs/edid-decode.vcxproj.filters b/vs/edid-decode.vcxproj.filters
index 68e8b7d..b98ab04 100644
--- a/vs/edid-decode.vcxproj.filters
+++ b/vs/edid-decode.vcxproj.filters
@@ -34,6 +34,15 @@
     <ClCompile Include="..\edid-decode.cpp">
       <Filter>edid-decode</Filter>
     </ClCompile>
+    <ClCompile Include="getsubopt.c">
+      <Filter>windows-unix</Filter>
+    </ClCompile>
+    <ClCompile Include="..\calc-gtf-cvt.cpp">
+      <Filter>edid-decode</Filter>
+    </ClCompile>
+    <ClCompile Include="..\calc-ovt.cpp">
+      <Filter>edid-decode</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\edid-decode.h">
@@ -45,5 +54,8 @@
     <ClInclude Include="unistd.h">
       <Filter>windows-unix</Filter>
     </ClInclude>
+    <ClInclude Include="..\oui.h">
+      <Filter>edid-decode</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/vs/getopt.h b/vs/getopt.h
index e34761d..a13c720 100644
--- a/vs/getopt.h
+++ b/vs/getopt.h
@@ -90,6 +90,9 @@ enum    		/* permitted values for its `has_arg' field...	*/
 
 extern int getopt_long( int, char * const [], const char *, const struct option *, int * );
 extern int getopt_long_only( int, char * const [], const char *, const struct option *, int * );
+
+extern int getsubopt(char** opt, char* const* keys, char** val);
+
 /*
  * Previous MinGW implementation had...
  */
diff --git a/vs/getsubopt.c b/vs/getsubopt.c
new file mode 100644
index 0000000..6aedffa
--- /dev/null
+++ b/vs/getsubopt.c
@@ -0,0 +1,46 @@
+/**
+ * Copyright © 2005-2020 Rich Felker, et al.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+int getsubopt(char** opt, char* const* keys, char** val)
+{
+	char* s = *opt;
+	int i;
+
+	*val = NULL;
+	*opt = strchr(s, ',');
+	if (*opt) *(*opt)++ = 0;
+	else *opt = s + strlen(s);
+
+	for (i = 0; keys[i]; i++) {
+		size_t l = strlen(keys[i]);
+		if (strncmp(keys[i], s, l)) continue;
+		if (s[l] == '=')
+			*val = s + l + 1;
+		else if (s[l]) continue;
+		return i;
+	}
+	return -1;
+}
-- 
2.33.0.windows.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux