octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #44186] print command gives incorrect postscri


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #44186] print command gives incorrect postscript file
Date: Mon, 16 Feb 2015 00:51:59 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #41, bug #44186 (project octave):

I see your modification.  Seems like the right idea, and glad it works.  It's
not the most portable across ghostscript versions, however.  Is there another
way of accomplishing this?

For example, the first code hunk


+#ifdef __MINGW32__
+    // add 'b' to ensure in binary mode
+    char tmpmode[32];
+ 
+    strcpy(tmpmode, mode);
+    strcat(tmpmode,"b");
+    mode = tmpmode;
+#endif


already has some kind of binary switch option in the ghostscript code, here:


/* Open a temporary file, with or without a stream. */
static int
pdf_open_temp_file(gx_device_pdf *pdev, pdf_temp_file_t *ptf)
{
    char fmode[4];

    if (strlen(gp_fmode_binary_suffix) > 2)
        return_error(gs_error_invalidfileaccess);

    strcpy(fmode, "w+");
    strcat(fmode, gp_fmode_binary_suffix);
    ptf->file = gp_open_scratch_file_64(pdev->memory,
                                     gp_scratch_file_name_prefix,
                                     ptf->file_name,
                                     fmode);
    if (ptf->file == 0)
        return_error(gs_error_invalidfileaccess);
    return 0;
}


So, all that is needed is for "gp_fmode_binary_suffix" to be defined to "b",
as is the case for several operating systems:


base/gp_dosfs.c:const char gp_fmode_binary_suffix[] = "b";
base/gp.h:extern const char gp_fmode_binary_suffix[];
base/gp_macio.c:const char gp_fmode_binary_suffix[] = "b";
base/gp_ntfs.c:const char gp_fmode_binary_suffix[] = "b";
base/gp_os2fs.c:const char gp_fmode_binary_suffix[] = "b";
base/gp_unifn.c:const char gp_fmode_binary_suffix[] = "";
base/gp_vms.c:const char gp_fmode_binary_suffix[] = "";
base/gxclfile.c:        strcat(fmode, gp_fmode_binary_suffix);
base/gxclist.c:    strcat(fmode, gp_fmode_binary_suffix);
base/gxclread.c:        strncat(fmode, gp_fmode_binary_suffix, 1);
base/gxclthrd.c:    strncat(fmode, gp_fmode_binary_suffix, 1);
base/gxclthrd.c:            strncat(fmode, gp_fmode_binary_suffix, 1);
base/gxclthrd.c:            strncat(fmode, gp_fmode_binary_suffix, 1);
base/sfxcommon.c:    strcat(fmode, gp_fmode_binary_suffix);


It seems to me that MXE should be using base/gp_dosfs.c.  Is that correct?  In
your previous post you mentioned something about the MXE build using Unix
functions/libraries.  How can the compilation be made to use the DOS-oriented
files?

The second code hunk you changed, I'm not sure about.  It's the same idea, but
for some reason doesn't have the suffix addition code.  Then again, maybe that
is done upstream somewhere.  I do see


strncat(fmode, gp_fmode_binary_suffix, 1);


used in several locations.  So, I'd say try configuring the compilation so
that base/gp_dosfs.c is compiled and its object file included.  For example,
on my linux system (again, linux) I see the file obj/gp_unifn.o but no other
gp_*.o file from that group above that contain gp_fmode_binary_suffix
definitions.  I would think on the MXE build there should be only a file
obj/gp_dosfs.obj.



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44186>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]