File sam2p-0.49.2-cpp11.patch of Package sam2p
Index: sam2p-0.49.2/gensio.cpp
===================================================================
--- sam2p-0.49.2.orig/gensio.cpp
+++ sam2p-0.49.2/gensio.cpp
@@ -15,7 +15,7 @@ extern "C" int _l_stat(const char *file_
extern "C" int _v_s_n_printf ( char *str, size_t n, const char *format, va_list ap );
#else
#undef __STRICT_ANSI__ /* for __MINGW32__ */
-#define _BSD_SOURCE 1 /* vsnprintf(); may be emulated with fixup_vsnprintf() */
+#define _DEFAULT_SOURCE 1 /* vsnprintf(); may be emulated with fixup_vsnprintf() */
#ifndef __APPLE__ /* SUXX: Max OS X has #ifndef _POSIX_SOURCE around lstat() :-( */
#define _POSIX_SOURCE 1 /* also popen() */
#endif
@@ -488,7 +488,7 @@ Filter::PipeE::PipeE(GenBuffer::Writable
#if HAVE_PTS_POPEN
if (!tmpsname) {
- if (NULLP==(p=popen(redir_cmd(), "w"CFG_PTS_POPEN_B))) Error::sev(Error::EERROR) << "Filter::PipeE" << ": popen() failed: " << (SimBuffer::B().appendDumpC(redir_cmd)) << (Error*)0;
+ if (NULLP==(p=popen(redir_cmd(), "w" CFG_PTS_POPEN_B))) Error::sev(Error::EERROR) << "Filter::PipeE" << ": popen() failed: " << (SimBuffer::B().appendDumpC(redir_cmd)) << (Error*)0;
signal(SIGPIPE, SIG_IGN); /* Don't abort process with SIGPIPE signals if child cannot read our data */
} else {
#else
@@ -616,7 +616,7 @@ slen_t Filter::PipeD::vi_read(char *tobu
if (state==0) { /* Read the whole stream from `in', write it to `tmpsname' */
#if HAVE_PTS_POPEN
if (!tmpsname) {
- if (NULLP==(p=popen(redir_cmd(), "w"CFG_PTS_POPEN_B))) Error::sev(Error::EERROR) << "Filter::PipeD" << ": popen() failed: " << (SimBuffer::B().appendDumpC(redir_cmd)) << (Error*)0;
+ if (NULLP==(p=popen(redir_cmd(), "w" CFG_PTS_POPEN_B))) Error::sev(Error::EERROR) << "Filter::PipeD" << ": popen() failed: " << (SimBuffer::B().appendDumpC(redir_cmd)) << (Error*)0;
signal(SIGPIPE, SIG_IGN); /* Don't abort process with SIGPIPE signals if child cannot read our data */
vi_precopy();
in.vi_read(0,0);
Index: sam2p-0.49.2/in_ps.cpp
===================================================================
--- sam2p-0.49.2.orig/in_ps.cpp
+++ sam2p-0.49.2/in_ps.cpp
@@ -135,7 +135,7 @@ static Image::Sampled *in_eps_reader(Ima
// fprintf(stderr, "bbox=[%"PTS_CFG_PRINTFGLEN"g %"PTS_CFG_PRINTFGLEN"g %"PTS_CFG_PRINTFGLEN"g %"PTS_CFG_PRINTFGLEN"g]\n", llx, lly, urx, ury);
/* Dat: we must call translate _after_ setpagedevice (so it will take effect), at least with ESP Ghostscript 7.05.6 (2003-02-05); BUGFIX at Fri Aug 12 22:49:07 CEST 2005 */
sprintf(bboxline,
- "<</PageSize[%"PTS_CFG_PRINTFGLEN"g %"PTS_CFG_PRINTFGLEN"g]>>setpagedevice\n"
+ "<</PageSize[%" PTS_CFG_PRINTFGLEN "g %" PTS_CFG_PRINTFGLEN "g]>>setpagedevice\n"
/* removing /PageSize also cancels /a4, /a5 etc. */
/* we need `currentmatrix ... setpagedevice setmatrix' because
* setpagedevice cancels the current transformation matrix so our
@@ -145,7 +145,7 @@ static Image::Sampled *in_eps_reader(Ima
"/setpagedevice{matrix currentmatrix exch "
"dup length dict copy dup /PageSize undef setpagedevice "
"setmatrix}bind def\n"
- "%"PTS_CFG_PRINTFGLEN"g %"PTS_CFG_PRINTFGLEN"g translate\n"
+ "%" PTS_CFG_PRINTFGLEN "g %" PTS_CFG_PRINTFGLEN "g translate\n"
, urx-llx, ury-lly, -llx, -lly);
} else {
Error::sev(Error::WARNING) << "in_eps_reader: missing EPS bbox" << (Error*)0;
Index: sam2p-0.49.2/minips.cpp
===================================================================
--- sam2p-0.49.2.orig/minips.cpp
+++ sam2p-0.49.2/minips.cpp
@@ -290,9 +290,9 @@ MiniPS::Real::Real(double d_, char const
void MiniPS::Real::dump(GenBuffer::Writable &out_, bool dumpPS_force) {
char buf[64]; /* Imp: should be enough?? */
if (metric!=0 && (dumpPS_force || dumpPS)) {
- sprintf(buf, "%"PTS_CFG_PRINTFGLEN"g%s", d, me_psfactor[metric]);
+ sprintf(buf, "%" PTS_CFG_PRINTFGLEN "g%s", d, me_psfactor[metric]);
} else {
- sprintf(buf, "%"PTS_CFG_PRINTFGLEN"g", d*me_factor[metric]);
+ sprintf(buf, "%" PTS_CFG_PRINTFGLEN "g", d*me_factor[metric]);
}
out_ << buf;
}
@@ -1042,7 +1042,7 @@ void MiniPS::dumpScale(GenBuffer::Writab
} else {
d = d < 0 ? 72.0 / -d : d / 72.0;
char buf[64]; /* Dat: enough */
- sprintf(buf, "%"PTS_CFG_PRINTFGLEN"g", d);
+ sprintf(buf, "%" PTS_CFG_PRINTFGLEN "g", d);
out << buf;
}
}
@@ -1091,7 +1091,7 @@ void MiniPS::dumpAdd3(GenBuffer::Writabl
out << (rounding>=2 && ll<0 ? 0 : ll);
} else {
char buf[64]; /* Dat: enough */
- sprintf(buf, "%"PTS_CFG_PRINTFGLEN"g", d);
+ sprintf(buf, "%" PTS_CFG_PRINTFGLEN "g", d);
out << buf;
}
}
Index: sam2p-0.49.2/ps_tiny.c
===================================================================
--- sam2p-0.49.2.orig/ps_tiny.c
+++ sam2p-0.49.2/ps_tiny.c
@@ -151,7 +151,7 @@ static void ungetcc(int c) {
}
static void erri(char const*msg1, char const*msg2) {
- fprintf(stderr, "%s: error at %"SLEN_P"u.%"SLEN_P"u.%"SLEN_P"u: %s%s\n",
+ fprintf(stderr, "%s: error at %" SLEN_P "u.%" SLEN_P "u.%" SLEN_P "u: %s%s\n",
PROGNAME, curline, curofs-leftofs+1, curofs, msg1, msg2?msg2:"");
exit(3);
}
@@ -230,7 +230,7 @@ static sbool is_wordx(char const *s) {
/** @param b: assume null-terminated @return true on error */
static /*inline*/ sbool toInteger(char *s, psint_t *ret) {
int n=0; /* BUGFIX?? found by __CHECKER__ */
- return sscanf(s, "%"SLEN_P"i%n", ret, &n)<1 || s[n]!='\0';
+ return sscanf(s, "%" SLEN_P "i%n", ret, &n)<1 || s[n]!='\0';
}
/** @param b: assume null-terminated @return true on error */
@@ -700,7 +700,7 @@ int main(int argc, char**argv) {
getotag("Abbr");
getkey("acount"); acount=getuintval();
getkey("xcount"); xcount=getuintval();
- sprintf(tmp,"%"SLEN_P"u dict%%</I>", acount+xcount);
+ sprintf(tmp,"%" SLEN_P "u dict%%</I>", acount+xcount);
setifmt(tmp,0); copy("I"); noifmt();
gettagbeg();