diff --git a/libs/libblade/libblade.sln b/libs/libblade/libblade.sln index 4e79f883b8..54989dbc28 100644 --- a/libs/libblade/libblade.sln +++ b/libs/libblade/libblade.sln @@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsodium", "..\win32\libso EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig", "..\win32\libconfig\libconfig.2015.vcxproj", "{1A234565-926D-49B2-83E4-D56E0C38C9F2}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blades", "test\blades.vcxproj", "{636D5B57-FC64-4A18-8D42-54209F8886BD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -141,6 +143,22 @@ Global {1A234565-926D-49B2-83E4-D56E0C38C9F2}.ReleaseDLL|x64.Build.0 = ReleaseDLL|x64 {1A234565-926D-49B2-83E4-D56E0C38C9F2}.ReleaseDLL|x86.ActiveCfg = ReleaseDLL|Win32 {1A234565-926D-49B2-83E4-D56E0C38C9F2}.ReleaseDLL|x86.Build.0 = ReleaseDLL|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Debug|x64.ActiveCfg = Debug|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Debug|x64.Build.0 = Debug|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Debug|x86.ActiveCfg = Debug|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Debug|x86.Build.0 = Debug|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.DebugDLL|x64.ActiveCfg = Debug|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.DebugDLL|x64.Build.0 = Debug|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.DebugDLL|x86.ActiveCfg = Debug|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.DebugDLL|x86.Build.0 = Debug|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Release|x64.ActiveCfg = Release|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Release|x64.Build.0 = Release|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Release|x86.ActiveCfg = Release|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.Release|x86.Build.0 = Release|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.ReleaseDLL|x64.ActiveCfg = Release|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.ReleaseDLL|x64.Build.0 = Release|x64 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.ReleaseDLL|x86.ActiveCfg = Release|Win32 + {636D5B57-FC64-4A18-8D42-54209F8886BD}.ReleaseDLL|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/libblade/src/include/blade.h b/libs/libblade/src/include/blade.h index b79242c709..f2b527689e 100644 --- a/libs/libblade/src/include/blade.h +++ b/libs/libblade/src/include/blade.h @@ -53,7 +53,7 @@ KS_BEGIN_EXTERN_C -#ifndef config_lookup_from +#ifdef _WIN32 #define config_lookup_from config_setting_lookup #endif diff --git a/libs/libblade/test/blades.vcxproj b/libs/libblade/test/blades.vcxproj new file mode 100644 index 0000000000..a4fdf9020c --- /dev/null +++ b/libs/libblade/test/blades.vcxproj @@ -0,0 +1,215 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {636D5B57-FC64-4A18-8D42-54209F8886BD} + Win32Proj + blades + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(SolutionDir)\openssl\include;$(IncludePath) + $(LibraryPath) + + + true + $(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(SolutionDir)\openssl\include64;$(IncludePath) + $(LibraryPath) + + + false + $(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(SolutionDir)\openssl\include;$(IncludePath) + $(LibraryPath) + + + false + $(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(SolutionDir)\openssl\include64;$(IncludePath) + $(LibraryPath) + + + + + + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)..\win32\openssl\include;$(SolutionDir)..\win32\openssl\include_x86;../src/include;. + 4090 + true + false + + + Console + true + + + + + + + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)..\win32\openssl\include;$(SolutionDir)..\win32\openssl\include_x64;../src/include;. + 4090 + true + false + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)..\win32\openssl\include;$(SolutionDir)..\win32\openssl\include_x86;../src/include;. + 4090 + true + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)..\win32\openssl\include;$(SolutionDir)..\win32\openssl\include_x64;../src/include;. + 4090 + true + + + Console + true + true + true + + + + + + + + + {70d178d8-1100-4152-86c0-809a91cff832} + + + {1a234565-926d-49b2-83e4-d56e0c38c9f2} + + + {a185b162-6cb6-4502-b03f-b56f7699a8d9} + + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + + + {a89d6d18-6203-4149-9051-f8e798e7a3e7} + + + + + + \ No newline at end of file diff --git a/libs/libks/src/ks_pool.c b/libs/libks/src/ks_pool.c index 17a40b9953..2b0b12d112 100644 --- a/libs/libks/src/ks_pool.c +++ b/libs/libks/src/ks_pool.c @@ -1833,7 +1833,34 @@ KS_DECLARE(void *) ks_pool_resize_ex(ks_pool_t *mp_p, void *old_addr, const unsi return NULL; } - old_byte_size = prefix->size; + old_byte_size = prefix->size - PREFIX_SIZE - FENCE_SIZE - prefix->padding; + + if (old_byte_size == new_byte_size) { + SET_POINTER(error_p, KS_STATUS_SUCCESS); + new_addr = old_addr; + goto end; + } + + if (old_byte_size >= new_byte_size) { + unsigned long diff = old_byte_size - new_byte_size; + //prefix->size -= diff; + prefix->padding += diff; + write_magic((char *)prefix + prefix->size - prefix->padding - FENCE_SIZE); + SET_POINTER(error_p, KS_STATUS_SUCCESS); + new_addr = old_addr; + goto end; + } + + { + unsigned long diff = new_byte_size - old_byte_size; + if (prefix->padding >= diff) { + prefix->padding -= diff; + write_magic((char *)prefix + prefix->size - prefix->padding - FENCE_SIZE); + SET_POINTER(error_p, KS_STATUS_SUCCESS); + new_addr = old_addr; + goto end; + } + } /* * If the size is larger than a block then the allocation must be at diff --git a/w32/config-version.props b/w32/config-version.props new file mode 100644 index 0000000000..1bd8fe7b12 --- /dev/null +++ b/w32/config-version.props @@ -0,0 +1,17 @@ + + + + + 1.5 + + + true + + + + + + $(ConfigVersion) + + + \ No newline at end of file diff --git a/w32/config.props b/w32/config.props new file mode 100644 index 0000000000..52e60c1b03 --- /dev/null +++ b/w32/config.props @@ -0,0 +1,18 @@ + + + + + + + + true + + + + $(ProjectDir)..\..\libconfig-$(ConfigVersion)\lib;%(AdditionalIncludeDirectories) + true + LIBCONFIG_EXPORTS;YY_NO_UNISTD_H;YY_USE_CONST;%(PreprocessorDefinitions) + + + + diff --git a/w32/sodium-version.props b/w32/sodium-version.props new file mode 100644 index 0000000000..a63082b764 --- /dev/null +++ b/w32/sodium-version.props @@ -0,0 +1,17 @@ + + + + + 1.0.12 + + + true + + + + + + $(SodiumVersion) + + + \ No newline at end of file diff --git a/w32/sodium.props b/w32/sodium.props new file mode 100644 index 0000000000..a5700a1882 --- /dev/null +++ b/w32/sodium.props @@ -0,0 +1,20 @@ + + + + + + + + true + + + + $(ProjectDir)..\..\libsodium-$(SodiumVersion)\src\libsodium\include\sodium;%(AdditionalIncludeDirectories) + true + UNICODE;_UNICODE;%(PreprocessorDefinitions) + NATIVE_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) + inline=__inline;%(PreprocessorDefinitions) + + + +