Mercurial > hg > octave-nkf
comparison src/utils.cc @ 4351:1e7f4405e037
[project @ 2003-02-21 19:42:01 by jwe]
author | jwe |
---|---|
date | Fri, 21 Feb 2003 19:42:01 +0000 |
parents | ebc2d8e4968b |
children | d7d9ca19960a |
comparison
equal
deleted
inserted
replaced
4350:b4661459eff7 | 4351:1e7f4405e037 |
---|---|
912 | 912 |
913 static size_t size = initial_size; | 913 static size_t size = initial_size; |
914 | 914 |
915 static char *buf = 0; | 915 static char *buf = 0; |
916 | 916 |
917 size_t nchars; | 917 int nchars; |
918 | 918 |
919 if (! buf) | 919 if (! buf) |
920 buf = new char [size]; | 920 buf = new char [size]; |
921 | 921 |
922 if (! buf) | 922 if (! buf) |
956 | 956 |
957 nchars = octave_raw_vsnprintf (buf, size, fmt, args); | 957 nchars = octave_raw_vsnprintf (buf, size, fmt, args); |
958 | 958 |
959 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 959 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
960 | 960 |
961 if (nchars > -1) | 961 if (nchars > -1 && nchars < size-1) |
962 return buf; | 962 return buf; |
963 else | 963 else |
964 { | 964 { |
965 delete [] buf; | 965 delete [] buf; |
966 | 966 |