]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Updated Visual projects
authorYann Collet <yann.collet.73@gmail.com>
Sun, 5 Jul 2015 00:23:52 +0000 (16:23 -0800)
committerYann Collet <yann.collet.73@gmail.com>
Sun, 5 Jul 2015 00:23:52 +0000 (16:23 -0800)
programs/datagen.c
visual/2012/fullbench/fullbench.vcxproj
visual/2012/fullbench/fullbench.vcxproj.filters
visual/2012/fuzzer/fuzzer.vcxproj
visual/2012/zstd.sln [changed mode: 0755->0644]
visual/2012/zstd/zstd.vcxproj

index 20eb30e999f431f5431b1ed1ace50dd7f294d62e..9df9da84197bb68d162a760804445ae6b862cde8 100644 (file)
 #define PRIME2   2246822519U
 
 
+/**************************************
+*  Local types
+**************************************/
+#define LTLOG 13
+#define LTSIZE (1<<LTLOG)
+#define LTMASK (LTSIZE-1)
+typedef BYTE litDistribTable[LTSIZE];
+
+
+
+
 /*********************************************************
 *  Local Functions
 *********************************************************/
 #define RDG_rotl32(x,r) ((x << r) | (x >> (32 - r)))
-static U32 RDG_rand(U32* src)
+static unsigned int RDG_rand(U32* src)
 {
     U32 rand32 = *src;
     rand32 *= PRIME1;
@@ -86,23 +97,19 @@ static U32 RDG_rand(U32* src)
 }
 
 
-#define LTSIZE 8192
-#define LTMASK (LTSIZE-1)
-static void* RDG_createLiteralDistrib(const double ld)
+static void RDG_fillLiteralDistrib(litDistribTable lt, double ld)
 {
-    BYTE* lt = (BYTE*)malloc(LTSIZE);
     U32 i = 0;
     BYTE character = '0';
     BYTE firstChar = '(';
     BYTE lastChar = '}';
 
-    if (ld<=0.02)
+    if (ld==0.0)
     {
+        character = 0;
         firstChar = 0;
-        lastChar  = 254;
-        character = firstChar;
+        lastChar =255;
     }
-    if (ld==0.0) lastChar = 255;
     while (i<LTSIZE)
     {
         U32 weight = (U32)((double)(LTSIZE - i) * ld) + 1;
@@ -113,32 +120,31 @@ static void* RDG_createLiteralDistrib(const double ld)
         character++;
         if (character > lastChar) character = firstChar;
     }
-    return lt;
 }
 
-static char RDG_genChar(U32* seed, const void* ltctx)
+
+static BYTE RDG_genChar(U32* seed, const litDistribTable lt)
 {
-    const BYTE* lt = (const BYTE*)ltctx;
     U32 id = RDG_rand(seed) & LTMASK;
-    return lt[id];
+    return (lt[id]);
 }
 
+
 #define RDG_DICTSIZE    (32 KB)
 #define RDG_RAND15BITS  ((RDG_rand(seed) >> 3) & 32767)
 #define RDG_RANDLENGTH  ( ((RDG_rand(seed) >> 7) & 7) ? (RDG_rand(seed) & 15) : (RDG_rand(seed) & 511) + 15)
-void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, void* litTable, unsigned* seedPtr)
+void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned* seedPtr)
 {
     BYTE* buffPtr = (BYTE*)buffer;
     const U32 matchProba32 = (U32)(32768 * matchProba);
     size_t pos = prefixSize;
-    void* ldctx = litTable;
     U32* seed = seedPtr;
 
     /* special case */
     while (matchProba >= 1.0)
     {
         size_t size0 = RDG_rand(seed) & 3;
-        size0  = 1U << (16 + size0 * 2);
+        size0  = (size_t)1 << (16 + size0 * 2);
         size0 += RDG_rand(seed) & (size0-1);   /* because size0 is power of 2*/
         if (buffSize < pos + size0)
         {
@@ -147,11 +153,11 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
         }
         memset(buffPtr+pos, 0, size0);
         pos += size0;
-        buffPtr[pos-1] = RDG_genChar(seed, ldctx);
+        buffPtr[pos-1] = RDG_genChar(seed, lt);
     }
 
     /* init */
-    if (pos==0) buffPtr[0] = RDG_genChar(seed, ldctx), pos=1;
+    if (pos==0) buffPtr[0] = RDG_genChar(seed, lt), pos=1;
 
     /* Generate compressible data */
     while (pos < buffSize)
@@ -160,11 +166,11 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
         if (RDG_RAND15BITS < matchProba32)
         {
             /* Copy (within 32K) */
-            int match;
-            U32 d;
+            size_t match;
+            size_t d;
             int length = RDG_RANDLENGTH + 4;
             U32 offset = RDG_RAND15BITS + 1;
-            if (offset > pos) offset = pos;
+            if (offset > pos) offset = (U32)pos;
             match = pos - offset;
             d = pos + length;
             if (d > buffSize) d = buffSize;
@@ -177,7 +183,7 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
             size_t length = RDG_RANDLENGTH;
             d = pos + length;
             if (d > buffSize) d = buffSize;
-            while (pos < d) buffPtr[pos++] = RDG_genChar(seed, ldctx);
+            while (pos < d) buffPtr[pos++] = RDG_genChar(seed, lt);
         }
     }
 }
