freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master c336a85: * src/{ftdump.c, ftcommon.c} (PanicZ):


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master c336a85: * src/{ftdump.c, ftcommon.c} (PanicZ): Handle error messages.
Date: Wed, 6 Sep 2017 21:52:50 -0400 (EDT)

branch: master
commit c336a85b609fc3575af608e619cf2591b90ca4de
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    * src/{ftdump.c,ftcommon.c} (PanicZ): Handle error messages.
---
 ChangeLog      |  4 ++++
 src/ftcommon.c | 14 +++++++++++++-
 src/ftdump.c   | 14 +++++++++++++-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 327374c..ac5af6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-09-06  Alexei Podtelezhnikov  <address@hidden>
+
+       * src/{ftdump.c,ftcommon.c} (PanicZ): Handle error messages.
+
 2017-08-20  Alexei Podtelezhnikov  <address@hidden>
 
        * src/ftdump.c (Print_Charmaps): Decorate with glyph names.
diff --git a/src/ftcommon.c b/src/ftcommon.c
index 1f0e9d3..cf54eaf 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -24,6 +24,12 @@
 #include FT_BITMAP_H
 #include FT_FONT_FORMATS_H
 
+  /* error messages */
+#undef FTERRORS_H_
+#define FT_ERROR_START_LIST     {
+#define FT_ERRORDEF( e, v, s )  case v: str = s; break;
+#define FT_ERROR_END_LIST       default: str = "unknown error"; }
+
 #include "common.h"
 #include "ftcommon.h"
 
@@ -64,7 +70,13 @@
   void
   PanicZ( const char*  message )
   {
-    fprintf( stderr, "%s\n  error = 0x%04x\n", message, error );
+    FT_String  *str;
+
+
+    switch( error )
+    #include FT_ERRORS_H
+
+    fprintf( stderr, "%s\n  error = 0x%04x, %s\n", message, error, str );
     exit( 1 );
   }
 
diff --git a/src/ftdump.c b/src/ftdump.c
index f130ee4..5fa855e 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -24,6 +24,12 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DRIVER_H
 
+  /* error messages */
+#undef FTERRORS_H_
+#define FT_ERROR_START_LIST     {
+#define FT_ERRORDEF( e, v, s )  case v: str = s; break;
+#define FT_ERROR_END_LIST       default: str = "unknown error"; }
+
 #include "common.h"
 #include "output.h"
 #include "mlgetopt.h"
@@ -48,9 +54,15 @@
   PanicZ( FT_Library   library,
           const char*  message )
   {
+    FT_String  *str;
+
+
     FT_Done_FreeType( library );
 
-    fprintf( stderr, "%s\n  error = 0x%04x\n", message, error );
+    switch( error )
+    #include FT_ERRORS_H
+
+    fprintf( stderr, "%s\n  error = 0x%04x, %s\n", message, error, str );
     exit( 1 );
   }
 



reply via email to

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