Commit 1778932d authored by filatov's avatar filatov
Browse files

fix x64 build of generators

parent cec97e02
......@@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="applink.c" />
......@@ -224,6 +232,7 @@
<ClCompile Include="asncodec\xer_support.c" />
<ClCompile Include="ecc_openssl.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
......@@ -449,6 +458,12 @@
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
......@@ -456,25 +471,48 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......@@ -492,6 +530,22 @@
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL\Win64\include;..;asncodec</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\OpenSSL\Win64\lib\VC\static</AdditionalLibraryDirectories>
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
......@@ -512,6 +566,26 @@
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL\Win64\include;..;asncodec</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\OpenSSL\Win64\lib\VC\static</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
......
......@@ -59,8 +59,8 @@ void * ecc_key_public_set(ecc_curve_id pk_alg, ecc_point_type ptype, const char
#define sha256_hash_size 32
#define sha384_hash_size 48
int sha256_calculate(char* hash, const char * ptr, int len);
int sha384_calculate(char* hash, const char * ptr, int len);
int sha256_calculate(char* hash, const char * ptr, size_t len);
int sha384_calculate(char* hash, const char * ptr, size_t len);
int ecc_sign(void * key, const char * hash, int hlength, char *r, char *s);
......
......@@ -23,12 +23,12 @@
#define ARRAYSIZE(A) (sizeof(A)/sizeof(A[0]))
static char * _bin2hex(char * hex, int hlen, const char * bin, int blen);
static char * _bin2hex(char * hex, size_t hlen, const char * bin, size_t blen);
typedef struct {
int nid;
const char * name;
int fsize;
size_t fsize;
}ecc_api_curve_data;
static ecc_api_curve_data _config[] = {
......@@ -362,7 +362,7 @@ void * ecc_key_public_load(const char* path, ecc_curve_id pk_alg)
eckey = PEM_read_EC_PUBKEY(f, &eckey, NULL, NULL);
if (eckey == NULL){
fseek(f, 0, SEEK_END);
int len = ftell(f);
size_t len = ftell(f);
fseek(f, 0, SEEK_SET);
char * buf = OPENSSL_malloc(len + 1);
if (len == fread(buf, 1, len, f)){
......@@ -393,7 +393,7 @@ void * ecc_key_public_load(const char* path, ecc_curve_id pk_alg)
return eckey;
}
int sha256_calculate(char* hash, const char * ptr, int len)
int sha256_calculate(char* hash, const char * ptr, size_t len)
{
SHA256_CTX ctx;
SHA256_Init(&ctx);
......@@ -402,7 +402,7 @@ int sha256_calculate(char* hash, const char * ptr, int len)
return 0;
}
int sha384_calculate(char* hash, const char * ptr, int len)
int sha384_calculate(char* hash, const char * ptr, size_t len)
{
SHA512_CTX ctx;
SHA384_Init(&ctx);
......@@ -440,7 +440,7 @@ int ecc_sign(void * key, const char * hash, int hlength, char *r, char *s)
static const char* _hexDigits = "0123456789ABCDEF";
static char * _bin2hex(char * hex, int hlen, const char * bin, int blen)
static char * _bin2hex(char * hex, size_t hlen, const char * bin, size_t blen)
{
const unsigned char *b, *e;
char * s;
......
......@@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\generator\mkgmtime.c" />
......@@ -38,6 +46,12 @@
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
......@@ -45,25 +59,48 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)build\msvc\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)build\msvc\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......@@ -81,6 +118,22 @@
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL\Win32\include;..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
<AdditionalDependencies>libeay32MDd.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
......@@ -100,6 +153,25 @@
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\OpenSSL\Win32\include;..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>C:\OpenSSL\Win32\lib\VC\static</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
......
......@@ -34,7 +34,7 @@ static void _cdir_apply_filter(cdir_t * dir)
cdir_t * cdir_open(const pchar_t * path, const char * mask, int flags)
{
cdir_t * dir;
int plen = path ? pchar_len(path) : 0;
size_t plen = path ? pchar_len(path) : 0;
dir = cnew(cdir_t);
dir->path = pchar_alloc(plen + MAX_PATH + 1);
pchar_cpy(dir->path, path);
......
......@@ -99,7 +99,7 @@ void clog_fprintf(void * const f, int const level, const char * format, ...)
vfprintf(out, format, ap);
va_end(ap);
{
int l = strlen(format);
size_t l = strlen(format);
if(l == 0 || format[l-1]!= '\n'){
fprintf(out, "\n");
}
......
......@@ -413,7 +413,7 @@ static int set_option_value(copt_t* opt, const char * arg, char* val)
if(NULL == *p){
return -1;
}
value.v_long = p - (const char**)opt->vptr;
value.v_long = (long)(p - (const char**)opt->vptr);
}
break;
case COPT_STRLIST:
......
......@@ -254,7 +254,7 @@ uint32_t cxsize_read(const char ** const ptr, const char * const end, int * cons
return len;
}
int cbuf_write(const void * const p, int length, char ** const ptr, const char * const end, int * const perror)
int cbuf_write(const void * const p, size_t length, char ** const ptr, const char * const end, int * const perror)
{
if((*ptr) + length > end) {
C_ERROR(ENOSPC);
......@@ -266,7 +266,7 @@ int cbuf_write(const void * const p, int length, char ** const ptr, const char *
return 0;
}
int cbuf_read (void * const p, int length, const char ** const ptr, const char * const end, int * const perror)
int cbuf_read(void * const p, size_t length, const char ** const ptr, const char * const end, int * const perror)
{
if((*ptr) + length > end) {
C_ERROR(EFAULT);
......@@ -283,7 +283,7 @@ int cbuf_read (void * const p, int length, const char ** const ptr, const char *
int cstr_write(const char * const p, char ** const ptr, const char * const end, int * const perror)
{
int ret;
int len = cstrlen(p);
size_t len = cstrlen(p);
// write size
ret = cintx_write(len, ptr, end, perror);
if (ret == 0 && len > 0 ) {
......@@ -292,10 +292,10 @@ int cstr_write(const char * const p, char ** const ptr, const char * const end,
return ret;
}
int cstrn_write(const char * const p, int length, char ** const ptr, const char * const end, int * const perror)
int cstrn_write(const char * const p, size_t length, char ** const ptr, const char * const end, int * const perror)
{
int ret;
int len = cstrnlen(p, length);
size_t len = cstrnlen(p, length);
// write size
ret = cintx_write(len, ptr, end, perror);
if (ret == 0 && len > 0) {
......@@ -314,10 +314,10 @@ int cstr_read(char * const p, const char ** const ptr, const char * const end, i
return -1;
}
int cstrn_read(char * const p, int length, const char ** const ptr, const char * const end, int * const perror)
int cstrn_read(char * const p, size_t length, const char ** const ptr, const char * const end, int * const perror)
{
// read size
int len = (int)cintx_read(ptr, end, perror);
size_t len = (size_t)cintx_read(ptr, end, perror);
if (len <= length){
// read buf
return cbuf_read(p, len, ptr, end, perror);
......@@ -346,7 +346,8 @@ int cbookmark_store(cbookmark * bm, char ** const ptr, const char * const end, i
int cbookmark_apply(cbookmark * bm, char ** const ptr, const char * const end, int * const perror)
{
int size, bcount;
size_t size;
int bcount;
char *p, * psize;
p = *ptr;
......@@ -358,7 +359,7 @@ int cbookmark_apply(cbookmark * bm, char ** const ptr, const char * const end, i
size = p - psize - 1;
bcount = cintx_bytecount(size);
if (bcount == 1){
*(unsigned char*)psize = size;
*(unsigned char*)psize = (unsigned char)size;
size = 0; // return value;
}
else{
......@@ -371,5 +372,5 @@ int cbookmark_apply(cbookmark * bm, char ** const ptr, const char * const end, i
size = cintx_write(size, &psize, psize + bcount, perror);
}
if (perror) *perror = 0;
return size; // size is overridden to be 0 or -1
return (int)size; // size is overridden to be 0 or -1
}
......@@ -74,8 +74,8 @@ uint64_t cintx_read (const char ** const ptr, const char * const end, int * con
uint32_t cxsize_read(const char ** const ptr, const char * const end, int * const error);
int cintx_bytecount(uint64_t);
int cbuf_write(const void * const p, int length, char ** const ptr, const char * const end, int * const error);
int cbuf_read (void * const p, int length, const char ** const ptr, const char * const end, int * const error);
int cbuf_write(const void * const p, size_t length, char ** const ptr, const char * const end, int * const error);
int cbuf_read(void * const p, size_t length, const char ** const ptr, const char * const end, int * const error);
typedef struct {
int idx;
......
......@@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cdir_win.c" />
......@@ -41,6 +49,12 @@
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
......@@ -48,23 +62,44 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)build\msvc\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)build\msvc\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\msvc\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)..\build\msvc\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......@@ -79,6 +114,19 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
......@@ -96,6 +144,23 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
......
......@@ -15,13 +15,13 @@
#include <stdlib.h>
#include <ctype.h>
int cstrlen(const char * str)
size_t cstrlen(const char * str)
{
return str ? strlen(str) : 0;
}
int cstrnlen(const char * str, int maxsize)
size_t cstrnlen(const char * str, size_t maxsize)
{
int len = str ? strlen(str) : 0;
size_t len = str ? strlen(str) : 0;
return len > maxsize ? maxsize : len;
}
......@@ -37,7 +37,7 @@ int cstrequal(const char * s1, const char * s2)
char* cstrisprefix(const char * str, const char * prefix)
{
int len;
size_t len;
if (str == prefix){