freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master d0d57891: [ftbench, ftgrid, ftmulti, ftview] Ac


From: Werner Lemberg
Subject: [freetype2-demos] master d0d57891: [ftbench, ftgrid, ftmulti, ftview] Accept hexadecimal glyph indices.
Date: Sat, 21 Jan 2023 22:50:23 -0500 (EST)

branch: master
commit d0d578915b8153549176ea07d03fd910654c9b64
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [ftbench,ftgrid,ftmulti,ftview] Accept hexadecimal glyph indices.
    
    This helps to use charcodes on the command line.
    
    * src/ftbench.c (main): Use sscanf with "%i".
    * src/ftgrid.c (parse_cmdline): Ditto.
    * src/ftmulti.c (main): Ditto.
    * src/ftview.c (parse_cmdline): Ditto.
---
 src/ftbench.c | 2 +-
 src/ftgrid.c  | 3 +--
 src/ftmulti.c | 2 +-
 src/ftview.c  | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/ftbench.c b/src/ftbench.c
index 0a61d769..9f785cb6 100644
--- a/src/ftbench.c
+++ b/src/ftbench.c
@@ -1217,7 +1217,7 @@
         {
           int  fi, li;
 
-          if ( sscanf( optarg, "%d%*[,:-]%d", &fi, &li ) == 2 )
+          if ( sscanf( optarg, "%i%*[,:-]%i", &fi, &li ) == 2 )
           {
             first_index = fi < 0 ? 0 : fi;
             last_index  = li < 0 ? 0 : li;
diff --git a/src/ftgrid.c b/src/ftgrid.c
index 025cb3ca..885fdd8d 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -1752,8 +1752,7 @@
         break;
 
       case 'f':
-        status.Num = atoi( optarg );
-        have_index = 1;
+        have_index = sscanf( optarg, "%i", &status.Num );
         break;
 
       case 'k':
diff --git a/src/ftmulti.c b/src/ftmulti.c
index 624c6056..29b5b27b 100644
--- a/src/ftmulti.c
+++ b/src/ftmulti.c
@@ -1002,7 +1002,7 @@
         break;
 
       case 'f':
-        first_glyph = atoi( optarg );
+        sscanf( optarg, "%i", &first_glyph );
         break;
 
       case 'h':
diff --git a/src/ftview.c b/src/ftview.c
index bb7974b2..c478f5fe 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -1689,7 +1689,7 @@
         break;
 
       case 'f':
-        status.offset = atoi( optarg );
+        sscanf( optarg, "%i", &status.offset );
         break;
 
       case 'k':



reply via email to

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