From de11e6bdb853dce80abe2c1223fe490ae0b2ebd0 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 23 Feb 2006 13:15:43 +0000 Subject: [PATCH] Fixed bug #488: tsticonv fails on Solaris with Sun C compiler. We no longer use a negative value in yaz_iconv_trie_dir.ptr member for a "null" pointer. Instead integer 0 is used and actual ptrs have an offset +1. --- src/charconv.tcl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/charconv.tcl b/src/charconv.tcl index 95a18a3..45f6e13 100755 --- a/src/charconv.tcl +++ b/src/charconv.tcl @@ -2,7 +2,7 @@ # the next line restats using tclsh \ exec tclsh "$0" "$@" # -# $Id: charconv.tcl,v 1.10 2005-11-09 17:48:11 adam Exp $ +# $Id: charconv.tcl,v 1.11 2006-02-23 13:15:43 adam Exp $ proc usage {} { puts {charconv.tcl: [-p prefix] [-s split] [-o ofile] file ... } @@ -36,7 +36,7 @@ proc preamble_trie {ofilehandle} { static unsigned long lookup(struct yaz_iconv_trie **ptrs, int ptr, unsigned char *inp, size_t inbytesleft, size_t *no_read, int *combining) { - struct yaz_iconv_trie *t = (ptr >= 0) ? ptrs[ptr] : 0; + struct yaz_iconv_trie *t = (ptr > 0) ? ptrs[ptr-1] : 0; if (!t || inbytesleft < 1) return 0; if (t->dir) @@ -200,10 +200,10 @@ proc dump_trie {ofilehandle} { set ch [format %02X $i] set null 1 if {[info exist trie($this,ptr,$ch)]} { - puts -nonewline $f "$trie($this,ptr,$ch), " + puts -nonewline $f "[expr $trie($this,ptr,$ch)+1], " set null 0 } else { - puts -nonewline $f "-1, " + puts -nonewline $f "0, " } if {[info exist trie($this,combining,$ch)]} { puts -nonewline $f "$trie($this,combining,$ch), " @@ -245,7 +245,7 @@ proc dump_trie {ofilehandle} { { unsigned long code; - code = lookup($trie(prefix)ptrs, 0, inp, inbytesleft, no_read, combining); + code = lookup($trie(prefix)ptrs, 1, inp, inbytesleft, no_read, combining); if (!code) { *no_read = 1; -- 1.7.10.4