Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nifti2/nifti2_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,7 @@ void nifti_dmat44_to_orientation( nifti_dmat44 R ,
case -2: i = NIFTI_A2P ; break ;
case 3: i = NIFTI_I2S ; break ;
case -3: i = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; i = 0 ; break ;
}

switch( jbest*qbest ){
Expand All @@ -2788,7 +2788,7 @@ void nifti_dmat44_to_orientation( nifti_dmat44 R ,
case -2: j = NIFTI_A2P ; break ;
case 3: j = NIFTI_I2S ; break ;
case -3: j = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; j = 0 ; break ;
}

switch( kbest*rbest ){
Expand All @@ -2798,7 +2798,7 @@ void nifti_dmat44_to_orientation( nifti_dmat44 R ,
case -2: k = NIFTI_A2P ; break ;
case 3: k = NIFTI_I2S ; break ;
case -3: k = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; k = 0 ; break ;
}

*icod = i ; *jcod = j ; *kcod = k ; }
Expand Down Expand Up @@ -2961,7 +2961,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: i = NIFTI_A2P ; break ;
case 3: i = NIFTI_I2S ; break ;
case -3: i = NIFTI_S2I ; break ;
default: break;
default: i = 0 ; break;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Google Carbon] Missing assert(0) ; here (and on lines 2974 and 2984 below for j and k). Please change all three default: arms in nifti_mat44_to_orientation to default: assert(0) ; i = 0 ; break ; (etc.) so they match nifti_dmat44_to_orientation above (lines 2781, 2791, 2801) and niftilib/nifti1_io.c (lines 2112, 2122, 2132).

}

switch( jbest*qbest ){
Expand All @@ -2971,7 +2971,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: j = NIFTI_A2P ; break ;
case 3: j = NIFTI_I2S ; break ;
case -3: j = NIFTI_S2I ; break ;
default: break;
default: j = 0 ; break;
}

switch( kbest*rbest ){
Expand All @@ -2981,7 +2981,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: k = NIFTI_A2P ; break ;
case 3: k = NIFTI_I2S ; break ;
case -3: k = NIFTI_S2I ; break ;
default: break;
default: k = 0 ; break;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add assert(0); for these cases.

All three of these groups of 3 have comment above saying: "At this point ibest is 1 or 2 or 3; pbest is -1 or +1; etc."

Assuming that's true, the assert is desirable to prove the comment. And the assignment to 0 is good in case the comment/assert are wrong.


*icod = i ; *jcod = j ; *kcod = k ; }
Expand Down
6 changes: 3 additions & 3 deletions niftilib/nifti1_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: i = NIFTI_A2P ; break ;
case 3: i = NIFTI_I2S ; break ;
case -3: i = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; i = 0 ; break ;
}

switch( jbest*qbest ){
Expand All @@ -2119,7 +2119,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: j = NIFTI_A2P ; break ;
case 3: j = NIFTI_I2S ; break ;
case -3: j = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; j = 0 ; break ;
}

switch( kbest*rbest ){
Expand All @@ -2129,7 +2129,7 @@ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod )
case -2: k = NIFTI_A2P ; break ;
case 3: k = NIFTI_I2S ; break ;
case -3: k = NIFTI_S2I ; break ;
default: assert(0) ; break ;
default: assert(0) ; k = 0 ; break ;
}

*icod = i ; *jcod = j ; *kcod = k ;
Expand Down
Loading