mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-26 05:18:21 +01:00
Initial Visual Studio support.
This commit is contained in:
parent
e9d5e082af
commit
6f02bdd301
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,6 +3,8 @@
|
|||||||
*.log
|
*.log
|
||||||
*.o
|
*.o
|
||||||
*.so.1
|
*.so.1
|
||||||
|
/.vs
|
||||||
|
/packages
|
||||||
/testpdfio
|
/testpdfio
|
||||||
/testpdfio-out.pdf
|
/testpdfio-out.pdf
|
||||||
|
/x64
|
||||||
|
4
packages.config
Normal file
4
packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="zlib-msvc-x64" version="1.2.11.8900" targetFramework="native" />
|
||||||
|
</packages>
|
@ -11,10 +11,13 @@
|
|||||||
// Include necessary headers...
|
// Include necessary headers...
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "pdfio-content.h"
|
|
||||||
#include "pdfio-private.h"
|
#include "pdfio-private.h"
|
||||||
|
#include "pdfio-content.h"
|
||||||
#include "ttf.h"
|
#include "ttf.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#ifndef M_PI
|
||||||
|
# define M_PI 3.14159265358979323846264338327950288
|
||||||
|
#endif // M_PI
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -14,10 +14,20 @@
|
|||||||
// Include necessary headers...
|
// Include necessary headers...
|
||||||
//
|
//
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
/*
|
||||||
|
* Disable bogus VS warnings/errors...
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
|
# endif // _WIN32
|
||||||
|
|
||||||
# include "pdfio.h"
|
# include "pdfio.h"
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
|
# include <string.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
|
# include <fcntl.h>
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
@ -59,7 +69,6 @@
|
|||||||
# define O_TRUNC _O_TRUNC
|
# define O_TRUNC _O_TRUNC
|
||||||
# define O_BINARY _O_BINARY
|
# define O_BINARY _O_BINARY
|
||||||
# else // !_WIN32
|
# else // !_WIN32
|
||||||
# include <fcntl.h>
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
# endif // _WIN32
|
# endif // _WIN32
|
||||||
|
@ -706,7 +706,7 @@ pdfioStreamWrite(
|
|||||||
|
|
||||||
pbpixel = st->pbpixel;
|
pbpixel = st->pbpixel;
|
||||||
bufptr = (const unsigned char *)buffer;
|
bufptr = (const unsigned char *)buffer;
|
||||||
bufsecond = buffer + pbpixel;
|
bufsecond = bufptr + pbpixel;
|
||||||
|
|
||||||
while (bytes > 0)
|
while (bytes > 0)
|
||||||
{
|
{
|
||||||
@ -736,7 +736,7 @@ pdfioStreamWrite(
|
|||||||
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++)
|
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++)
|
||||||
{
|
{
|
||||||
if (bufptr >= bufsecond)
|
if (bufptr >= bufsecond)
|
||||||
*sptr = *bufptr - bufptr[-pbpixel];
|
*sptr = *bufptr - bufptr[-(int)pbpixel];
|
||||||
else
|
else
|
||||||
*sptr = *bufptr;
|
*sptr = *bufptr;
|
||||||
}
|
}
|
||||||
@ -755,7 +755,7 @@ pdfioStreamWrite(
|
|||||||
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++, pptr ++)
|
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++, pptr ++)
|
||||||
{
|
{
|
||||||
if (bufptr >= bufsecond)
|
if (bufptr >= bufsecond)
|
||||||
*sptr = *bufptr - (bufptr[-pbpixel] + *pptr) / 2;
|
*sptr = *bufptr - (bufptr[-(int)pbpixel] + *pptr) / 2;
|
||||||
else
|
else
|
||||||
*sptr = *bufptr - *pptr / 2;
|
*sptr = *bufptr - *pptr / 2;
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ pdfioStreamWrite(
|
|||||||
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++, pptr ++)
|
for (remaining = pbline; remaining > 0; remaining --, bufptr ++, sptr ++, pptr ++)
|
||||||
{
|
{
|
||||||
if (bufptr >= bufsecond)
|
if (bufptr >= bufsecond)
|
||||||
*sptr = *bufptr - stream_paeth(bufptr[-pbpixel], *pptr, pptr[-pbpixel]);
|
*sptr = *bufptr - stream_paeth(bufptr[-(int)pbpixel], *pptr, pptr[-(int)pbpixel]);
|
||||||
else
|
else
|
||||||
*sptr = *bufptr - stream_paeth(0, *pptr, 0);
|
*sptr = *bufptr - stream_paeth(0, *pptr, 0);
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ stream_read(pdfio_stream_t *st, // I - Stream
|
|||||||
for (; bufptr < bufsecond; remaining --, sptr ++)
|
for (; bufptr < bufsecond; remaining --, sptr ++)
|
||||||
*bufptr++ = *sptr;
|
*bufptr++ = *sptr;
|
||||||
for (; remaining > 0; remaining --, sptr ++, bufptr ++)
|
for (; remaining > 0; remaining --, sptr ++, bufptr ++)
|
||||||
*bufptr = *sptr + bufptr[-pbpixel];
|
*bufptr = *sptr + bufptr[-(int)pbpixel];
|
||||||
break;
|
break;
|
||||||
case 2 : // Up
|
case 2 : // Up
|
||||||
for (; remaining > 0; remaining --, sptr ++, pptr ++)
|
for (; remaining > 0; remaining --, sptr ++, pptr ++)
|
||||||
@ -949,13 +949,13 @@ stream_read(pdfio_stream_t *st, // I - Stream
|
|||||||
for (; bufptr < bufsecond; remaining --, sptr ++, pptr ++)
|
for (; bufptr < bufsecond; remaining --, sptr ++, pptr ++)
|
||||||
*bufptr++ = *sptr + *pptr / 2;
|
*bufptr++ = *sptr + *pptr / 2;
|
||||||
for (; remaining > 0; remaining --, sptr ++, pptr ++, bufptr ++)
|
for (; remaining > 0; remaining --, sptr ++, pptr ++, bufptr ++)
|
||||||
*bufptr = *sptr + (bufptr[-pbpixel] + *pptr) / 2;
|
*bufptr = *sptr + (bufptr[-(int)pbpixel] + *pptr) / 2;
|
||||||
break;
|
break;
|
||||||
case 4 : // Paeth
|
case 4 : // Paeth
|
||||||
for (; bufptr < bufsecond; remaining --, sptr ++, pptr ++)
|
for (; bufptr < bufsecond; remaining --, sptr ++, pptr ++)
|
||||||
*bufptr++ = *sptr + stream_paeth(0, *pptr, 0);
|
*bufptr++ = *sptr + stream_paeth(0, *pptr, 0);
|
||||||
for (; remaining > 0; remaining --, sptr ++, pptr ++, bufptr ++)
|
for (; remaining > 0; remaining --, sptr ++, pptr ++, bufptr ++)
|
||||||
*bufptr = *sptr + stream_paeth(bufptr[-pbpixel], *pptr, pptr[-pbpixel]);
|
*bufptr = *sptr + stream_paeth(bufptr[-(int)pbpixel], *pptr, pptr[-(int)pbpixel]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
@ -408,7 +408,11 @@ _pdfioValueWrite(pdfio_file_t *pdf, // I - PDF file
|
|||||||
{
|
{
|
||||||
struct tm date; // Date values
|
struct tm date; // Date values
|
||||||
|
|
||||||
gmtime_r(&v->value.date, &date);
|
#ifdef _WIN32
|
||||||
|
gmtime_s(&date, &v->value.date);
|
||||||
|
#else
|
||||||
|
gmtime_r(&v->value.date, &date);
|
||||||
|
#endif // _WIN32
|
||||||
return (_pdfioFilePrintf(pdf, "(D:%04d%02d%02d%02d%02d%02dZ)", date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec));
|
return (_pdfioFilePrintf(pdf, "(D:%04d%02d%02d%02d%02d%02dZ)", date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
pdfio.h
4
pdfio.h
@ -47,6 +47,10 @@ extern "C" {
|
|||||||
// Types and constants...
|
// Types and constants...
|
||||||
//
|
//
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
typedef __int64 ssize_t; // POSIX type not present on Windows...
|
||||||
|
# endif // _WIN32
|
||||||
|
|
||||||
typedef struct _pdfio_array_s pdfio_array_t;
|
typedef struct _pdfio_array_s pdfio_array_t;
|
||||||
// Array of PDF values
|
// Array of PDF values
|
||||||
typedef struct _pdfio_dict_s pdfio_dict_t;
|
typedef struct _pdfio_dict_s pdfio_dict_t;
|
||||||
|
31
pdfio.sln
Normal file
31
pdfio.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.30413.136
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pdfio", "pdfio.vcxproj", "{98F2DE9E-2978-4387-AF71-82532BEDB29E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Release|x64.Build.0 = Release|x64
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{98F2DE9E-2978-4387-AF71-82532BEDB29E}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {1C37E030-5C42-41DE-B3F6-C137DF5CFA91}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
175
pdfio.vcxproj
Normal file
175
pdfio.vcxproj
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{98f2de9e-2978-4387-af71-82532bedb29e}</ProjectGuid>
|
||||||
|
<RootNamespace>pdfio</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>pdfio1</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</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 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 Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<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|x64'">
|
||||||
|
<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>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="pdfio-content.h" />
|
||||||
|
<ClInclude Include="pdfio-private.h" />
|
||||||
|
<ClInclude Include="pdfio.h" />
|
||||||
|
<ClInclude Include="ttf.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="pdfio-array.c" />
|
||||||
|
<ClCompile Include="pdfio-common.c" />
|
||||||
|
<ClCompile Include="pdfio-content.c" />
|
||||||
|
<ClCompile Include="pdfio-dict.c" />
|
||||||
|
<ClCompile Include="pdfio-file.c" />
|
||||||
|
<ClCompile Include="pdfio-object.c" />
|
||||||
|
<ClCompile Include="pdfio-page.c" />
|
||||||
|
<ClCompile Include="pdfio-stream.c" />
|
||||||
|
<ClCompile Include="pdfio-string.c" />
|
||||||
|
<ClCompile Include="pdfio-token.c" />
|
||||||
|
<ClCompile Include="pdfio-value.c" />
|
||||||
|
<ClCompile Include="ttf.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
<Import Project="packages\zlib-msvc-x64.1.2.11.8900\build\native\zlib-msvc-x64.targets" Condition="Exists('packages\zlib-msvc-x64.1.2.11.8900\build\native\zlib-msvc-x64.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\zlib-msvc-x64.1.2.11.8900\build\native\zlib-msvc-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\zlib-msvc-x64.1.2.11.8900\build\native\zlib-msvc-x64.targets'))" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
72
pdfio.vcxproj.filters
Normal file
72
pdfio.vcxproj.filters
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="pdfio.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="pdfio-content.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="pdfio-private.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ttf.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="pdfio-array.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-common.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-content.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-dict.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-file.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-object.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-page.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-stream.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-string.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-token.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pdfio-value.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ttf.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
4
pdfio.vcxproj.user
Normal file
4
pdfio.vcxproj.user
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup />
|
||||||
|
</Project>
|
10
ttf.c
10
ttf.c
@ -13,12 +13,17 @@
|
|||||||
// Include necessary headers...
|
// Include necessary headers...
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
#include "ttf.h"
|
#include "ttf.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
@ -61,9 +66,10 @@
|
|||||||
# define O_CREAT _O_CREAT
|
# define O_CREAT _O_CREAT
|
||||||
# define O_TRUNC _O_TRUNC
|
# define O_TRUNC _O_TRUNC
|
||||||
|
|
||||||
|
typedef __int64 ssize_t; // POSIX type not present on Windows...
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <fcntl.h>
|
|
||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
@ -877,7 +883,7 @@ copy_name(ttf_t *font, // I - Font
|
|||||||
int chars, // Length of string to copy in characters
|
int chars, // Length of string to copy in characters
|
||||||
bpc; // Bytes per character
|
bpc; // Bytes per character
|
||||||
|
|
||||||
if ((name->offset + name->length) > font->names.storage_size)
|
if ((unsigned)(name->offset + name->length) > font->names.storage_size)
|
||||||
{
|
{
|
||||||
TTF_DEBUG("copy_name: offset(%d)+length(%d) > storage_size(%d)\n", name->offset, name->length, font->names.storage_size);
|
TTF_DEBUG("copy_name: offset(%d)+length(%d) > storage_size(%d)\n", name->offset, name->length, font->names.storage_size);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user