Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This should fix issue number 1786 which describes a problem when
subscripting an empty array.
  • Loading branch information
tfredian authored and zack-vii committed Sep 4, 2019
1 parent 1cd4967 commit 53553d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mdsshr/MdsGet1DxA.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <mdsshr.h>
#include <STATICdef.h>

#define align(bytes,size) ((((bytes) + (size) - 1)/(size)) * (size))
static inline l_length_t align(l_length_t bytes, l_length_t size) {
if (size == 0) return bytes;
return ((bytes + size -1)/size)*size;
}

EXPORT int MdsGet1DxA(const mdsdsc_a_t *const in_ptr, const length_t *const length_ptr, const dtype_t *const dtype_ptr, mdsdsc_xd_t *const out_xd){
array_coeff *in_dsc = (array_coeff *) in_ptr;
Expand Down
4 changes: 4 additions & 0 deletions tditest/testing/test-tdishr.ans
Original file line number Diff line number Diff line change
Expand Up @@ -6171,6 +6171,10 @@ data(build_signal(1:10,*,*))
[1,2,3,4,5,6,7,8,9,10]
data_with_units(build_signal(10*$VALUE,build_with_units(1:10,"counts"),*))
Build_With_Units([10,20,30,40,50,60,70,80,90,100], "counts")
data(*)
$Missing
data(*)[0]
[]
I_TO_X(BUILD_DIM(BUILD_WINDOW(2,5,1.1),BUILD_RANGE(,,3)))
Set_Range(2:5,[7.1,10.1,13.1,16.1])
I_TO_X(BUILD_DIM(BUILD_WINDOW(2,7,1.1),BUILD_RANGE(,,3)),1:4)
Expand Down
2 changes: 2 additions & 0 deletions tditest/testing/test-tdishr.tdi
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,8 @@ wait(.01)
!
data(build_signal(1:10,*,*))
data_with_units(build_signal(10*$VALUE,build_with_units(1:10,"counts"),*))
data(*)
data(*)[0]
!
! Functions implemented in TdiItoX.c
!
Expand Down

0 comments on commit 53553d7

Please sign in to comment.