From 02eb16fef45712a91e24f6471b9e2f31249c888e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 01 Mar 2005 22:24:10 +0000 Subject: Use poppler instead of including xpdf source code. Poppler is a fork of 2005-03-01 Kristian Høgsberg Use poppler instead of including xpdf source code. Poppler is a fork of xpdf to build it as a shared library. See http://freedesktop.org/wiki/Software/poppler. * pdf/xpdf/*, pdf/goo/*, pdf/splash/*, pdf/fofi/*: Remove included xpdf fork. * pdf/Makefile.am: Build libpdfdocument.a here. * pdf/GDKSplashOutputDev.cc: * pdf/GDKSplashOutputDev.h: * pdf/GnomeVFSStream.cc: * pdf/GnomeVFSStream.h: * pdf-document.cc: * pdf-document.h: * test-gdk-output-dev.cc * Thumb.cc: * Thumb.h: Pull these files out of pdf/xpdf and adjust to compile against poppler. --- (limited to 'pdf/xpdf/NameToCharCode.cc') diff --git a/pdf/xpdf/NameToCharCode.cc b/pdf/xpdf/NameToCharCode.cc deleted file mode 100644 index 8f22a90..0000000 --- a/pdf/xpdf/NameToCharCode.cc +++ /dev/null @@ -1,116 +0,0 @@ -//======================================================================== -// -// NameToCharCode.cc -// -// Copyright 2001-2003 Glyph & Cog, LLC -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "NameToCharCode.h" - -//------------------------------------------------------------------------ - -struct NameToCharCodeEntry { - char *name; - CharCode c; -}; - -//------------------------------------------------------------------------ - -NameToCharCode::NameToCharCode() { - int i; - - size = 31; - len = 0; - tab = (NameToCharCodeEntry *)gmalloc(size * sizeof(NameToCharCodeEntry)); - for (i = 0; i < size; ++i) { - tab[i].name = NULL; - } -} - -NameToCharCode::~NameToCharCode() { - int i; - - for (i = 0; i < size; ++i) { - if (tab[i].name) { - gfree(tab[i].name); - } - } - gfree(tab); -} - -void NameToCharCode::add(char *name, CharCode c) { - NameToCharCodeEntry *oldTab; - int h, i, oldSize; - - // expand the table if necessary - if (len >= size / 2) { - oldSize = size; - oldTab = tab; - size = 2*size + 1; - tab = (NameToCharCodeEntry *)gmalloc(size * sizeof(NameToCharCodeEntry)); - for (h = 0; h < size; ++h) { - tab[h].name = NULL; - } - for (i = 0; i < oldSize; ++i) { - if (oldTab[i].name) { - h = hash(oldTab[i].name); - while (tab[h].name) { - if (++h == size) { - h = 0; - } - } - tab[h] = oldTab[i]; - } - } - gfree(oldTab); - } - - // add the new name - h = hash(name); - while (tab[h].name && strcmp(tab[h].name, name)) { - if (++h == size) { - h = 0; - } - } - if (!tab[h].name) { - tab[h].name = copyString(name); - } - tab[h].c = c; - - ++len; -} - -CharCode NameToCharCode::lookup(char *name) { - int h; - - h = hash(name); - while (tab[h].name) { - if (!strcmp(tab[h].name, name)) { - return tab[h].c; - } - if (++h == size) { - h = 0; - } - } - return 0; -} - -int NameToCharCode::hash(char *name) { - char *p; - unsigned int h; - - h = 0; - for (p = name; *p; ++p) { - h = 17 * h + (int)(*p & 0xff); - } - return (int)(h % size); -} -- cgit v0.9.1