- replace ttmkfdir-3.0.9-defautl_enc_size.patch and

ttmkfdir-3.0.9-crashplus.patch with ttmkfdir-3.0.9-fix-crash.patch
  to fix missing native encodings of fonts
  (Akira Tagoh, #143941)
- buildrequire flex
- add ttmkfdir-3.0.9-warnings.patch to silence most of compiler warnings
This commit is contained in:
Jens Petersen 2005-08-03 13:12:39 +00:00
parent 1be6bfa1d6
commit 8e001a690f
3 changed files with 169 additions and 8 deletions

View File

@ -0,0 +1,79 @@
--- ttmkfdir-3.0.9.orig/encoding.l 2003-01-08 14:25:25.000000000 +0900
+++ ttmkfdir-3.0.9/encoding.l 2005-08-03 19:24:22.000000000 +0900
@@ -21,6 +21,19 @@
static Encoding *cur_enc;
static NumericMapping *cur_map;
+static int is_created_map = 0;
+
+static void
+create_mapping(void)
+{
+ cur_map = new NumericMapping (cur_enc->size,
+ TT_PLATFORM_MICROSOFT,
+ TT_MS_ID_UNICODE_CS);
+
+ cur_enc->enc_size = 0;
+ cur_enc->start_code = 0xffff;
+ is_created_map = 1;
+}
%}
@@ -67,12 +80,6 @@
}
<INSIDE_ENC_BLOCK>STARTMAPPING{WHITESPACES}unicode {
- cur_map = new NumericMapping (cur_enc->size,
- TT_PLATFORM_MICROSOFT,
- TT_MS_ID_UNICODE_CS);
-
- cur_enc->enc_size = 0;
- cur_enc->start_code = 0xffff;
BEGIN(INSIDE_MAP_BLOCK);
}
@@ -107,6 +114,12 @@
i2 = i1;
}
+ /* avoid a crash issue */
+ if (cur_enc->size < i2)
+ cur_enc->size = i2;
+ if (!is_created_map)
+ create_mapping();
+
/* now mark all the unassigned codes */
for (long i = i1; i <= i2; i++) {
(*cur_map)[i] = -1;
@@ -114,10 +127,14 @@
}
<INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
- int numbers[3], i = 0, start_range, end_range, target, res;
+ unsigned int start_range;
+ int numbers[3], i = 0, end_range, target, res;
char *startptr;
char *endptr = yytext;
+ if (!is_created_map)
+ create_mapping();
+
for (i = 0;;i++) {
startptr = endptr;
res = std::strtol (startptr, &endptr, 0);
@@ -150,9 +167,14 @@
<INSIDE_MAP_BLOCK>ENDMAPPING {
+ /* it may not happens but to be safe */
+ if (!is_created_map)
+ create_mapping();
+
cur_enc->AddMapping (cur_map);
dest.insert (std::make_pair(cur_map->cmapkey(), cur_enc));;
BEGIN(INSIDE_ENC_BLOCK);
+ is_created_map = 0;
}
<INSIDE_UNKNOWN_MAP>ENDMAPPING {

View File

@ -0,0 +1,75 @@
--- ttmkfdir-3.0.9/encoding.l~ 2005-08-03 19:33:07.000000000 +0900
+++ ttmkfdir-3.0.9/encoding.l 2005-08-03 21:52:15.000000000 +0900
@@ -115,7 +115,7 @@
}
/* avoid a crash issue */
- if (cur_enc->size < i2)
+ if ((int) (cur_enc->size) < i2)
cur_enc->size = i2;
if (!is_created_map)
create_mapping();
@@ -127,8 +127,8 @@
}
<INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
- unsigned int start_range;
- int numbers[3], i = 0, end_range, target, res;
+ unsigned int start_range = 0, i = 0, end_range = 0;
+ int numbers[3], target = 0, res;
char *startptr;
char *endptr = yytext;
--- ttmkfdir-3.0.9/commandline.cpp~ 2002-12-09 17:29:11.000000000 +0900
+++ ttmkfdir-3.0.9/commandline.cpp 2005-08-03 21:12:40.000000000 +0900
@@ -1,6 +1,8 @@
#include <cstdlib>
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <getopt.h>
#include "commandline.h"
--- ttmkfdir-3.0.9/ttmkfdir.cpp~ 2003-01-20 08:33:11.000000000 +0900
+++ ttmkfdir-3.0.9/ttmkfdir.cpp 2005-08-03 21:08:43.000000000 +0900
@@ -76,7 +76,7 @@
return 1;
}
- fprintf (output, "%d\n", fontdir.size ());
+ fprintf (output, "%d\n", (int)(fontdir.size ()));
for (vector<string>::const_iterator i = fontdir.begin (); i != fontdir.end (); i++) {
fprintf (output, "%s\n", i->c_str ());
--- ttmkfdir-3.0.9/ttf.cpp~ 2005-08-03 19:33:07.000000000 +0900
+++ ttmkfdir-3.0.9/ttf.cpp 2005-08-03 21:31:48.000000000 +0900
@@ -533,7 +533,7 @@
const char *
Face::Weight (void) const
{
- const char *result;
+ const char *result = NULL;
if (cmdline::instance()->option ("panose") && ((result = PanoseWeight ()) != 0)) {
return result;
@@ -614,7 +614,7 @@
const char *
Face::Width (void) const
{
- const char *result;
+ const char *result = NULL;
if (cmdline::instance()->option ("panose") && ((result = PanoseWidth ()) != 0)) {
return result;
--- ttmkfdir-3.0.9/encoding.cpp~ 2005-08-03 19:33:07.000000000 +0900
+++ ttmkfdir-3.0.9/encoding.cpp 2005-08-03 21:31:44.000000000 +0900
@@ -121,7 +121,7 @@
NumericMapping *m = new NumericMapping (size, b->mapdata.platform, b->mapdata.encoding);
- for (int i = 0; i < size; i++)
+ for (unsigned int i = 0; i < size; i++)
(*m)[i] = b->mapdata.mappingtable[i];
AddMapping (m);

View File

@ -1,27 +1,27 @@
Summary: Utility used to create fonts.scale files for truetype fonts Summary: Utility to create fonts.scale files for truetype fonts
Name: ttmkfdir Name: ttmkfdir
Version: 3.0.9 Version: 3.0.9
Release: 16 Release: 17
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Patch: ttmkfdir-3.0.9-cpp.patch Patch: ttmkfdir-3.0.9-cpp.patch
Patch1: ttmkfdir-3.0.9-zlib.patch Patch1: ttmkfdir-3.0.9-zlib.patch
Patch2: ttmkfdir-3.0.9-fix-freetype217.patch Patch2: ttmkfdir-3.0.9-fix-freetype217.patch
Patch3: ttmkfdir-3.0.9-namespace.patch Patch3: ttmkfdir-3.0.9-namespace.patch
Patch4: ttmkfdir-3.0.9-defautl_enc_size.patch Patch4: ttmkfdir-3.0.9-fix-crash.patch
Patch5: ttmkfdir-3.0.9-crashplus.patch Patch5: ttmkfdir-3.0.9-warnings.patch
License: GPL License: GPL
Group: Applications/System Group: Applications/System
BuildRoot: %{_tmppath}/%{name}-root BuildRoot: %{_tmppath}/%{name}-root
BuildRequires: freetype-devel >= 2.0 BuildRequires: freetype-devel >= 2.0
BuildRequires: zlib-devel BuildRequires: zlib-devel flex
# ttmkfdir used to be in the following packages at one point # ttmkfdir used to be in the following packages at one point
Conflicts: XFree86-font-utils < 4.2.99.2-0.20021126.3 Conflicts: XFree86-font-utils < 4.2.99.2-0.20021126.3
Conflicts: freetype < 2.0.6-3 Conflicts: freetype < 2.0.6-3
%description %description
ttmkfdir is a utility which is used to create fonts.scale files in ttmkfdir is a utility used to create fonts.scale files in
directories full of TrueType fonts in order to prepare them for use TrueType font directories in order to prepare them for use
by the font server. by the font server.
%prep %prep
@ -38,7 +38,6 @@ make OPTFLAGS="$RPM_OPT_FLAGS"
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%makeinstall DESTDIR=$RPM_BUILD_ROOT %makeinstall DESTDIR=$RPM_BUILD_ROOT
%clean %clean
@ -50,6 +49,14 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/ttmkfdir %{_bindir}/ttmkfdir
%changelog %changelog
* Wed Aug 3 2005 Jens Petersen <petersen@redhat.com> - 3.0.9-17
- replace ttmkfdir-3.0.9-defautl_enc_size.patch and
ttmkfdir-3.0.9-crashplus.patch with ttmkfdir-3.0.9-fix-crash.patch
to fix missing native encodings of fonts
(Akira Tagoh, #143941)
- buildrequire flex
- add ttmkfdir-3.0.9-warnings.patch to silence most of compiler warnings
* Sun Mar 20 2005 Yu Shao <yshao@redhat.com> 3.0.9-16 * Sun Mar 20 2005 Yu Shao <yshao@redhat.com> 3.0.9-16
- rebuild with GCC 4 - rebuild with GCC 4