freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Path delimiter characters


From: Masatake YAMATO
Subject: Re: [Devel] Path delimiter characters
Date: Mon, 09 Aug 2004 12:32:19 +0900 (JST)

Hi,

I read your suggestions; and wondered how to modify the code.
Could you answer my questions?

> Hello!
> 
> In src/base/ftrfork.c there exists this function

...

The question is how ftrfork.c is useful on OS other than Unix like OS.

raccess_make_file_name is used in some of guessing functions (see ftrfork.c).
Guessing functions are

    raccess_guess_apple_double
    raccess_guess_apple_single
    raccess_guess_darwin_ufs_export
    raccess_guess_darwin_hfsplus
    raccess_guess_vfat
    raccess_guess_linux_cap
    raccess_guess_linux_double
    raccess_guess_linux_netatalk

Some of them are useful for GNU/Linux and MacOSX but not for the other OS.
I guess functions useful for every OS are:

  raccess_guess_apple_double
  raccess_guess_apple_single
  raccess_guess_darwin_ufs_export(If the OS supports Windows' CIFS or Samba)
  raccess_guess_darwin_hfsplus(Only meaningful on systems with hfs+ drivers (or 
Macs))
  raccess_guess_vfat

In above functions, raccess_make_file_name access is used in:

   raccess_guess_darwin_ufs_export(If the OS supports Windows' CIFS or Samba)
   raccess_guess_darwin_hfsplus(Only meaningful on systems with hfs+ drivers 
(or Macs))
   raccess_guess_vfat

So I guess thses guessing functions are something to do with this separator 
issue.
Is this right on AmigsOS?
If only a few guessing functions are something to do with this separator issue, 
I think
the better modifications are

1. Adding 4th argument(separator) to `raccess_make_file_name'
2. Passing SECOND_PATH_DELIMITER to raccess_make_file_name from the guessing 
function

  static char*
  raccess_make_file_name( FT_Memory    memory,
                          const char  *original_name,
                          const char  *insertion,
                          char         separator )
  {
    char*        new_name;
    char*        tmp;
    const char*  sep_pos;
    unsigned     new_length;
    FT_ULong     error;

    /* Use '/' as the default separator. */
    if ( separator == '\0' )
      separator = '/';
    
    new_length = ft_strlen( original_name ) + ft_strlen( insertion );
    if ( FT_ALLOC( new_name, new_length + 1 ) )
      return NULL;

    tmp = ft_strrchr( original_name, separator );
    if ( tmp )
    {
      ft_strncpy( new_name, original_name, tmp - original_name + 1 );
      new_name[tmp - original_name + 1] = '\0';
      sep_pos = tmp + 1;
    }
    else
    {
      sep_pos       = original_name;
      new_name[0] = '\0';
    }

    ft_strcat( new_name, insertion );
    ft_strcat( new_name, sep_pos );

    return new_name;
  }


Masatake



reply via email to

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