freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master f7e6d51 2/2: * src/autofit/afblue.hin (GET_UTF8_CHAR)


From: Werner LEMBERG
Subject: [freetype2] master f7e6d51 2/2: * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
Date: Sat, 05 Dec 2015 12:10:24 +0000

branch: master
commit f7e6d51a75fb07685f64d16985363a3b2d79b52f
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
    
    * src/autofit/afblue.h: Regenerated.
---
 ChangeLog              |    6 +++++
 src/autofit/afblue.h   |   55 +++++++++++++++++++++++++----------------------
 src/autofit/afblue.hin |   55 +++++++++++++++++++++++++----------------------
 3 files changed, 64 insertions(+), 52 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51d951a..7446c25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2015-12-05  Werner Lemberg  <address@hidden>
 
+       * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
+
+       * src/autofit/afblue.h: Regenerated.
+
+2015-12-05  Werner Lemberg  <address@hidden>
+
        * src/autofit/afwarp.c: s/INT_MIN/FT_INT_MIN/.
 
 2015-12-03  Werner Lemberg  <address@hidden>
diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h
index c26a9c7..a79098a 100644
--- a/src/autofit/afblue.h
+++ b/src/autofit/afblue.h
@@ -28,32 +28,35 @@ FT_BEGIN_HEADER
 
   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
   /* hard-coded, self-converted data, no error checking is performed     */
-#define GET_UTF8_CHAR( ch, p )                    \
-          ch = (unsigned char)*p++;               \
-          if ( ch >= 0x80 )                       \
-          {                                       \
-            FT_UInt  len;                         \
-                                                  \
-                                                  \
-            if ( ch < 0xE0 )                      \
-            {                                     \
-              len = 1;                            \
-              ch &= 0x1F;                         \
-            }                                     \
-            else if ( ch < 0xF0 )                 \
-            {                                     \
-              len = 2;                            \
-              ch &= 0x0F;                         \
-            }                                     \
-            else                                  \
-            {                                     \
-              len = 3;                            \
-              ch &= 0x07;                         \
-            }                                     \
-                                                  \
-            for ( ; len > 0; len-- )              \
-              ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
-          }
+#define GET_UTF8_CHAR( ch, p )                      \
+          do                                        \
+          {                                         \
+            ch = (unsigned char)*p++;               \
+            if ( ch >= 0x80 )                       \
+            {                                       \
+              FT_UInt  len_;                        \
+                                                    \
+                                                    \
+              if ( ch < 0xE0 )                      \
+              {                                     \
+                len_ = 1;                           \
+                ch  &= 0x1F;                        \
+              }                                     \
+              else if ( ch < 0xF0 )                 \
+              {                                     \
+                len_ = 2;                           \
+                ch  &= 0x0F;                        \
+              }                                     \
+              else                                  \
+              {                                     \
+                len_ = 3;                           \
+                ch  &= 0x07;                        \
+              }                                     \
+                                                    \
+              for ( ; len_ > 0; len_-- )            \
+                ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
+            }                                       \
+          } while ( 0 )
 
 
   /*************************************************************************/
diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin
index ad43fe6..3f85ee7 100644
--- a/src/autofit/afblue.hin
+++ b/src/autofit/afblue.hin
@@ -25,32 +25,35 @@ FT_BEGIN_HEADER
 
   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
   /* hard-coded, self-converted data, no error checking is performed     */
-#define GET_UTF8_CHAR( ch, p )                    \
-          ch = (unsigned char)*p++;               \
-          if ( ch >= 0x80 )                       \
-          {                                       \
-            FT_UInt  len;                         \
-                                                  \
-                                                  \
-            if ( ch < 0xE0 )                      \
-            {                                     \
-              len = 1;                            \
-              ch &= 0x1F;                         \
-            }                                     \
-            else if ( ch < 0xF0 )                 \
-            {                                     \
-              len = 2;                            \
-              ch &= 0x0F;                         \
-            }                                     \
-            else                                  \
-            {                                     \
-              len = 3;                            \
-              ch &= 0x07;                         \
-            }                                     \
-                                                  \
-            for ( ; len > 0; len-- )              \
-              ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
-          }
+#define GET_UTF8_CHAR( ch, p )                      \
+          do                                        \
+          {                                         \
+            ch = (unsigned char)*p++;               \
+            if ( ch >= 0x80 )                       \
+            {                                       \
+              FT_UInt  len_;                        \
+                                                    \
+                                                    \
+              if ( ch < 0xE0 )                      \
+              {                                     \
+                len_ = 1;                           \
+                ch  &= 0x1F;                        \
+              }                                     \
+              else if ( ch < 0xF0 )                 \
+              {                                     \
+                len_ = 2;                           \
+                ch  &= 0x0F;                        \
+              }                                     \
+              else                                  \
+              {                                     \
+                len_ = 3;                           \
+                ch  &= 0x07;                        \
+              }                                     \
+                                                    \
+              for ( ; len_ > 0; len_-- )            \
+                ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
+            }                                       \
+          } while ( 0 )
 
 
   /*************************************************************************/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]