Skip to content

Commit

Permalink
Use gnulib replacement for fseeko in when printing to .ps files (bug …
Browse files Browse the repository at this point in the history
…#66399).

* libinterp/corefcn/gl2ps-print.cc (gl2ps_renderer::draw): Use wrapper around
gnulib's "fseeko" function instead of using "std::fseek". That might improve
support when writing .ps files larger than 2 GiB. (Suggested by Paul Eggert and
Bruno Haible.)
  • Loading branch information
mmuetzel committed Nov 13, 2024
1 parent b718560 commit 104906b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libinterp/corefcn/gl2ps-print.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <gl2ps.h>

#include "file-ops.h"
#include "filepos-wrappers.h"
#include "lo-mappers.h"
#include "oct-locbuf.h"
#include "oct-env.h"
Expand Down Expand Up @@ -419,7 +420,7 @@ gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd)
m_buffer_overflow = false;
buffsize *= 2;

std::fseek (tmpf, 0, SEEK_SET);
octave_fseeko_wrapper (tmpf, 0, SEEK_SET);
octave_ftruncate_wrapper (fileno (tmpf), 0);

// For LaTeX output the print process uses 2 drawnow() commands.
Expand Down Expand Up @@ -493,7 +494,7 @@ gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd)
}

// Copy temporary file to pipe
std::fseek (tmpf, 0, SEEK_SET);
octave_fseeko_wrapper (tmpf, 0, SEEK_SET);
char str[8192]; // 8 kB is a common kernel buffersize
std::size_t nread, nwrite;
nread = 1;
Expand Down

0 comments on commit 104906b

Please sign in to comment.