@@ -1527,7 +1527,7 @@ static void Test_strToJavaModifiedUTF8(void) {
15271527 0xee , 0x80 , 0x81 , 0xee , 0x80 , 0x82 , 0xee , 0x80 , 0x83 ,
15281528 0xed , 0xa0 , 0x80 , 0xed , 0xb0 , 0x80 , 0xed , 0xb0 , 0x80 , 0xed , 0xa0 , 0x80 , 0xc0 , 0x80 ,
15291529 0xed , 0xaf , 0xbf , 0xed , 0xbf , 0xbf ,
1530- 0x64 , 0x65 , 0x66 , 0x67 , 0x68 , 0x69 , 0x6a , 0x6b , 0x6c , 0xc3 , 0xad , 0xe0 , 0xb8 , 0x8e , 0x6f
1530+ 0x64 , 0x65 , 0x66 , 0x67 , 0x68 , 0x69 , 0x6a , 0x6b , 0x6c , 0xc3 , 0xad , 0xe0 , 0xb8 , 0x8e , 0x6f , 0
15311531 };
15321532 static const UChar shortSrc []= {
15331533 0xe01 , 0xe1 , 0x61
@@ -1554,7 +1554,7 @@ static void Test_strToJavaModifiedUTF8(void) {
15541554 p = u_strToJavaModifiedUTF8 (dest , (int32_t )sizeof (dest ), & length ,
15551555 src , UPRV_LENGTHOF (src ), & errorCode );
15561556 if ( U_FAILURE (errorCode ) || p != dest ||
1557- length != UPRV_LENGTHOF (expected ) || 0 != memcmp (dest , expected , length ) ||
1557+ length != ( UPRV_LENGTHOF (expected ) - 1 ) || 0 != memcmp (dest , expected , length ) ||
15581558 dest [length ]!= 0
15591559 ) {
15601560 log_err ("u_strToJavaModifiedUTF8(normal) failed - %s\n" , u_errorName (errorCode ));
@@ -1565,18 +1565,18 @@ static void Test_strToJavaModifiedUTF8(void) {
15651565 p = u_strToJavaModifiedUTF8 (dest , (int32_t )sizeof (dest ), NULL ,
15661566 src , UPRV_LENGTHOF (src ), & errorCode );
15671567 if ( U_FAILURE (errorCode ) || p != dest ||
1568- 0 != memcmp (dest , expected , UPRV_LENGTHOF (expected )) ||
1569- dest [UPRV_LENGTHOF (expected )]!= 0
1568+ 0 != memcmp (dest , expected , ( UPRV_LENGTHOF (expected ) - 1 )) ||
1569+ dest [( UPRV_LENGTHOF (expected ) - 1 )]!= 0
15701570 ) {
15711571 log_err ("u_strToJavaModifiedUTF8(normal, pLength=NULL) failed - %s\n" , u_errorName (errorCode ));
15721572 }
15731573 memset (dest , 0xff , sizeof (dest ));
15741574 errorCode = U_ZERO_ERROR ;
15751575 length = -5 ;
1576- p = u_strToJavaModifiedUTF8 (dest , UPRV_LENGTHOF (expected ), & length ,
1576+ p = u_strToJavaModifiedUTF8 (dest , ( UPRV_LENGTHOF (expected ) - 1 ), & length ,
15771577 src , UPRV_LENGTHOF (src ), & errorCode );
15781578 if ( errorCode != U_STRING_NOT_TERMINATED_WARNING || p != dest ||
1579- length != UPRV_LENGTHOF (expected ) || 0 != memcmp (dest , expected , length ) ||
1579+ length != ( UPRV_LENGTHOF (expected ) - 1 ) || 0 != memcmp (dest , expected , length ) ||
15801580 dest [length ]!= (char )0xff
15811581 ) {
15821582 log_err ("u_strToJavaModifiedUTF8(tight) failed - %s\n" , u_errorName (errorCode ));
@@ -1604,10 +1604,10 @@ static void Test_strToJavaModifiedUTF8(void) {
16041604 memset (dest , 0xff , sizeof (dest ));
16051605 errorCode = U_ZERO_ERROR ;
16061606 length = -5 ;
1607- p = u_strToJavaModifiedUTF8 (dest , UPRV_LENGTHOF (expected )/2 , & length ,
1607+ p = u_strToJavaModifiedUTF8 (dest , ( UPRV_LENGTHOF (expected ) - 1 )/2 , & length ,
16081608 src , UPRV_LENGTHOF (src ), & errorCode );
16091609 if ( errorCode != U_BUFFER_OVERFLOW_ERROR ||
1610- length != UPRV_LENGTHOF (expected ) || dest [UPRV_LENGTHOF (expected )/2 ]!= (char )0xff
1610+ length != ( UPRV_LENGTHOF (expected )- 1 ) || dest [( UPRV_LENGTHOF (expected ) - 1 )/2 ]!= (char )0xff
16111611 ) {
16121612 log_err ("u_strToJavaModifiedUTF8(overflow) failed - %s\n" , u_errorName (errorCode ));
16131613 }
@@ -1617,7 +1617,7 @@ static void Test_strToJavaModifiedUTF8(void) {
16171617 p = u_strToJavaModifiedUTF8 (NULL , 0 , & length ,
16181618 src , UPRV_LENGTHOF (src ), & errorCode );
16191619 if ( errorCode != U_BUFFER_OVERFLOW_ERROR ||
1620- length != UPRV_LENGTHOF (expected ) || dest [0 ]!= (char )0xff
1620+ length != ( UPRV_LENGTHOF (expected ) - 1 ) || dest [0 ]!= (char )0xff
16211621 ) {
16221622 log_err ("u_strToJavaModifiedUTF8(pure preflighting) failed - %s\n" , u_errorName (errorCode ));
16231623 }
0 commit comments