Please find the patch attached.
Antony

On Thu, Apr 4, 2019 at 12:46 PM Werner LEMBERG <[email protected]> wrote:

>
> > Would it be possible to make the glyph_name argument to
> > FT_Get_Name_Index const?
>
> Yes, I think so.  AFAICS, this breaks neither the API nor the ABI.
>
> > It looks like a simple search-replace of "FT_String\* glyph_name" to
> > "const FT_String* glyph_name" is sufficient; I am happy to provide a
> > proper patch if this change is agreed.
>
> Please do, and thanks in advance!
>
>
>     Werner
>
From fd0ab977cdc4828d1b30337f149c4398365c71a7 Mon Sep 17 00:00:00 2001
From: Antony Lee <[email protected]>
Date: Thu, 4 Apr 2019 14:13:05 +0200
Subject: [PATCH] Make the glyph_name parameter to FT_Get_Name_Index const.

The prototype of FT_Get_Name_Index is tightened from

    FT_EXPORT( FT_UInt )
    FT_Get_Name_Index( FT_Face  face,
                       FT_String*  glyph_name );

to

    FT_EXPORT( FT_UInt )
    FT_Get_Name_Index( FT_Face  face,
                       const FT_String*  glyph_name );
---
 include/freetype/freetype.h                   | 2 +-
 include/freetype/internal/ftobjs.h            | 2 +-
 include/freetype/internal/services/svgldict.h | 2 +-
 src/base/ftobjs.c                             | 2 +-
 src/cff/cffdrivr.c                            | 2 +-
 src/sfnt/sfdriver.c                           | 2 +-
 src/type1/t1driver.c                          | 2 +-
 src/type42/t42drivr.c                         | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 4f2eaca69..77941a5f1 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3933,7 +3933,7 @@ FT_BEGIN_HEADER
    */
   FT_EXPORT( FT_UInt )
   FT_Get_Name_Index( FT_Face     face,
-                     FT_String*  glyph_name );
+                     const FT_String*  glyph_name );
 
 
   /**************************************************************************
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index f3a41b35a..126175e1a 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -942,7 +942,7 @@ FT_BEGIN_HEADER
 
   typedef FT_UInt
   (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,
-                                    FT_String*  glyph_name );
+                                    const FT_String*  glyph_name );
 
 
 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
diff --git a/include/freetype/internal/services/svgldict.h b/include/freetype/internal/services/svgldict.h
index ca8edf0eb..3944f7f90 100644
--- a/include/freetype/internal/services/svgldict.h
+++ b/include/freetype/internal/services/svgldict.h
@@ -42,7 +42,7 @@ FT_BEGIN_HEADER
 
   typedef FT_UInt
   (*FT_GlyphDict_NameIndexFunc)( FT_Face     face,
-                                 FT_String*  glyph_name );
+                                 const FT_String*  glyph_name );
 
 
   FT_DEFINE_SERVICE( GlyphDict )
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3f8619d3b..c7aa993ce 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4060,7 +4060,7 @@
 
   FT_EXPORT_DEF( FT_UInt )
   FT_Get_Name_Index( FT_Face     face,
-                     FT_String*  glyph_name )
+                     const FT_String*  glyph_name )
   {
     FT_UInt  result = 0;
 
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index bbd5c4032..33deefbdf 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -382,7 +382,7 @@
 
   static FT_UInt
   cff_get_name_index( CFF_Face    face,
-                      FT_String*  glyph_name )
+                      const FT_String*  glyph_name )
   {
     CFF_Font            cff;
     CFF_Charset         charset;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index c467ff4d3..c43c1157c 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -183,7 +183,7 @@
 
   static FT_UInt
   sfnt_get_name_index( FT_Face     face,
-                       FT_String*  glyph_name )
+                       const FT_String*  glyph_name )
   {
     TT_Face  ttface = (TT_Face)face;
 
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 8625db5b0..7107d0949 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -71,7 +71,7 @@
 
   static FT_UInt
   t1_get_name_index( T1_Face     face,
-                     FT_String*  glyph_name )
+                     const FT_String*  glyph_name )
   {
     FT_Int  i;
 
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index 6d4e7a095..c114d8521 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -70,7 +70,7 @@
 
   static FT_UInt
   t42_get_name_index( T42_Face    face,
-                      FT_String*  glyph_name )
+                      const FT_String*  glyph_name )
   {
     FT_Int  i;
 
-- 
2.20.1

_______________________________________________
Freetype mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to