summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/omegafonts
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-08-04 08:37:18 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-08-04 08:37:18 +0000
commit1e33cce520ec961287eb72234c7f09648ff2ac56 (patch)
treebb977b25d489bb703c4b424edef44592ca445c0b /Build/source/texk/web2c/omegafonts
parent9356d0c8571afcad861f873e2b334b285259f57b (diff)
SyncTeX: Avoid a memory leak, from Sebastian Ramacher <sramacher@debian.org>
Added a simple test case git-svn-id: svn://tug.org/texlive/trunk@34833 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/omegafonts')
-rw-r--r--Build/source/texk/web2c/omegafonts/ChangeLog8
-rw-r--r--Build/source/texk/web2c/omegafonts/char_routines.c36
-rw-r--r--Build/source/texk/web2c/omegafonts/header_routines.c45
-rw-r--r--Build/source/texk/web2c/omegafonts/header_routines.h6
-rwxr-xr-xBuild/source/texk/web2c/omegafonts/shorten.test6
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/realnum.out2
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/repeat.opl19
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/repeated.opl2
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/sample.out6
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/sample.ovp21
-rw-r--r--Build/source/texk/web2c/omegafonts/tests/shorten.opl1
11 files changed, 48 insertions, 104 deletions
diff --git a/Build/source/texk/web2c/omegafonts/ChangeLog b/Build/source/texk/web2c/omegafonts/ChangeLog
index ccf39392ded..05851a2a078 100644
--- a/Build/source/texk/web2c/omegafonts/ChangeLog
+++ b/Build/source/texk/web2c/omegafonts/ChangeLog
@@ -1,3 +1,11 @@
+2014-08-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * char_routines.c: Compute checksum.
+ * header_routines.[ch]: Drop more unused code.
+ * shorten.test, tests/realnum.out, tests/repeat.opl,
+ tests/repeated.opl, tests/sample.{out,ovp}, tests/shorten.opl:
+ Always use computed checksum.
+
2014-08-03 Peter Breitenlohner <peb@mppmu.mpg.de>
* dimen_routines.c (set_indices): Fixed a dimen rounding bug.
diff --git a/Build/source/texk/web2c/omegafonts/char_routines.c b/Build/source/texk/web2c/omegafonts/char_routines.c
index 52e32de0f87..0fb0cbd5033 100644
--- a/Build/source/texk/web2c/omegafonts/char_routines.c
+++ b/Build/source/texk/web2c/omegafonts/char_routines.c
@@ -872,6 +872,33 @@ unsigned num_char_info, words_per_entry;
#define RM_NEXT YY_NEXT(remainder)
#define TG_NEXT YY_NEXT(tag)
+static void
+compute_check_sum(void)
+{
+ unsigned c;
+ unsigned plane, index;
+ char_entry *entry;
+ unsigned c0 = bc, c1 = ec, c2 = bc, c3 = ec;
+ fix wd;
+
+ for (c = bc; c <= ec; c++) {
+ plane = c / PLANE;
+ index = c % PLANE;
+ entry = planes[plane][index];
+ if ((entry == NULL) || (WD_ENTRY == 0))
+ continue;
+ wd = lval(entry->indices[C_WD]);
+ if (design_units != UNITY)
+ wd = zround(((double)wd) / ((double)design_units) * 1048576.0);
+ wd += (c + 4) * 0x400000; /* this should be positive */
+ c0 = (c0 + c0 + wd) % 255;
+ c1 = (c1 + c1 + wd) % 253;
+ c2 = (c2 + c2 + wd) % 251;
+ c3 = (c3 + c3 + wd) % 247;
+ }
+ check_sum = (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
+}
+
void
compute_ofm_character_info(void)
{
@@ -963,14 +990,9 @@ compute_ofm_character_info(void)
}
default: { internal_error_0("compute_ofm_character_info"); }
}
-}
-void
-calculate_check_sum(void)
-{
-/*
- not_yet_done("checksum calculation");
-*/
+ if (check_sum_specified==FALSE)
+ compute_check_sum();
}
void
diff --git a/Build/source/texk/web2c/omegafonts/header_routines.c b/Build/source/texk/web2c/omegafonts/header_routines.c
index 3e19955d7bb..160c021b7dc 100644
--- a/Build/source/texk/web2c/omegafonts/header_routines.c
+++ b/Build/source/texk/web2c/omegafonts/header_routines.c
@@ -240,12 +240,6 @@ set_design_size(fix ds)
}
void
-store_design_size(void)
-{
- store_header_int(LOC_DESIGN_SIZE, design_size);
-}
-
-void
retrieve_design_size(void)
{
retrieve_header_int(LOC_DESIGN_SIZE, (unsigned *) &design_size);
@@ -306,18 +300,6 @@ set_coding_scheme(string sval)
}
void
-store_coding_scheme(void)
-{
- register unsigned i=0, j=LOC_CODING_SCHEME, len=strlen(coding_scheme);
-
- header[j] = len;
- for (j++; i<len; i++,j++) header[j] = coding_scheme[i];
- for (; j<(LOC_CODING_SCHEME+LEN_CODING_SCHEME); j++)
- header[j] = '\0';;
-}
-
-
-void
retrieve_coding_scheme(void)
{
register unsigned i=0, j=LOC_CODING_SCHEME, len=header[LOC_CODING_SCHEME];
@@ -362,19 +344,6 @@ set_family(string sval)
}
void
-store_family(void)
-{
- register unsigned i=0, j=LOC_FAMILY, len=strlen(family);
-
- if (len>LEN_FAMILY) internal_error_1("store_family (len=%d)", len);
- header[j] = len;
- for (j++; i<len; i++,j++) header[j] = family[i];
- for (; j<=(LOC_FAMILY+LEN_FAMILY); j++)
- header[j] = '\0';;
-}
-
-
-void
retrieve_family(void)
{
register unsigned i=0, j=LOC_FAMILY, len=header[LOC_FAMILY];
@@ -414,12 +383,6 @@ set_face(unsigned f)
}
void
-store_face(void)
-{
- store_header_byte(LOC_FACE, face);
-}
-
-void
retrieve_face(void)
{
unsigned char face_byte;
@@ -489,12 +452,6 @@ set_seven_bit_safe_flag(unsigned f)
}
void
-store_seven_bit_safe_flag(void)
-{
- store_header_byte(LOC_SEVEN_FLAG, seven_bit ? 0x80 : 0);
-}
-
-void
retrieve_seven_bit_safe_flag(void)
{
unsigned char seven_bit_byte;
@@ -546,8 +503,6 @@ output_ofm_header(void)
av_list L = header_list;
- if (check_sum_specified==FALSE)
- calculate_check_sum();
out_ofm_4(check_sum);
out_ofm_4(design_size);
k1 = strlen(coding_scheme);
diff --git a/Build/source/texk/web2c/omegafonts/header_routines.h b/Build/source/texk/web2c/omegafonts/header_routines.h
index b418af27dce..857d16fc745 100644
--- a/Build/source/texk/web2c/omegafonts/header_routines.h
+++ b/Build/source/texk/web2c/omegafonts/header_routines.h
@@ -65,11 +65,9 @@ extern void set_header_word(unsigned, unsigned);
extern void init_check_sum(void);
extern void set_check_sum(unsigned);
extern void retrieve_check_sum(void);
-extern void calculate_check_sum(void);
extern void init_design_size(void);
extern void set_design_size(fix);
-extern void store_design_size(void);
extern void retrieve_design_size(void);
extern void init_design_units(void);
@@ -77,20 +75,16 @@ extern void set_design_units(fix);
extern void init_coding_scheme(void);
extern void set_coding_scheme(string );
-extern void store_coding_scheme(void);
extern void retrieve_coding_scheme(void);
extern void init_family(void);
extern void set_family(string );
-extern void store_family(void);
extern void retrieve_family(void);
extern void set_face(unsigned);
-extern void store_face(void);
extern void retrieve_face(void);
extern void set_seven_bit_safe_flag(unsigned);
-extern void store_seven_bit_safe_flag(void);
extern void retrieve_seven_bit_safe_flag(void);
extern void calculate_seven_bit_safe_flag(void);
diff --git a/Build/source/texk/web2c/omegafonts/shorten.test b/Build/source/texk/web2c/omegafonts/shorten.test
index 10ede611451..9252de35cca 100755
--- a/Build/source/texk/web2c/omegafonts/shorten.test
+++ b/Build/source/texk/web2c/omegafonts/shorten.test
@@ -10,10 +10,8 @@ test -d $tests || mkdir -p $tests
TEXMFCNF=$srcdir/../../kpathsea
export TEXMFCNF
-sed -e'/CHECKSUM/d' $srcdir/$tests/shorten.opl >$tests/shortend.in
-
-echo && echo "pltotf $tests/shortend.in $tests/shortend.tfm" && \
- ../pltotf $tests/shortend.in $tests/shortend.tfm || exit
+echo && echo "pltotf $tests/shorten.opl $tests/shortend.tfm" && \
+ ../pltotf $srcdir/$tests/shorten.opl $tests/shortend.tfm || exit
echo && echo "omfonts -ofm2opl $tests/shorten.tfm $tests/shortend.pl" && \
./omfonts -ofm2opl $tests/shortend.tfm $tests/shortend.pl || exit
diff --git a/Build/source/texk/web2c/omegafonts/tests/realnum.out b/Build/source/texk/web2c/omegafonts/tests/realnum.out
index 2ce85862405..cacd83209bf 100644
--- a/Build/source/texk/web2c/omegafonts/tests/realnum.out
+++ b/Build/source/texk/web2c/omegafonts/tests/realnum.out
@@ -4,7 +4,7 @@
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
-(CHECKSUM H 0)
+(CHECKSUM H 3996EA86)
(SEVENBITSAFEFLAG TRUE)
(COMMENT
(CHARWD_ENTRY D 0 R 0.0)
diff --git a/Build/source/texk/web2c/omegafonts/tests/repeat.opl b/Build/source/texk/web2c/omegafonts/tests/repeat.opl
index 09099826e4b..1a790fb622b 100644
--- a/Build/source/texk/web2c/omegafonts/tests/repeat.opl
+++ b/Build/source/texk/web2c/omegafonts/tests/repeat.opl
@@ -1,4 +1,4 @@
-(OFMLEVEL D 1)
+(OFMLEVEL H 1)
(FONTDIR TL)
(FAMILY UNSPECIFIED)
(FACE F MRR)
@@ -6,8 +6,6 @@
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
-(CHECKSUM H 0)
-(SEVENBITSAFEFLAG FALSE)
(FONTDIMEN
(SLANT R 0.0)
(SPACE R 0.0)
@@ -17,21 +15,6 @@
(QUAD R 1.0)
(EXTRASPACE R 0.0)
)
-(COMMENT
- (CHARWD_ENTRY D 0 R 0.0)
- (CHARWD_ENTRY D 1 R 1.0)
- )
-(COMMENT
- (CHARHT_ENTRY D 0 R 0.0)
- (CHARHT_ENTRY D 1 R 0.9)
- )
-(COMMENT
- (CHARDP_ENTRY D 0 R 0.0)
- (CHARDP_ENTRY D 1 R 0.1)
- )
-(COMMENT
- (CHARIC_ENTRY D 0 R 0.0)
- )
(CHARREPEAT H 1 H 0
(COMMENT Repeat count zero)
(CHARWD R 1.0)
diff --git a/Build/source/texk/web2c/omegafonts/tests/repeated.opl b/Build/source/texk/web2c/omegafonts/tests/repeated.opl
index 08c9f8aaa5d..5fdcaab97fa 100644
--- a/Build/source/texk/web2c/omegafonts/tests/repeated.opl
+++ b/Build/source/texk/web2c/omegafonts/tests/repeated.opl
@@ -6,7 +6,7 @@
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
-(CHECKSUM H 0)
+(CHECKSUM H 461B802F)
(SEVENBITSAFEFLAG FALSE)
(FONTDIMEN
(SLANT R 0.0)
diff --git a/Build/source/texk/web2c/omegafonts/tests/sample.out b/Build/source/texk/web2c/omegafonts/tests/sample.out
index 4e756fcec07..095881a95a3 100644
--- a/Build/source/texk/web2c/omegafonts/tests/sample.out
+++ b/Build/source/texk/web2c/omegafonts/tests/sample.out
@@ -7,17 +7,17 @@
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
-(CHECKSUM H 0)
+(CHECKSUM H 16497D66)
(SEVENBITSAFEFLAG FALSE)
(MAPFONT D 0
(FONTNAME sample0-h)
- (FONTCHECKSUM H 0)
+ (FONTCHECKSUM H 11AB1731)
(FONTAT R 1.0)
(FONTDSIZE R 10.0)
)
(MAPFONT D 1
(FONTNAME sample1-h)
- (FONTCHECKSUM H 0)
+ (FONTCHECKSUM H 11AB1731)
(FONTAT R 1.0)
(FONTDSIZE R 10.0)
)
diff --git a/Build/source/texk/web2c/omegafonts/tests/sample.ovp b/Build/source/texk/web2c/omegafonts/tests/sample.ovp
index e1bdf269a03..2805f82e876 100644
--- a/Build/source/texk/web2c/omegafonts/tests/sample.ovp
+++ b/Build/source/texk/web2c/omegafonts/tests/sample.ovp
@@ -1,5 +1,5 @@
(VTITLE JVF for SAMPLE)
-(OFMLEVEL D 0)
+(OFMLEVEL H 0)
(FONTDIR TL)
(FAMILY UNSPECIFIED)
(FACE F MRR)
@@ -7,33 +7,18 @@
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
-(CHECKSUM H 0)
-(SEVENBITSAFEFLAG FALSE)
(MAPFONT D 0
(FONTNAME sample0-h)
- (FONTCHECKSUM H 0)
+ (FONTCHECKSUM H 11AB1731)
(FONTAT R 1.0)
(FONTDSIZE R 10.0)
)
(MAPFONT D 2
(FONTNAME sample1-h)
- (FONTCHECKSUM H 0)
+ (FONTCHECKSUM H 11AB1731)
(FONTAT R 1.0)
(FONTDSIZE R 10.0)
)
-(COMMENT
- (CHARWD_ENTRY D 0 R 0.0)
- (CHARWD_ENTRY D 1 R 1.0)
- )
-(COMMENT
- (CHARHT_ENTRY D 0 R 0.0)
- )
-(COMMENT
- (CHARDP_ENTRY D 0 R 0.0)
- )
-(COMMENT
- (CHARIC_ENTRY D 0 R 0.0)
- )
(CHARACTER H 2121
(CHARWD R 1.0)
(MAP
diff --git a/Build/source/texk/web2c/omegafonts/tests/shorten.opl b/Build/source/texk/web2c/omegafonts/tests/shorten.opl
index d9f951d67ae..ab6c3341699 100644
--- a/Build/source/texk/web2c/omegafonts/tests/shorten.opl
+++ b/Build/source/texk/web2c/omegafonts/tests/shorten.opl
@@ -1,5 +1,4 @@
(COMMENT More that 15 non-zero depths and heights)
-(CHECKSUM H 77A61937)
(CHARACTER H A
(CHARWD R 1.1)
(CHARHT R 0.1)