Jonathan Gray wrote:
Poppler is a PDF rendering library based on the xpdf-3.0 code base.

This is needed for upcoming evince port, tested on i386 only so far.

no.  some patches are not good.  don't use constants:

don't use
  char buf[512]
  snprintf(buf, 512, fmt)
but
  char buf[512]
  snprintf(buf, sizeof(buf), fmt)


E.g. in patch-fofi_FoFiTrueType_cc

dont use:

void FoFiTrueType::convertToType42(char *psName, char **encoding,
                                   Gushort *codeToGID,
                                   FoFiOutputFunc outputFunc,
                                   void *outputStream) {
  char buf[512];
  GBool ok;

  // write the header
  ok = gTrue;
  snprintf(buf, 512, "%%!PS-TrueTypeFont-%g\n", (double)getS32BE(0, &ok) / 
65536.0);
  (*outputFunc)(outputStream, buf, strlen(buf));


but use:

 void FoFiTrueType::convertToType42(char *psName, char **encoding,
                                   Gushort *codeToGID,
                                   FoFiOutputFunc outputFunc,
                                   void *outputStream) {
  char buf[512];
  GBool ok;

  // write the header
  ok = gTrue;
  snprintf(buf, sizeof(buf), "%%!PS-TrueTypeFont-%g\n", (double)getS32BE(0, 
&ok) / 65536.0);
  (*outputFunc)(outputStream, buf, strlen(buf));


a better patch in this case is:

 $OpenBSD$
--- fofi/FoFiTrueType.cc.orig   Tue Aug  9 16:30:32 2005
+++ fofi/FoFiTrueType.cc        Tue Aug  9 16:34:35 2005
@@ -414,7 +414,7 @@ void FoFiTrueType::convertToType42(char

   // write the header
   ok = gTrue;
-  sprintf(buf, "%%!PS-TrueTypeFont-%g\n", (double)getS32BE(0, &ok) / 65536.0);
+  snprintf(buf, sizeof(buf), "%%!PS-TrueTypeFont-%g\n", (double)getS32BE(0, 
&ok) / 65536.0);
   (*outputFunc)(outputStream, buf, strlen(buf));

Reply via email to