@@ -185,11 +191,10 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
 
 void RDG_genBuffer(void* buffer, size_t size, double matchProba, double litProba, unsigned seed)
 {
-    void* ldctx;
+    litDistribTable lt;
     if (litProba==0.0) litProba = matchProba / 4.5;
-    ldctx = RDG_createLiteralDistrib(litProba);
-    RDG_genBlock(buffer, size, 0, matchProba, ldctx, &seed);
-    free(ldctx);
+    RDG_fillLiteralDistrib(lt, litProba);
+    RDG_genBlock(buffer, size, 0, matchProba, lt, &seed);
 }
 
 
@@ -199,26 +204,24 @@ void RDG_genOut(unsigned long long size, double matchProba, double litProba, uns
     BYTE buff[RDG_DICTSIZE + RDG_BLOCKSIZE];
     U64 total = 0;
     size_t genBlockSize = RDG_BLOCKSIZE;
-    void* ldctx;
+    litDistribTable lt;
 
     /* init */
     if (litProba==0.0) litProba = matchProba / 4.5;
-    ldctx = RDG_createLiteralDistrib(litProba);
+    RDG_fillLiteralDistrib(lt, litProba);
     SET_BINARY_MODE(stdout);
 
     /* Generate dict */
-    RDG_genBlock(buff, RDG_DICTSIZE, 0, matchProba, ldctx, &seed);
+    RDG_genBlock(buff, RDG_DICTSIZE, 0, matchProba, lt, &seed);
 
     /* Generate compressible data */
     while (total < size)
     {
-        RDG_genBlock(buff, RDG_DICTSIZE+RDG_BLOCKSIZE, RDG_DICTSIZE, matchProba, ldctx, &seed);
+        RDG_genBlock(buff, RDG_DICTSIZE+RDG_BLOCKSIZE, RDG_DICTSIZE, matchProba, lt, &seed);
         if (size-total < RDG_BLOCKSIZE) genBlockSize = (size_t)(size-total);
         total += genBlockSize;
         fwrite(buff, 1, genBlockSize, stdout);
         /* update dict */
         memcpy(buff, buff + RDG_BLOCKSIZE, RDG_DICTSIZE);
     }
-
-    free(ldctx);
 }
index 4b6e0c35c373a78f562b727585640871046dc97f..5d47329f8edecc5c1a6826f3d68ec903fd0f20a9 100644 (file)
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
@@ -89,6 +93,8 @@
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <EnablePREfast>true</EnablePREfast>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
   <ItemGroup>\r
     <ClCompile Include="..\..\..\lib\fse.c" />\r
     <ClCompile Include="..\..\..\lib\zstd.c" />\r
+    <ClCompile Include="..\..\..\programs\datagen.c" />\r
     <ClCompile Include="..\..\..\programs\fullbench.c" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\lib\fse_static.h" />\r
     <ClInclude Include="..\..\..\lib\zstd.h" />\r
     <ClInclude Include="..\..\..\lib\zstd_static.h" />\r
+    <ClInclude Include="..\..\..\programs\datagen.h" />\r
   </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
index 35a8900109205eb8da16b2f3a0293c9c31d3d22f..5890bd6380c268d3d22fbacdddec512bd4b35ed9 100644 (file)
@@ -24,6 +24,9 @@
     <ClCompile Include="..\..\..\programs\fullbench.c">\r
       <Filter>Fichiers sources</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\programs\datagen.c">\r
+      <Filter>Fichiers sources</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\lib\fse.h">\r
@@ -38,5 +41,8 @@
     <ClInclude Include="..\..\..\lib\zstd_static.h">\r
       <Filter>Fichiers d%27en-tĂȘte</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\programs\datagen.h">\r
+      <Filter>Fichiers d%27en-tĂȘte</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index a0dc550c28f76a10638f541a9b8cbfc51be33f98..68d5273fde720bb9ef0f1f0e6eaa7ac845900a00 100644 (file)
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
@@ -89,6 +93,8 @@
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <EnablePREfast>true</EnablePREfast>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
old mode 100755 (executable)
new mode 100644 (file)
index 45e4bc15422edae7c5abe2912041f248b5710ebc..eb8289b448f05fea682f4787d5f10830c9fcf90b 100644 (file)
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LinkIncremental>true</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
     <LinkIncremental>false</LinkIncremental>\r
     <IncludePath>$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>\r
+    <RunCodeAnalysis>true</RunCodeAnalysis>\r
   </PropertyGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <EnablePREfast>true</EnablePREfast>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r
       <FunctionLevelLinking>true</FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <TreatWarningAsError>true</TreatWarningAsError>\r
+      <EnablePREfast>true</EnablePREfast>\r
     </ClCompile>\r
     <Link>\r
       <SubSystem>Console</SubSystem>\r