]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/ubiditransform.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / ubiditransform.cpp
index fd7b90fd37c7ce9f0f128b87f15bd09291d0bef1..5b0d5cf96a4e038f83cba650e9cb29406eaa44a1 100644 (file)
 #define SHAPE_LOGICAL           U_SHAPE_TEXT_DIRECTION_LOGICAL
 #define SHAPE_VISUAL            U_SHAPE_TEXT_DIRECTION_VISUAL_LTR
 
-#define CHECK_LEN(STR, LEN, ERROR) { \
-        if (LEN == 0) return 0; \
-        if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
-        if (LEN == -1) LEN = u_strlen(STR); \
-    } 
+#define CHECK_LEN(STR, LEN, ERROR) UPRV_BLOCK_MACRO_BEGIN { \
+    if (LEN == 0) return 0; \
+    if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
+    if (LEN == -1) LEN = u_strlen(STR); \
+} UPRV_BLOCK_MACRO_END
 
 #define MAX_ACTIONS     7
 
@@ -146,7 +146,7 @@ static UBool
 action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
 {
     ubidi_writeReordered(pTransform->pBidi, pTransform->dest, pTransform->destSize,
-            pTransform->reorderingOptions, pErrorCode);
+            static_cast<uint16_t>(pTransform->reorderingOptions), pErrorCode);
 
     *pTransform->pDestLength = pTransform->srcLength;
     pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
@@ -393,9 +393,9 @@ resolveBaseDirection(const UChar *text, uint32_t length,
     switch (*pInLevel) {
         case UBIDI_DEFAULT_LTR:
         case UBIDI_DEFAULT_RTL: {
-            UBiDiLevel level = ubidi_getBaseDirection(text, length);
-            *pInLevel = level != UBIDI_NEUTRAL ? level
-                    : *pInLevel == UBIDI_DEFAULT_RTL ? RTL : LTR;
+            UBiDiLevel level = static_cast<UBiDiLevel>(ubidi_getBaseDirection(text, length));
+            *pInLevel = static_cast<UBiDiLevel>(level != UBIDI_NEUTRAL) ? level
+                    : *pInLevel == UBIDI_DEFAULT_RTL ? static_cast<UBiDiLevel>(RTL) : static_cast<UBiDiLevel>(LTR);
             break;
         }
         default: