[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #34546] mxGetString returns wrong status
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #34546] mxGetString returns wrong status |
Date: |
Fri, 14 Oct 2011 12:52:56 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Iceweasel/7.0.1 |
URL:
<http://savannah.gnu.org/bugs/?34546>
Summary: mxGetString returns wrong status
Project: GNU Octave
Submitted by: None
Submitted on: Fri 14 Oct 2011 12:52:54 PM UTC
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: Leonardo Vainsencher
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 3.4.3
Operating System: Any
_______________________________________________________
Details:
For MATLAB compatibility mxGetString() should return 0 if the operation
succeeds.
Moreover, if the buffer length is insufficient, the return
string should be truncated, in which case the return status is set to 1.
A patch like the following should fix the problem (untested!)...
*** octave-3.4.3/src/mex.cc 2011-09-01 16:38:52.000000000 +0300
--- octave-3.4.3-patch/src/mex.cc 2011-10-14 14:32:45.000000000 +0200
***************
*** 1279,1284 ****
--- 1279,1289 ----
mwSize nel = get_number_of_elements ();
if (nel < buflen)
+ retval = 0;
+ else if (buflen > 0)
+ nel = buflen-1;
+
+ if (nel < buflen)
{
mxChar *ptr = static_cast<mxChar *> (pr);
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?34546>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #34546] mxGetString returns wrong status,
anonymous <=