diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-04 08:37:18 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-04 08:37:18 +0000 |
commit | 1e33cce520ec961287eb72234c7f09648ff2ac56 (patch) | |
tree | bb977b25d489bb703c4b424edef44592ca445c0b /Build/source/texk/web2c/omegafonts/char_routines.c | |
parent | 9356d0c8571afcad861f873e2b334b285259f57b (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/char_routines.c')
-rw-r--r-- | Build/source/texk/web2c/omegafonts/char_routines.c | 36 |
1 files changed, 29 insertions, 7 deletions
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 |