diff --git a/dviwin.cpp b/dviwin.cpp index 6fc98f68e..947bff5ec 100644 --- a/dviwin.cpp +++ b/dviwin.cpp @@ -457,8 +457,8 @@ void dviWindow::exportPS(QString fname, QString options, KPrinter *printer) qSysInfo (&wordSize, &bigEndian); // Proper error handling? We don't care. FILE *f = fopen(QFile::encodeName(sourceFileName),"r+"); - for(Q_UINT32 i=0; i<=dviFile->total_pages; i++) { - fseek(f,dviFile->page_offset[i]+1, SEEK_SET); + for(Q_UINT32 i=1; i<=dviFile->total_pages; i++) { + fseek(f,dviFile->page_offset[i-1]+1, SEEK_SET); // Write the page number to the file, taking good care of byte // orderings. Hopefully QT will implement random access QFiles // soon. diff --git a/font.cpp b/font.cpp index 7e36c8fed..837c06cb6 100644 --- a/font.cpp +++ b/font.cpp @@ -15,7 +15,6 @@ #include "oconfig.h" -extern FILE *xdvi_xfopen(const char *filename, const char *type); extern void oops(QString message); @@ -39,7 +38,7 @@ void font::fontNameReceiver(QString fname) kdDebug() << "FONT NAME RECEIVED:" << filename << endl; #endif - file = xdvi_xfopen(QFile::encodeName(filename), "r"); + file = fopen(QFile::encodeName(filename), "r"); if (file == NULL) { kdError() << i18n("Can't find font ") << fontname << "." << endl; return; @@ -154,13 +153,13 @@ struct glyph *font::glyphptr(unsigned int ch) { return NULL; /* previously flagged missing char */ if (file == NULL) { - file = xdvi_xfopen(QFile::encodeName(filename), "r"); + file = fopen(QFile::encodeName(filename), "r"); if (file == NULL) { oops(QString(i18n("Font file disappeared: %1")).arg(filename) ); return NULL; } } - Fseek(file, g->addr, 0); + fseek(file, g->addr, 0); read_PK_char(ch); if (g->bitmap.bits == NULL) { diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp index 59785ea58..4a5d042c7 100644 --- a/kdvi_multipage.cpp +++ b/kdvi_multipage.cpp @@ -112,6 +112,8 @@ KDVIMultiPage::~KDVIMultiPage() bool KDVIMultiPage::openFile() { + kdDebug(4300) << url().prettyURL() << endl; + emit setStatusBarText(QString(i18n("Loading file %1")).arg(m_file)); bool r = window->setFile(m_file); diff --git a/pk.cpp b/pk.cpp index 572aaf4a8..555b61c43 100644 --- a/pk.cpp +++ b/pk.cpp @@ -463,7 +463,7 @@ void font::read_PK_index(void) kdDebug() << "Reading PK pixel file " << filename << endl; #endif - Fseek(file, (long) one(file), SEEK_CUR); /* skip comment */ + fseek(file, (long) one(file), SEEK_CUR); /* skip comment */ (void) four(file); /* skip design size */ long file_checksum = four(file); @@ -506,7 +506,7 @@ void font::read_PK_index(void) } glyphtable[ch].addr = ftell(file); glyphtable[ch].x2 = PK_flag_byte; - Fseek(file, (long) bytes_left, SEEK_CUR); + fseek(file, (long) bytes_left, SEEK_CUR); #ifdef DEBUG_PK kdDebug() << "Scanning pk char " << ch << "at " << glyphtable[ch].addr << endl; #endif diff --git a/util.cpp b/util.cpp index 8b598a0ab..523b5b52a 100644 --- a/util.cpp +++ b/util.cpp @@ -120,31 +120,6 @@ void alloc_bitmap(bitmap *bitmap) bitmap->bits = xmalloc(size != 0 ? size : 1, "character bitmap"); } - -/* - * Close the pixel file for the least recently used font. - */ - -extern fontPool font_pool; - -/* - * Open a file in the given mode. - */ -FILE *xdvi_xfopen(const char *filename, const char *type) -#define TYPE type -{ - /* Try not to let the file table fill up completely. */ - FILE *f = fopen(filename, "r"); - /* If the open failed, try closing a file unconditionally. - Interactive Unix 2.2.1, at least, doesn't set errno to EMFILE - or ENFILE even when it should. In any case, it doesn't hurt - much to always try. */ - if (f == NULL) - f = fopen(filename, TYPE); - return f; -} -#undef TYPE - /* * * Read size bytes from the FILE fp, constructing them into a diff --git a/vf.cpp b/vf.cpp index 7bab22eef..3a180f566 100644 --- a/vf.cpp +++ b/vf.cpp @@ -78,7 +78,7 @@ void font::read_VF_index(void) kdDebug() << "Reading VF pixel file " << filename << endl; #endif // Read preamble. - Fseek(VF_file, (long) one(VF_file), 1); /* skip comment */ + fseek(VF_file, (long) one(VF_file), 1); /* skip comment */ long file_checksum = four(VF_file); if (file_checksum && checksum && file_checksum != checksum) @@ -95,7 +95,7 @@ void font::read_VF_index(void) int design = four(VF_file); int len = one(VF_file) + one(VF_file); /* sequence point in the middle */ char *fontname = xmalloc((unsigned) len + 1, "font name"); - Fread(fontname, sizeof(char), len, VF_file); + fread(fontname, sizeof(char), len, VF_file); fontname[len] = '\0'; #ifdef DEBUG_FONTS @@ -144,7 +144,7 @@ void font::read_VF_index(void) if (cc >= 256) { kdError() << i18n("Virtual character ") << cc << i18n(" in font ") << fontname << i18n(" ignored.") << endl; - Fseek(VF_file, (long) len, 1); + fseek(VF_file, (long) len, 1); continue; } } else { /* short form packet */ @@ -167,13 +167,13 @@ void font::read_VF_index(void) } else m->pos = (unsigned char *)xmalloc(len*sizeof(unsigned char),"unknown"); } - Fread((char *) m->pos, 1, len, VF_file); + fread((char *) m->pos, 1, len, VF_file); m->end = m->pos + len; } } if (cmnd != POST) oops(QString(i18n("Wrong command byte found in VF macro list: %1")).arg(cmnd)); - Fclose (VF_file); + fclose (VF_file); file = NULL; } diff --git a/xdvi.h b/xdvi.h index d4060b6b3..83bf94895 100644 --- a/xdvi.h +++ b/xdvi.h @@ -5,21 +5,6 @@ * Written by Eric C. Cooper, CMU */ -/******************************** - * The C environment * - *******************************/ - -/* For wchar_t et al., that the X files might want. */ -extern "C" { -#include -} - - -#include /* include Xfuncs.h, if available */ -#include /* needed for XDestroyImage */ -#include -#include -#undef wchar_t typedef unsigned long Pixel; typedef char Boolean; @@ -55,20 +40,6 @@ typedef char Boolean; #define _XFUNCPROTOEND #endif - -#define Printf (void) printf -#define Puts (void) puts -#define Fprintf (void) fprintf -#define Sprintf (void) sprintf -#define Fseek (void) fseek -#define Fread (void) fread -#define Fputs (void) fputs -#define Putc (void) putc -#define Putchar (void) putchar -#define Fclose (void) fclose -#define Fflush (void) fflush -#define Strcpy (void) strcpy - /******************************** * Types and data * *******************************/