~yolanda.robla/ubuntu/saucy/clamav/dep-8-tests

« back to all changes in this revision

Viewing changes to libclamav/entconv.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2009-11-02 23:27:19 UTC
  • mfrom: (0.35.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091102232719-61ay35095dhbuxfm
Tags: 0.95.3+dfsg-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Build-dep on libltdl3-dev instead of libltdl-dev for updating earlier
    releases more easily
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
 
114
114
const char* entity_norm(struct entity_conv* conv,const unsigned char* entity)
115
115
{
116
 
        struct element* e = hashtab_find(&entities_htable, (const char*)entity, strlen((const char*)entity));
 
116
        struct cli_element* e = cli_hashtab_find(&entities_htable, (const char*)entity, strlen((const char*)entity));
117
117
        if(e && e->key) {
118
118
                unsigned char* out = u16_normalize(e->data, conv->entity_buff, sizeof(conv->entity_buff)-1);
119
119
                if(out) {
128
128
static size_t encoding_bytes(const char* fromcode, enum encodings* encoding)
129
129
{
130
130
        /* special case for these unusual byteorders */
131
 
        struct element * e = hashtab_find(&aliases_htable,fromcode,strlen(fromcode));
 
131
        struct cli_element * e = cli_hashtab_find(&aliases_htable,fromcode,strlen(fromcode));
132
132
        if(e && e->key) {
133
133
                *encoding = e->data;
134
134
        } else {
534
534
        iconv_t* tab;
535
535
        size_t     len;
536
536
        size_t   last;
537
 
        struct   hashtable hashtab;
 
537
        struct   cli_hashtable hashtab;
538
538
};
539
539
 
540
540
static void iconv_cache_init(struct iconv_cache* cache)
543
543
        cache->len = 0;
544
544
        cache->used = 0; - already done by memset*/
545
545
        cli_dbgmsg(MODULE_NAME "Initializing iconv pool:%p\n",(void*)cache);
546
 
        hashtab_init(&cache->hashtab, 32);
 
546
        cli_hashtab_init(&cache->hashtab, 32);
547
547
}
548
548
 
549
549
static void iconv_cache_destroy(struct iconv_cache* cache)
554
554
                cli_dbgmsg(MODULE_NAME "closing iconv:%p\n",cache->tab[i]);
555
555
                iconv_close(cache->tab[i]);
556
556
        }
557
 
        hashtab_clear(&cache->hashtab);
 
557
        cli_hashtab_clear(&cache->hashtab);
558
558
        free(cache->hashtab.htable);
559
559
        free(cache->tab);
560
560
        free(cache);
655
655
        struct iconv_cache * cache;
656
656
        size_t idx;
657
657
        const size_t fromcode_len = strlen((const char*)fromcode);
658
 
        struct element * e;
 
658
        struct cli_element * e;
659
659
        iconv_t  iconv_struct;
660
660
 
661
661
        init_iconv_pool_ifneeded();
666
666
                return (iconv_t)-1;
667
667
        }
668
668
 
669
 
        e = hashtab_find(&cache->hashtab, fromcode, fromcode_len);
 
669
        e = cli_hashtab_find(&cache->hashtab, fromcode, fromcode_len);
670
670
        if(e && (e->data < 0 || (size_t)e->data > cache->len)) {
671
671
                e = NULL;
672
672
        }
690
690
                        }
691
691
                }
692
692
 
693
 
                hashtab_insert(&cache->hashtab, fromcode, fromcode_len, idx);
 
693
                cli_hashtab_insert(&cache->hashtab, fromcode, fromcode_len, idx);
694
694
                cache->tab[idx] = iconv_struct;
695
695
                cli_dbgmsg(MODULE_NAME "iconv_open(),for:%s -> %p\n",fromcode,(void*)cache->tab[idx]);
696
696
                return cache->tab[idx];