Skip to content

Commit 84f68cd

Browse files
committed
Removed ZlibResult and made its members output parameters in ZlibEncoder and ZlibDecoder.
Also this change also abstracted away the need for the ComputeHash methods for this. Also the user can implement an interface and set a property where the code would use their own hash algorithm as well. Signed-off-by: AraHaan <[email protected]>
1 parent 096647c commit 84f68cd

25 files changed

Lines changed: 943 additions & 347 deletions

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<DebugType>embedded</DebugType>

ZlibSharp.sln

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30114.105
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36518.9
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8D38FC0-1023-473E-A78B-6AAFCE5E18FF}"
77
EndProject
@@ -11,26 +11,71 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4E63757D
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibSharp.Tests", "tests\ZlibSharp.Tests.csproj", "{62F17F63-2EEC-4658-8F1F-25B96C01B63B}"
1313
EndProject
14+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZlibSharp.Native", "src\ZlibSharp.Native\ZlibSharp.Native.vcxproj", "{EEF9480E-A73E-45A0-BB86-77C738680C00}"
15+
EndProject
1416
Global
1517
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1618
Debug|Any CPU = Debug|Any CPU
19+
Debug|ARM64 = Debug|ARM64
20+
Debug|x64 = Debug|x64
21+
Debug|x86 = Debug|x86
1722
Release|Any CPU = Release|Any CPU
18-
EndGlobalSection
19-
GlobalSection(SolutionProperties) = preSolution
20-
HideSolutionNode = FALSE
21-
EndGlobalSection
22-
GlobalSection(NestedProjects) = preSolution
23-
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5} = {E8D38FC0-1023-473E-A78B-6AAFCE5E18FF}
24-
{62F17F63-2EEC-4658-8F1F-25B96C01B63B} = {4E63757D-7E5B-4116-BDE9-F9343D31A7F3}
23+
Release|ARM64 = Release|ARM64
24+
Release|x64 = Release|x64
25+
Release|x86 = Release|x86
2526
EndGlobalSection
2627
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2728
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2829
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|ARM64.ActiveCfg = Debug|Any CPU
31+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|ARM64.Build.0 = Debug|Any CPU
32+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|x64.ActiveCfg = Debug|Any CPU
33+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|x64.Build.0 = Debug|Any CPU
34+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|x86.ActiveCfg = Debug|Any CPU
35+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Debug|x86.Build.0 = Debug|Any CPU
2936
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
3037
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Release|ARM64.ActiveCfg = Release|Any CPU
39+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Release|x64.ActiveCfg = Release|Any CPU
40+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5}.Release|x86.ActiveCfg = Release|Any CPU
3141
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3242
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
44+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|ARM64.Build.0 = Debug|Any CPU
45+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|x64.ActiveCfg = Debug|Any CPU
46+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|x64.Build.0 = Debug|Any CPU
47+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|x86.ActiveCfg = Debug|Any CPU
48+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Debug|x86.Build.0 = Debug|Any CPU
3349
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Release|Any CPU.ActiveCfg = Release|Any CPU
3450
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Release|Any CPU.Build.0 = Release|Any CPU
51+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Release|ARM64.ActiveCfg = Release|Any CPU
52+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Release|x64.ActiveCfg = Release|Any CPU
53+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B}.Release|x86.ActiveCfg = Release|Any CPU
54+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|Any CPU.ActiveCfg = Debug|x64
55+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|Any CPU.Build.0 = Debug|x64
56+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|ARM64.ActiveCfg = Debug|x64
57+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|ARM64.Build.0 = Debug|x64
58+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|x64.ActiveCfg = Debug|x64
59+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|x64.Build.0 = Debug|x64
60+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|x86.ActiveCfg = Debug|Win32
61+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Debug|x86.Build.0 = Debug|Win32
62+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|Any CPU.ActiveCfg = Release|x64
63+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|ARM64.ActiveCfg = Release|ARM64
64+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|ARM64.Build.0 = Release|ARM64
65+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|x64.ActiveCfg = Release|x64
66+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|x64.Build.0 = Release|x64
67+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|x86.ActiveCfg = Release|Win32
68+
{EEF9480E-A73E-45A0-BB86-77C738680C00}.Release|x86.Build.0 = Release|Win32
69+
EndGlobalSection
70+
GlobalSection(SolutionProperties) = preSolution
71+
HideSolutionNode = FALSE
72+
EndGlobalSection
73+
GlobalSection(NestedProjects) = preSolution
74+
{3A7B5BBE-2310-4C59-A5FA-6BB88EE95BF5} = {E8D38FC0-1023-473E-A78B-6AAFCE5E18FF}
75+
{62F17F63-2EEC-4658-8F1F-25B96C01B63B} = {4E63757D-7E5B-4116-BDE9-F9343D31A7F3}
76+
{EEF9480E-A73E-45A0-BB86-77C738680C00} = {E8D38FC0-1023-473E-A78B-6AAFCE5E18FF}
77+
EndGlobalSection
78+
GlobalSection(ExtensibilityGlobals) = postSolution
79+
SolutionGuid = {1C94FD59-8F76-47F3-9BCB-ED7865805123}
3580
EndGlobalSection
3681
EndGlobal
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<Project>
2+
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|Win32">
9+
<Configuration>Debug</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release|ARM64">
13+
<Configuration>Release</Configuration>
14+
<Platform>ARM64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|Win32">
17+
<Configuration>Release</Configuration>
18+
<Platform>Win32</Platform>
19+
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Debug|x64">
21+
<Configuration>Debug</Configuration>
22+
<Platform>x64</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|x64">
25+
<Configuration>Release</Configuration>
26+
<Platform>x64</Platform>
27+
</ProjectConfiguration>
28+
</ItemGroup>
29+
30+
<PropertyGroup Label="Configuration">
31+
<ConfigurationType>DynamicLibrary</ConfigurationType>
32+
<UseDebugLibraries>false</UseDebugLibraries>
33+
<UseDebugLibraries Condition="'$(Configuration)' == 'Debug'">true</UseDebugLibraries>
34+
<PlatformToolset>v143</PlatformToolset>
35+
<WholeProgramOptimization Condition="'$(Configuration)' == 'Release'">true</WholeProgramOptimization>
36+
<CharacterSet>Unicode</CharacterSet>
37+
<IntDir>obj\$(Configuration)\$(Platform)\</IntDir>
38+
<OutDir Condition="'$(Platform)' == 'Win32'">..\ZlibSharp\bin\$(Configuration)\net10.0\runtimes\win-x86\</OutDir>
39+
<OutDir Condition="'$(Platform)' == 'x64'">..\ZlibSharp\bin\$(Configuration)\net10.0\runtimes\win-x64\</OutDir>
40+
<OutDir Condition="'$(Platform)' == 'ARM64'">..\ZlibSharp\bin\$(Configuration)\net10.0\runtimes\win-arm64\</OutDir>
41+
</PropertyGroup>
42+
43+
<ImportGroup Label="PropertySheets">
44+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
45+
</ImportGroup>
46+
47+
<ItemDefinitionGroup>
48+
<ClCompile>
49+
<WarningLevel>Level3</WarningLevel>
50+
<FunctionLevelLinking Condition="'$(Configuration)' == 'Release'">true</FunctionLevelLinking>
51+
<IntrinsicFunctions Condition="'$(Configuration)' == 'Release'">true</IntrinsicFunctions>
52+
<SDLCheck>true</SDLCheck>
53+
<PreprocessorDefinitions>ZLIBSHARPNATIVE_EXPORTS;_WINDOWS;_USRDLL;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
54+
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32'">WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
55+
<PreprocessorDefinitions Condition="'$(Configuration)' == 'Debug'">_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56+
<PreprocessorDefinitions Condition="'$(Configuration)' == 'Release'">NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57+
<ConformanceMode>true</ConformanceMode>
58+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
59+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
60+
<AdditionalIncludeDirectories>./zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
61+
<DebugInformationFormat Condition="'$(Configuration)' == 'Release'">None</DebugInformationFormat>
62+
</ClCompile>
63+
<Link>
64+
<SubSystem>Windows</SubSystem>
65+
<GenerateDebugInformation>true</GenerateDebugInformation>
66+
<GenerateDebugInformation Condition="'$(Configuration)' == 'Release'">false</GenerateDebugInformation>
67+
<EnableUAC>false</EnableUAC>
68+
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
69+
<ProfileGuidedDatabase>$(IntDir)$(TargetName).pgd</ProfileGuidedDatabase>
70+
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
71+
</Link>
72+
</ItemDefinitionGroup>
73+
74+
</Project>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<ClInclude Include="main.h" />
5+
<ClInclude Include=".\zlib\deflate.h" />
6+
<ClInclude Include=".\zlib\gzguts.h" />
7+
<ClInclude Include=".\zlib\inffast.h" />
8+
<ClInclude Include=".\zlib\inffixed.h" />
9+
<ClInclude Include=".\zlib\inflate.h" />
10+
<ClInclude Include=".\zlib\inftrees.h" />
11+
<ClInclude Include=".\zlib\trees.h" />
12+
<ClInclude Include=".\zlib\zconf.h" />
13+
<ClInclude Include=".\zlib\zlib.h" />
14+
<ClInclude Include=".\zlib\zutil.h" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<ClCompile Include="main.c" />
18+
<ClCompile Include=".\zlib\adler32.c" />
19+
<ClCompile Include=".\zlib\compress.c" />
20+
<ClCompile Include=".\zlib\crc32.c" />
21+
<ClCompile Include=".\zlib\deflate.c" />
22+
<ClCompile Include=".\zlib\gzclose.c" />
23+
<ClCompile Include=".\zlib\gzlib.c" />
24+
<ClCompile Include=".\zlib\gzread.c" />
25+
<ClCompile Include=".\zlib\gzwrite.c" />
26+
<ClCompile Include=".\zlib\infback.c" />
27+
<ClCompile Include=".\zlib\inffast.c" />
28+
<ClCompile Include=".\zlib\inflate.c" />
29+
<ClCompile Include=".\zlib\inftrees.c" />
30+
<ClCompile Include=".\zlib\trees.c" />
31+
<ClCompile Include=".\zlib\uncompr.c" />
32+
<ClCompile Include=".\zlib\zutil.c" />
33+
</ItemGroup>
34+
<PropertyGroup Label="Globals">
35+
<VCProjectVersion>17.0</VCProjectVersion>
36+
<Keyword>Win32Proj</Keyword>
37+
<ProjectGuid>{eef9480e-a73e-45a0-bb86-77c738680c00}</ProjectGuid>
38+
<RootNamespace>ZlibSharpNative</RootNamespace>
39+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
40+
</PropertyGroup>
41+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
42+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
43+
<ImportGroup Label="ExtensionSettings">
44+
</ImportGroup>
45+
<ImportGroup Label="Shared">
46+
</ImportGroup>
47+
<PropertyGroup Label="UserMacros" />
48+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
49+
<ImportGroup Label="ExtensionTargets">
50+
</ImportGroup>
51+
</Project>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
<Filter Include="Source Files\zlib">
17+
<UniqueIdentifier>{8817f746-47f8-48bc-9ac4-02d27e85af52}</UniqueIdentifier>
18+
</Filter>
19+
<Filter Include="Header Files\zlib">
20+
<UniqueIdentifier>{7d20d484-e734-40a6-b6ec-69718e383404}</UniqueIdentifier>
21+
</Filter>
22+
</ItemGroup>
23+
<ItemGroup>
24+
<ClCompile Include="main.c">
25+
<Filter>Source Files</Filter>
26+
</ClCompile>
27+
<ClCompile Include=".\zlib\adler32.c">
28+
<Filter>Source Files\zlib</Filter>
29+
</ClCompile>
30+
<ClCompile Include=".\zlib\compress.c">
31+
<Filter>Source Files\zlib</Filter>
32+
</ClCompile>
33+
<ClCompile Include=".\zlib\crc32.c">
34+
<Filter>Source Files\zlib</Filter>
35+
</ClCompile>
36+
<ClCompile Include=".\zlib\deflate.c">
37+
<Filter>Source Files\zlib</Filter>
38+
</ClCompile>
39+
<ClCompile Include=".\zlib\gzclose.c">
40+
<Filter>Source Files\zlib</Filter>
41+
</ClCompile>
42+
<ClCompile Include=".\zlib\gzlib.c">
43+
<Filter>Source Files\zlib</Filter>
44+
</ClCompile>
45+
<ClCompile Include=".\zlib\gzread.c">
46+
<Filter>Source Files\zlib</Filter>
47+
</ClCompile>
48+
<ClCompile Include=".\zlib\gzwrite.c">
49+
<Filter>Source Files\zlib</Filter>
50+
</ClCompile>
51+
<ClCompile Include=".\zlib\infback.c">
52+
<Filter>Source Files\zlib</Filter>
53+
</ClCompile>
54+
<ClCompile Include=".\zlib\inffast.c">
55+
<Filter>Source Files\zlib</Filter>
56+
</ClCompile>
57+
<ClCompile Include=".\zlib\inflate.c">
58+
<Filter>Source Files\zlib</Filter>
59+
</ClCompile>
60+
<ClCompile Include=".\zlib\inftrees.c">
61+
<Filter>Source Files\zlib</Filter>
62+
</ClCompile>
63+
<ClCompile Include=".\zlib\trees.c">
64+
<Filter>Source Files\zlib</Filter>
65+
</ClCompile>
66+
<ClCompile Include=".\zlib\uncompr.c">
67+
<Filter>Source Files\zlib</Filter>
68+
</ClCompile>
69+
<ClCompile Include=".\zlib\zutil.c">
70+
<Filter>Source Files\zlib</Filter>
71+
</ClCompile>
72+
</ItemGroup>
73+
<ItemGroup>
74+
<ClInclude Include="main.h">
75+
<Filter>Header Files</Filter>
76+
</ClInclude>
77+
<ClInclude Include=".\zlib\deflate.h">
78+
<Filter>Header Files\zlib</Filter>
79+
</ClInclude>
80+
<ClInclude Include=".\zlib\gzguts.h">
81+
<Filter>Header Files\zlib</Filter>
82+
</ClInclude>
83+
<ClInclude Include=".\zlib\inffast.h">
84+
<Filter>Header Files\zlib</Filter>
85+
</ClInclude>
86+
<ClInclude Include=".\zlib\inffixed.h">
87+
<Filter>Header Files\zlib</Filter>
88+
</ClInclude>
89+
<ClInclude Include=".\zlib\inflate.h">
90+
<Filter>Header Files\zlib</Filter>
91+
</ClInclude>
92+
<ClInclude Include=".\zlib\inftrees.h">
93+
<Filter>Header Files\zlib</Filter>
94+
</ClInclude>
95+
<ClInclude Include=".\zlib\trees.h">
96+
<Filter>Header Files\zlib</Filter>
97+
</ClInclude>
98+
<ClInclude Include=".\zlib\zconf.h">
99+
<Filter>Header Files\zlib</Filter>
100+
</ClInclude>
101+
<ClInclude Include=".\zlib\zlib.h">
102+
<Filter>Header Files\zlib</Filter>
103+
</ClInclude>
104+
<ClInclude Include=".\zlib\zutil.h">
105+
<Filter>Header Files\zlib</Filter>
106+
</ClInclude>
107+
</ItemGroup>
108+
</Project>

0 commit comments

Comments
 (0)