Mercurial > hg > octave-terminal
changeset 13753:ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
* mex.cc: Change return value to be 0 on success to match Matlab.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 25 Oct 2011 21:23:37 -0700 |
parents | 6f068e3f3f9c |
children | e652ff4d1522 |
files | src/mex.cc |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mex.cc +++ b/src/mex.cc @@ -1274,10 +1274,17 @@ int get_string (char *buf, mwSize buflen) const { - int retval = 1; + int retval = 0; mwSize nel = get_number_of_elements (); + if (! (nel < buflen)) + { + retval = 1; + if (buflen > 0) + nel = buflen-1; + } + if (nel < buflen) { mxChar *ptr = static_cast<mxChar *> (pr);