|
From: Shigeharu T. <sh...@ie...> - 2011-10-07 03:46:01
|
shige 10/07 2011
----------------
I wrote:
| Ethan Merritt <merritt@u.washington.edu> wrote:
| | Some Googling suggests that VC++ may work if you do
| | #define snprintf _snprintf
| |
| | This would have to go in some header or configuration file,
| | along with HAVE_SNPRINTF.
|
| Thank you for your reply. But, we already use them (see
| config/config.nt).
I found that the function _snprintf(s, n, format, ...) of VC++
does:
1) if the length of the result string is larger than n, then
it copies n charcters to s and does not add '\0',
2) and then it sets errno to ERANGE.
The last behaver seems to be the reason the gnuplot says
"undefined value". The following patch for src/internal.c is the
dirty huck for this problem:
----- From here -----
--- internal.c~ Fri Oct 7 12:33:11 2011
+++ internal.c Fri Oct 7 12:35:29 2011
@@ -1312,6 +1312,10 @@
default:
int_error(NO_CARET,"internal error: invalid spec_type");
}
+#if MSVC
+ buffer[bufsize-1] = '\0'; /* shige : for safe for VC++ */
+ if (errno == ERANGE) errno = 0; /* shige : very dirty huck for VC++ */
+#endif
#endif
next_start[next_length] = tempchar;
----- To here -----
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
sh...@ie... TEL(&FAX): +81-257-22-8161
+========================================================+
|