Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,9 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs

CMakeCache.txt
CMakeFiles/
MSBuild_Logs/
cmake_uninstall.cmake
native_build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "zstd"]
path = zstd
url = https://github.com/facebook/zstd
2 changes: 1 addition & 1 deletion Zstandard.Net.Benchmark/Zstandard.Net.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<Reference Include="netstandard">
<HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.1\build\netstandard2.0\ref\netstandard.dll</HintPath>
<HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.1\build\netstandard2.1\ref\netstandard.dll</HintPath>
</Reference>
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions Zstandard.Net.Tests/Zstandard.Net.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,9 +11,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 2 additions & 14 deletions Zstandard.Net.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 17
VisualStudioVersion = 17.0.31606.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zstandard.Net", "Zstandard.Net\Zstandard.Net.csproj", "{054BA829-FE7C-476C-A335-FB8CCB552F05}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zstandard.Net.Tests", "Zstandard.Net.Tests\Zstandard.Net.Tests.csproj", "{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zstandard.Net.Sandbox", "Zstandard.Net.Sandbox\Zstandard.Net.Sandbox.csproj", "{2F3734C8-67F5-42C4-BEE3-BCA10285E310}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zstandard.Net.Benchmark", "Zstandard.Net.Benchmark\Zstandard.Net.Benchmark.csproj", "{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -25,14 +21,6 @@ Global
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5623F4A5-9E4D-4BB7-BB46-9B50CC291321}.Release|Any CPU.Build.0 = Release|Any CPU
{2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F3734C8-67F5-42C4-BEE3-BCA10285E310}.Release|Any CPU.Build.0 = Release|Any CPU
{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7273C9EE-8EBD-466B-8AC7-FFC830D15E19}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 6 additions & 12 deletions Zstandard.Net/Zstandard.Net.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<RootNamespace>Zstandard.Net</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>bp74</Authors>
Expand All @@ -11,28 +11,22 @@
<PackageLicenseUrl>https://github.com/bp74/Zstandard.Net/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/bp74/Zstandard.Net</RepositoryUrl>
<PackageTags>Compression Stream Zstandard Zstd</PackageTags>
<PackageReleaseNotes>fixed unmanaged resource leak
</PackageReleaseNotes>
<Version>1.1.7</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.1.8</Version>
</PropertyGroup>

<ItemGroup>
<None Include="build\x64\libzstd.dll">
<None Include="build\x64\zstd.dll">
<Link>x64\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="build\x86\libzstd.dll">
<Link>x86\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Include="build\**\*" Pack="true" PackagePath="build\" />
<None Include="build\x64\zstd.dll" Pack="true" PackagePath="runtimes/win-x64/native/zstd.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
</ItemGroup>

</Project>
50 changes: 25 additions & 25 deletions Zstandard.Net/ZstandardInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static ZstandardInterop()
{
var root = Path.GetDirectoryName(typeof(ZstandardInterop).Assembly.Location);
var path = Environment.Is64BitProcess ? "x64" : "x86";
var file = Path.Combine(root, path, "libzstd.dll");
var file = Path.Combine(root, path, "zstd.dll");
LoadLibraryEx(file, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
}
}
Expand Down Expand Up @@ -60,84 +60,84 @@ private enum LoadLibraryFlags : uint
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern uint ZSTD_versionNumber();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern int ZSTD_maxCLevel();

//-----------------------------------------------------------------------------------------

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createCStream();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initCStream(IntPtr zcs, int compressionLevel);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCStream(IntPtr zcs);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamInSize();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_CStreamOutSize();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_compressStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer, [MarshalAs(UnmanagedType.LPStruct)] Buffer inputBuffer);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createCDict(IntPtr dictBuffer, UIntPtr dictSize, int compressionLevel);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeCDict(IntPtr cdict);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initCStream_usingCDict(IntPtr zcs, IntPtr cdict);

//-----------------------------------------------------------------------------------------

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createDStream();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initDStream(IntPtr zds);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDStream(IntPtr zds);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamInSize();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_DStreamOutSize();

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_decompressStream(IntPtr zds, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer, [MarshalAs(UnmanagedType.LPStruct)] Buffer inputBuffer);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ZSTD_createDDict(IntPtr dictBuffer, UIntPtr dictSize);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_freeDDict(IntPtr ddict);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_initDStream_usingDDict(IntPtr zds, IntPtr ddict);

//-----------------------------------------------------------------------------------------

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_flushStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
public static extern UIntPtr ZSTD_endStream(IntPtr zcs, [MarshalAs(UnmanagedType.LPStruct)] Buffer outputBuffer);

//-----------------------------------------------------------------------------------------

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool ZSTD_isError(UIntPtr code);

[DllImport("libzstd", CallingConvention = CallingConvention.Cdecl)]
[DllImport("zstd", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr ZSTD_getErrorName(UIntPtr code);
}
}
16 changes: 1 addition & 15 deletions Zstandard.Net/build/Zstandard.Net.targets
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(Platform)' == 'AnyCPU'">
<None Include="$(MSBuildThisFileDirectory)x64\libzstd.dll">
<Link>x64\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)x86\libzstd.dll">
<Link>x86\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)x64\libzstd.dll" Condition="'$(Platform)' == 'x64'">
<Link>%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)x86\libzstd.dll" Condition="'$(Platform)' == 'x86'">
<None Include="$(MSBuildThisFileDirectory)x64\zstd.dll" Condition="'$(Platform)' == 'x64'">
<Link>%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Binary file removed Zstandard.Net/build/x64/libzstd.dll
Binary file not shown.
Binary file removed Zstandard.Net/build/x86/libzstd.dll
Binary file not shown.
17 changes: 17 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version: 1.0.{build}
image: Visual Studio 2019

branches:
only:
- feature/submodule

build:
verbosity: minimal

install:
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive

build_script:
- cmake -G "Visual Studio 16 2019" -A x64 -B native_build -S zstd\build\cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_PROGRAMS=false -DZSTD_BUILD_CONTRIB=false -DZSTD_BUILD_SHARED=True -DCMAKE_INSTALL_PREFIX=.\Zstandard.Net\Zstandard.Net\build\x64 -DVcpkgEnabled=false
- msbuild native_build\zstd.sln /p:Configuration=Release /p:Platform="x64" /p:VcpkgEnabled=false /p:OutDir=.\Zstandard.Net\Zstandard.Net\build\x64
3 changes: 3 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REM cmake.exe -G "Visual Studio 16 2019" -A x64 -B native_build -S zstd\build\cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_PROGRAMS=false -DZSTD_BUILD_CONTRIB=false -DZSTD_BUILD_SHARED=True -DCMAKE_INSTALL_PREFIX=.\Zstandard.Net\Zstandard.Net\build\x64 -DVcpkgEnabled=false
REM msbuild native_build\zstd.sln /p:Configuration=Release /p:Platform="x64" /p:VcpkgEnabled=false /p:OutDir=.\Zstandard.Net\Zstandard.Net\build\x64
dotnet build -c Release
1 change: 1 addition & 0 deletions zstd
Submodule zstd added at a488ba