Bug in utoi(), which made it ignore a leading minus sign when
[sgt/halibut] / bk_pdf.c
index d69e833..525e7d9 100644 (file)
--- a/bk_pdf.c
+++ b/bk_pdf.c
@@ -232,7 +232,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
                    continue;
                idx = sfnt_glyphtoindex(fe->font->info->fontfile,
                                        fe->vector[i]);
-               if (start >= 0 && idx - startidx == i - start) {
+               if (start >= 0 && idx - startidx == (unsigned)(i - start)) {
                    if (ranges[start] == 1) {
                        nranges++; nchars--;
                    }
@@ -303,7 +303,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
            objtext(cidfont, "/FontDescriptor ");
            objref(cidfont, fontdesc);
            objtext(cidfont, "\n/W[0[");
-           for (i = 0; i < sfnt_nglyphs(fe->font->info->fontfile); i++) {
+           for (i = 0; i < (int)sfnt_nglyphs(fe->font->info->fontfile); i++) {
                char buf[20];
                double width;
                width = find_width(fe->font,
@@ -665,7 +665,10 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
      * Write out the PDF file.
      */
 
-    fp = fopen(filename, "wb");
+    if (!strcmp(filename, "-"))
+       fp = stdout;
+    else
+       fp = fopen(filename, "wb");
     if (!fp) {
        error(err_cantopenw, filename);
        return;
@@ -712,7 +715,8 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
            olist.tail->number + 1, cat->number, info->number);
     fprintf(fp, "startxref\n%d\n%%%%EOF\n", fileoff);
 
-    fclose(fp);
+    if (fp != stdout)
+       fclose(fp);
 
     sfree(filename);
 }