freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] bug fix: pointers in FT_Open_Args should be const


From: Graham Asher
Subject: [ft-devel] bug fix: pointers in FT_Open_Args should be const
Date: Mon, 22 Jan 2007 09:15:35 -0000

Dear FreeTypers,

I'd like to suggest a small bug fix prompted by having to cast from "const
char*" to "FT_String*" when using FT_Open_Args.

The pointer members of this structure ought to be const, both to make it
easier to use with a filename in standard form - "const char*" - and to
document the fact that functions using this structure must not write through
the pointers.

The "pathname" member in particular is used in a call to FT_Stream_Open,
which takes "const char*". It might be an idea also to make this consistent:
either use "const char*" for both (which I favour: I don't really see that
FT_String* buys us anything) or "const FT_String*" for both.

Thus FT_Open_Args ought to change from

  typedef struct  FT_Open_Args_
  {
    FT_UInt         flags;
    const FT_Byte*  memory_base;
    FT_Long         memory_size;
    FT_String*      pathname;
    FT_Stream       stream;
    FT_Module       driver;
    FT_Int          num_params;
    FT_Parameter*   params;

  } FT_Open_Args;

to

  typedef struct  FT_Open_Args_
  {
    FT_UInt         flags;
    const FT_Byte*  memory_base;
    FT_Long         memory_size;
    const FT_String*      pathname;
    FT_Stream       stream;
    FT_Module       driver;
    FT_Int          num_params;
    const FT_Parameter*   params;

  } FT_Open_Args;

Best wishes and happy new year to everybody,

Graham Asher
now into my ninth year of using FreeType!






reply via email to

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