| OLD | NEW | 
|    1 /***************************************************************************/ |    1 /***************************************************************************/ | 
|    2 /*                                                                         */ |    2 /*                                                                         */ | 
|    3 /*  ftrfork.c                                                              */ |    3 /*  ftrfork.c                                                              */ | 
|    4 /*                                                                         */ |    4 /*                                                                         */ | 
|    5 /*    Embedded resource forks accessor (body).                             */ |    5 /*    Embedded resource forks accessor (body).                             */ | 
|    6 /*                                                                         */ |    6 /*                                                                         */ | 
|    7 /*  Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by                  */ |    7 /*  Copyright 2004-2010, 2013 by                                           */ | 
|    8 /*  Masatake YAMATO and Redhat K.K.                                        */ |    8 /*  Masatake YAMATO and Redhat K.K.                                        */ | 
|    9 /*                                                                         */ |    9 /*                                                                         */ | 
|   10 /*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */ |   10 /*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */ | 
|   11 /*  derived from ftobjs.c.                                                 */ |   11 /*  derived from ftobjs.c.                                                 */ | 
|   12 /*                                                                         */ |   12 /*                                                                         */ | 
|   13 /*  This file is part of the FreeType project, and may only be used,       */ |   13 /*  This file is part of the FreeType project, and may only be used,       */ | 
|   14 /*  modified, and distributed under the terms of the FreeType project      */ |   14 /*  modified, and distributed under the terms of the FreeType project      */ | 
|   15 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */ |   15 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */ | 
|   16 /*  this file you indicate that you have read the license and              */ |   16 /*  this file you indicate that you have read the license and              */ | 
|   17 /*  understand and accept it fully.                                        */ |   17 /*  understand and accept it fully.                                        */ | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   79                                   ( head[6] <<  8 ) | |   79                                   ( head[6] <<  8 ) | | 
|   80                                     head[7]         ); |   80                                     head[7]         ); | 
|   81     rdata_len = ( head[ 8] << 24 ) | |   81     rdata_len = ( head[ 8] << 24 ) | | 
|   82                 ( head[ 9] << 16 ) | |   82                 ( head[ 9] << 16 ) | | 
|   83                 ( head[10] <<  8 ) | |   83                 ( head[10] <<  8 ) | | 
|   84                   head[11]; |   84                   head[11]; | 
|   85  |   85  | 
|   86     /* map_len = head[12] .. head[15] */ |   86     /* map_len = head[12] .. head[15] */ | 
|   87  |   87  | 
|   88     if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset ) |   88     if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset ) | 
|   89       return FT_Err_Unknown_File_Format; |   89       return FT_THROW( Unknown_File_Format ); | 
|   90  |   90  | 
|   91     error = FT_Stream_Seek( stream, map_pos ); |   91     error = FT_Stream_Seek( stream, map_pos ); | 
|   92     if ( error ) |   92     if ( error ) | 
|   93       return error; |   93       return error; | 
|   94  |   94  | 
|   95     head2[15] = (FT_Byte)( head[15] + 1 );       /* make it be different */ |   95     head2[15] = (FT_Byte)( head[15] + 1 );       /* make it be different */ | 
|   96  |   96  | 
|   97     error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 ); |   97     error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 ); | 
|   98     if ( error ) |   98     if ( error ) | 
|   99       return error; |   99       return error; | 
|  100  |  100  | 
|  101     allzeros = 1; |  101     allzeros = 1; | 
|  102     allmatch = 1; |  102     allmatch = 1; | 
|  103     for ( i = 0; i < 16; ++i ) |  103     for ( i = 0; i < 16; ++i ) | 
|  104     { |  104     { | 
|  105       if ( head2[i] != 0 ) |  105       if ( head2[i] != 0 ) | 
|  106         allzeros = 0; |  106         allzeros = 0; | 
|  107       if ( head2[i] != head[i] ) |  107       if ( head2[i] != head[i] ) | 
|  108         allmatch = 0; |  108         allmatch = 0; | 
|  109     } |  109     } | 
|  110     if ( !allzeros && !allmatch ) |  110     if ( !allzeros && !allmatch ) | 
|  111       return FT_Err_Unknown_File_Format; |  111       return FT_THROW( Unknown_File_Format ); | 
|  112  |  112  | 
|  113     /* If we have reached this point then it is probably a mac resource */ |  113     /* If we have reached this point then it is probably a mac resource */ | 
|  114     /* file.  Now, does it contain any interesting resources?           */ |  114     /* file.  Now, does it contain any interesting resources?           */ | 
|  115     /* Skip handle to next resource map, the file resource number, and  */ |  115     /* Skip handle to next resource map, the file resource number, and  */ | 
|  116     /* attributes.                                                      */ |  116     /* attributes.                                                      */ | 
|  117     (void)FT_STREAM_SKIP( 4        /* skip handle to next resource map */ |  117     (void)FT_STREAM_SKIP( 4        /* skip handle to next resource map */ | 
|  118                           + 2      /* skip file resource number */ |  118                           + 2      /* skip file resource number */ | 
|  119                           + 2 );   /* skip attributes */ |  119                           + 2 );   /* skip attributes */ | 
|  120  |  120  | 
|  121     if ( FT_READ_USHORT( type_list ) ) |  121     if ( FT_READ_USHORT( type_list ) ) | 
|  122       return error; |  122       return error; | 
|  123     if ( type_list == -1 ) |  123     if ( type_list == -1 ) | 
|  124       return FT_Err_Unknown_File_Format; |  124       return FT_THROW( Unknown_File_Format ); | 
|  125  |  125  | 
|  126     error = FT_Stream_Seek( stream, map_pos + type_list ); |  126     error = FT_Stream_Seek( stream, map_pos + type_list ); | 
|  127     if ( error ) |  127     if ( error ) | 
|  128       return error; |  128       return error; | 
|  129  |  129  | 
|  130     *map_offset = map_pos + type_list; |  130     *map_offset = map_pos + type_list; | 
|  131     return FT_Err_Ok; |  131     return FT_Err_Ok; | 
|  132   } |  132   } | 
|  133  |  133  | 
|  134  |  134  | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  226  |  226  | 
|  227         *offsets = offsets_internal; |  227         *offsets = offsets_internal; | 
|  228         error    = FT_Err_Ok; |  228         error    = FT_Err_Ok; | 
|  229  |  229  | 
|  230       Exit: |  230       Exit: | 
|  231         FT_FREE( ref ); |  231         FT_FREE( ref ); | 
|  232         return error; |  232         return error; | 
|  233       } |  233       } | 
|  234     } |  234     } | 
|  235  |  235  | 
|  236     return FT_Err_Cannot_Open_Resource; |  236     return FT_THROW( Cannot_Open_Resource ); | 
|  237   } |  237   } | 
|  238  |  238  | 
|  239  |  239  | 
|  240 #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK |  240 #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK | 
|  241  |  241  | 
|  242   /*************************************************************************/ |  242   /*************************************************************************/ | 
|  243   /*************************************************************************/ |  243   /*************************************************************************/ | 
|  244   /*************************************************************************/ |  244   /*************************************************************************/ | 
|  245   /****                                                                 ****/ |  245   /****                                                                 ****/ | 
|  246   /****                                                                 ****/ |  246   /****                                                                 ****/ | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  355                           const char  *insertion ); |  355                           const char  *insertion ); | 
|  356  |  356  | 
|  357   FT_BASE_DEF( void ) |  357   FT_BASE_DEF( void ) | 
|  358   FT_Raccess_Guess( FT_Library  library, |  358   FT_Raccess_Guess( FT_Library  library, | 
|  359                     FT_Stream   stream, |  359                     FT_Stream   stream, | 
|  360                     char*       base_name, |  360                     char*       base_name, | 
|  361                     char      **new_names, |  361                     char      **new_names, | 
|  362                     FT_Long    *offsets, |  362                     FT_Long    *offsets, | 
|  363                     FT_Error   *errors ) |  363                     FT_Error   *errors ) | 
|  364   { |  364   { | 
|  365     FT_Long  i; |  365     FT_Int  i; | 
|  366  |  366  | 
|  367  |  367  | 
|  368     for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) |  368     for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) | 
|  369     { |  369     { | 
|  370       new_names[i] = NULL; |  370       new_names[i] = NULL; | 
|  371       if ( NULL != stream ) |  371       if ( NULL != stream ) | 
|  372         errors[i] = FT_Stream_Seek( stream, 0 ); |  372         errors[i] = FT_Stream_Seek( stream, 0 ); | 
|  373       else |  373       else | 
|  374         errors[i] = FT_Err_Ok; |  374         errors[i] = FT_Err_Ok; | 
|  375  |  375  | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  428                               FT_Long    *result_offset ) |  428                               FT_Long    *result_offset ) | 
|  429   { |  429   { | 
|  430     FT_Int32  magic = ( 0x00 << 24 ) | |  430     FT_Int32  magic = ( 0x00 << 24 ) | | 
|  431                       ( 0x05 << 16 ) | |  431                       ( 0x05 << 16 ) | | 
|  432                       ( 0x16 <<  8 ) | |  432                       ( 0x16 <<  8 ) | | 
|  433                         0x07; |  433                         0x07; | 
|  434  |  434  | 
|  435  |  435  | 
|  436     *result_file_name = NULL; |  436     *result_file_name = NULL; | 
|  437     if ( NULL == stream ) |  437     if ( NULL == stream ) | 
|  438       return FT_Err_Cannot_Open_Stream; |  438       return FT_THROW( Cannot_Open_Stream ); | 
|  439  |  439  | 
|  440     return raccess_guess_apple_generic( library, stream, base_file_name, |  440     return raccess_guess_apple_generic( library, stream, base_file_name, | 
|  441                                         magic, result_offset ); |  441                                         magic, result_offset ); | 
|  442   } |  442   } | 
|  443  |  443  | 
|  444  |  444  | 
|  445   static FT_Error |  445   static FT_Error | 
|  446   raccess_guess_apple_single( FT_Library  library, |  446   raccess_guess_apple_single( FT_Library  library, | 
|  447                               FT_Stream   stream, |  447                               FT_Stream   stream, | 
|  448                               char       *base_file_name, |  448                               char       *base_file_name, | 
|  449                               char      **result_file_name, |  449                               char      **result_file_name, | 
|  450                               FT_Long    *result_offset ) |  450                               FT_Long    *result_offset ) | 
|  451   { |  451   { | 
|  452     FT_Int32  magic = ( 0x00 << 24 ) | |  452     FT_Int32  magic = ( 0x00 << 24 ) | | 
|  453                       ( 0x05 << 16 ) | |  453                       ( 0x05 << 16 ) | | 
|  454                       ( 0x16 <<  8 ) | |  454                       ( 0x16 <<  8 ) | | 
|  455                         0x00; |  455                         0x00; | 
|  456  |  456  | 
|  457  |  457  | 
|  458     *result_file_name = NULL; |  458     *result_file_name = NULL; | 
|  459     if ( NULL == stream ) |  459     if ( NULL == stream ) | 
|  460       return FT_Err_Cannot_Open_Stream; |  460       return FT_THROW( Cannot_Open_Stream ); | 
|  461  |  461  | 
|  462     return raccess_guess_apple_generic( library, stream, base_file_name, |  462     return raccess_guess_apple_generic( library, stream, base_file_name, | 
|  463                                         magic, result_offset ); |  463                                         magic, result_offset ); | 
|  464   } |  464   } | 
|  465  |  465  | 
|  466  |  466  | 
|  467   static FT_Error |  467   static FT_Error | 
|  468   raccess_guess_darwin_ufs_export( FT_Library  library, |  468   raccess_guess_darwin_ufs_export( FT_Library  library, | 
|  469                                    FT_Stream   stream, |  469                                    FT_Stream   stream, | 
|  470                                    char       *base_file_name, |  470                                    char       *base_file_name, | 
|  471                                    char      **result_file_name, |  471                                    char      **result_file_name, | 
|  472                                    FT_Long    *result_offset ) |  472                                    FT_Long    *result_offset ) | 
|  473   { |  473   { | 
|  474     char*      newpath; |  474     char*      newpath; | 
|  475     FT_Error   error; |  475     FT_Error   error; | 
|  476     FT_Memory  memory; |  476     FT_Memory  memory; | 
|  477  |  477  | 
|  478     FT_UNUSED( stream ); |  478     FT_UNUSED( stream ); | 
|  479  |  479  | 
|  480  |  480  | 
|  481     memory  = library->memory; |  481     memory  = library->memory; | 
|  482     newpath = raccess_make_file_name( memory, base_file_name, "._" ); |  482     newpath = raccess_make_file_name( memory, base_file_name, "._" ); | 
|  483     if ( !newpath ) |  483     if ( !newpath ) | 
|  484       return FT_Err_Out_Of_Memory; |  484       return FT_THROW( Out_Of_Memory ); | 
|  485  |  485  | 
|  486     error = raccess_guess_linux_double_from_file_name( library, newpath, |  486     error = raccess_guess_linux_double_from_file_name( library, newpath, | 
|  487                                                        result_offset ); |  487                                                        result_offset ); | 
|  488     if ( !error ) |  488     if ( !error ) | 
|  489       *result_file_name = newpath; |  489       *result_file_name = newpath; | 
|  490     else |  490     else | 
|  491       FT_FREE( newpath ); |  491       FT_FREE( newpath ); | 
|  492  |  492  | 
|  493     return error; |  493     return error; | 
|  494   } |  494   } | 
|  495  |  495  | 
|  496  |  496  | 
|  497   static FT_Error |  497   static FT_Error | 
|  498   raccess_guess_darwin_hfsplus( FT_Library  library, |  498   raccess_guess_darwin_hfsplus( FT_Library  library, | 
|  499                                 FT_Stream   stream, |  499                                 FT_Stream   stream, | 
|  500                                 char       *base_file_name, |  500                                 char       *base_file_name, | 
|  501                                 char      **result_file_name, |  501                                 char      **result_file_name, | 
|  502                                 FT_Long    *result_offset ) |  502                                 FT_Long    *result_offset ) | 
|  503   { |  503   { | 
|  504     /* |  504     /* | 
|  505       Only meaningful on systems with hfs+ drivers (or Macs). |  505       Only meaningful on systems with hfs+ drivers (or Macs). | 
|  506      */ |  506      */ | 
|  507     FT_Error   error; |  507     FT_Error   error; | 
|  508     char*      newpath = NULL; |  508     char*      newpath = NULL; | 
|  509     FT_Memory  memory; |  509     FT_Memory  memory; | 
|  510     FT_Long    base_file_len = ft_strlen( base_file_name ); |  510     FT_Long    base_file_len = (FT_Long)ft_strlen( base_file_name ); | 
|  511  |  511  | 
|  512     FT_UNUSED( stream ); |  512     FT_UNUSED( stream ); | 
|  513  |  513  | 
|  514  |  514  | 
|  515     memory = library->memory; |  515     memory = library->memory; | 
|  516  |  516  | 
|  517     if ( base_file_len + 6 > FT_INT_MAX ) |  517     if ( base_file_len + 6 > FT_INT_MAX ) | 
|  518       return FT_Err_Array_Too_Large; |  518       return FT_THROW( Array_Too_Large ); | 
|  519  |  519  | 
|  520     if ( FT_ALLOC( newpath, base_file_len + 6 ) ) |  520     if ( FT_ALLOC( newpath, base_file_len + 6 ) ) | 
|  521       return error; |  521       return error; | 
|  522  |  522  | 
|  523     FT_MEM_COPY( newpath, base_file_name, base_file_len ); |  523     FT_MEM_COPY( newpath, base_file_name, base_file_len ); | 
|  524     FT_MEM_COPY( newpath + base_file_len, "/rsrc", 6 ); |  524     FT_MEM_COPY( newpath + base_file_len, "/rsrc", 6 ); | 
|  525  |  525  | 
|  526     *result_file_name = newpath; |  526     *result_file_name = newpath; | 
|  527     *result_offset    = 0; |  527     *result_offset    = 0; | 
|  528  |  528  | 
|  529     return FT_Err_Ok; |  529     return FT_Err_Ok; | 
|  530   } |  530   } | 
|  531  |  531  | 
|  532  |  532  | 
|  533   static FT_Error |  533   static FT_Error | 
|  534   raccess_guess_darwin_newvfs( FT_Library  library, |  534   raccess_guess_darwin_newvfs( FT_Library  library, | 
|  535                                FT_Stream   stream, |  535                                FT_Stream   stream, | 
|  536                                char       *base_file_name, |  536                                char       *base_file_name, | 
|  537                                char      **result_file_name, |  537                                char      **result_file_name, | 
|  538                                FT_Long    *result_offset ) |  538                                FT_Long    *result_offset ) | 
|  539   { |  539   { | 
|  540     /* |  540     /* | 
|  541       Only meaningful on systems with Mac OS X (> 10.1). |  541       Only meaningful on systems with Mac OS X (> 10.1). | 
|  542      */ |  542      */ | 
|  543     FT_Error   error; |  543     FT_Error   error; | 
|  544     char*      newpath = NULL; |  544     char*      newpath = NULL; | 
|  545     FT_Memory  memory; |  545     FT_Memory  memory; | 
|  546     FT_Long    base_file_len = ft_strlen( base_file_name ); |  546     FT_Long    base_file_len = (FT_Long)ft_strlen( base_file_name ); | 
|  547  |  547  | 
|  548     FT_UNUSED( stream ); |  548     FT_UNUSED( stream ); | 
|  549  |  549  | 
|  550  |  550  | 
|  551     memory = library->memory; |  551     memory = library->memory; | 
|  552  |  552  | 
|  553     if ( base_file_len + 18 > FT_INT_MAX ) |  553     if ( base_file_len + 18 > FT_INT_MAX ) | 
|  554       return FT_Err_Array_Too_Large; |  554       return FT_THROW( Array_Too_Large ); | 
|  555  |  555  | 
|  556     if ( FT_ALLOC( newpath, base_file_len + 18 ) ) |  556     if ( FT_ALLOC( newpath, base_file_len + 18 ) ) | 
|  557       return error; |  557       return error; | 
|  558  |  558  | 
|  559     FT_MEM_COPY( newpath, base_file_name, base_file_len ); |  559     FT_MEM_COPY( newpath, base_file_name, base_file_len ); | 
|  560     FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 ); |  560     FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 ); | 
|  561  |  561  | 
|  562     *result_file_name = newpath; |  562     *result_file_name = newpath; | 
|  563     *result_offset    = 0; |  563     *result_offset    = 0; | 
|  564  |  564  | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|  577     FT_Memory  memory; |  577     FT_Memory  memory; | 
|  578  |  578  | 
|  579     FT_UNUSED( stream ); |  579     FT_UNUSED( stream ); | 
|  580  |  580  | 
|  581  |  581  | 
|  582     memory = library->memory; |  582     memory = library->memory; | 
|  583  |  583  | 
|  584     newpath = raccess_make_file_name( memory, base_file_name, |  584     newpath = raccess_make_file_name( memory, base_file_name, | 
|  585                                       "resource.frk/" ); |  585                                       "resource.frk/" ); | 
|  586     if ( !newpath ) |  586     if ( !newpath ) | 
|  587       return FT_Err_Out_Of_Memory; |  587       return FT_THROW( Out_Of_Memory ); | 
|  588  |  588  | 
|  589     *result_file_name = newpath; |  589     *result_file_name = newpath; | 
|  590     *result_offset    = 0; |  590     *result_offset    = 0; | 
|  591  |  591  | 
|  592     return FT_Err_Ok; |  592     return FT_Err_Ok; | 
|  593   } |  593   } | 
|  594  |  594  | 
|  595  |  595  | 
|  596   static FT_Error |  596   static FT_Error | 
|  597   raccess_guess_linux_cap( FT_Library  library, |  597   raccess_guess_linux_cap( FT_Library  library, | 
|  598                            FT_Stream   stream, |  598                            FT_Stream   stream, | 
|  599                            char       *base_file_name, |  599                            char       *base_file_name, | 
|  600                            char      **result_file_name, |  600                            char      **result_file_name, | 
|  601                            FT_Long    *result_offset ) |  601                            FT_Long    *result_offset ) | 
|  602   { |  602   { | 
|  603     char*      newpath; |  603     char*      newpath; | 
|  604     FT_Memory  memory; |  604     FT_Memory  memory; | 
|  605  |  605  | 
|  606     FT_UNUSED( stream ); |  606     FT_UNUSED( stream ); | 
|  607  |  607  | 
|  608  |  608  | 
|  609     memory = library->memory; |  609     memory = library->memory; | 
|  610  |  610  | 
|  611     newpath = raccess_make_file_name( memory, base_file_name, ".resource/" ); |  611     newpath = raccess_make_file_name( memory, base_file_name, ".resource/" ); | 
|  612     if ( !newpath ) |  612     if ( !newpath ) | 
|  613       return FT_Err_Out_Of_Memory; |  613       return FT_THROW( Out_Of_Memory ); | 
|  614  |  614  | 
|  615     *result_file_name = newpath; |  615     *result_file_name = newpath; | 
|  616     *result_offset    = 0; |  616     *result_offset    = 0; | 
|  617  |  617  | 
|  618     return FT_Err_Ok; |  618     return FT_Err_Ok; | 
|  619   } |  619   } | 
|  620  |  620  | 
|  621  |  621  | 
|  622   static FT_Error |  622   static FT_Error | 
|  623   raccess_guess_linux_double( FT_Library  library, |  623   raccess_guess_linux_double( FT_Library  library, | 
|  624                               FT_Stream   stream, |  624                               FT_Stream   stream, | 
|  625                               char       *base_file_name, |  625                               char       *base_file_name, | 
|  626                               char      **result_file_name, |  626                               char      **result_file_name, | 
|  627                               FT_Long    *result_offset ) |  627                               FT_Long    *result_offset ) | 
|  628   { |  628   { | 
|  629     char*      newpath; |  629     char*      newpath; | 
|  630     FT_Error   error; |  630     FT_Error   error; | 
|  631     FT_Memory  memory; |  631     FT_Memory  memory; | 
|  632  |  632  | 
|  633     FT_UNUSED( stream ); |  633     FT_UNUSED( stream ); | 
|  634  |  634  | 
|  635  |  635  | 
|  636     memory = library->memory; |  636     memory = library->memory; | 
|  637  |  637  | 
|  638     newpath = raccess_make_file_name( memory, base_file_name, "%" ); |  638     newpath = raccess_make_file_name( memory, base_file_name, "%" ); | 
|  639     if ( !newpath ) |  639     if ( !newpath ) | 
|  640       return FT_Err_Out_Of_Memory; |  640       return FT_THROW( Out_Of_Memory ); | 
|  641  |  641  | 
|  642     error = raccess_guess_linux_double_from_file_name( library, newpath, |  642     error = raccess_guess_linux_double_from_file_name( library, newpath, | 
|  643                                                        result_offset ); |  643                                                        result_offset ); | 
|  644     if ( !error ) |  644     if ( !error ) | 
|  645       *result_file_name = newpath; |  645       *result_file_name = newpath; | 
|  646     else |  646     else | 
|  647       FT_FREE( newpath ); |  647       FT_FREE( newpath ); | 
|  648  |  648  | 
|  649     return error; |  649     return error; | 
|  650   } |  650   } | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  662     FT_Memory  memory; |  662     FT_Memory  memory; | 
|  663  |  663  | 
|  664     FT_UNUSED( stream ); |  664     FT_UNUSED( stream ); | 
|  665  |  665  | 
|  666  |  666  | 
|  667     memory = library->memory; |  667     memory = library->memory; | 
|  668  |  668  | 
|  669     newpath = raccess_make_file_name( memory, base_file_name, |  669     newpath = raccess_make_file_name( memory, base_file_name, | 
|  670                                       ".AppleDouble/" ); |  670                                       ".AppleDouble/" ); | 
|  671     if ( !newpath ) |  671     if ( !newpath ) | 
|  672       return FT_Err_Out_Of_Memory; |  672       return FT_THROW( Out_Of_Memory ); | 
|  673  |  673  | 
|  674     error = raccess_guess_linux_double_from_file_name( library, newpath, |  674     error = raccess_guess_linux_double_from_file_name( library, newpath, | 
|  675                                                        result_offset ); |  675                                                        result_offset ); | 
|  676     if ( !error ) |  676     if ( !error ) | 
|  677       *result_file_name = newpath; |  677       *result_file_name = newpath; | 
|  678     else |  678     else | 
|  679       FT_FREE( newpath ); |  679       FT_FREE( newpath ); | 
|  680  |  680  | 
|  681     return error; |  681     return error; | 
|  682   } |  682   } | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  701  |  701  | 
|  702     FT_UNUSED( library ); |  702     FT_UNUSED( library ); | 
|  703     FT_UNUSED( base_file_name ); |  703     FT_UNUSED( base_file_name ); | 
|  704     FT_UNUSED( version_number ); |  704     FT_UNUSED( version_number ); | 
|  705     FT_UNUSED( entry_length   ); |  705     FT_UNUSED( entry_length   ); | 
|  706  |  706  | 
|  707  |  707  | 
|  708     if ( FT_READ_LONG( magic_from_stream ) ) |  708     if ( FT_READ_LONG( magic_from_stream ) ) | 
|  709       return error; |  709       return error; | 
|  710     if ( magic_from_stream != magic ) |  710     if ( magic_from_stream != magic ) | 
|  711       return FT_Err_Unknown_File_Format; |  711       return FT_THROW( Unknown_File_Format ); | 
|  712  |  712  | 
|  713     if ( FT_READ_LONG( version_number ) ) |  713     if ( FT_READ_LONG( version_number ) ) | 
|  714       return error; |  714       return error; | 
|  715  |  715  | 
|  716     /* filler */ |  716     /* filler */ | 
|  717     error = FT_Stream_Skip( stream, 16 ); |  717     error = FT_Stream_Skip( stream, 16 ); | 
|  718     if ( error ) |  718     if ( error ) | 
|  719       return error; |  719       return error; | 
|  720  |  720  | 
|  721     if ( FT_READ_USHORT( n_of_entries ) ) |  721     if ( FT_READ_USHORT( n_of_entries ) ) | 
|  722       return error; |  722       return error; | 
|  723     if ( n_of_entries == 0 ) |  723     if ( n_of_entries == 0 ) | 
|  724       return FT_Err_Unknown_File_Format; |  724       return FT_THROW( Unknown_File_Format ); | 
|  725  |  725  | 
|  726     for ( i = 0; i < n_of_entries; i++ ) |  726     for ( i = 0; i < n_of_entries; i++ ) | 
|  727     { |  727     { | 
|  728       if ( FT_READ_LONG( entry_id ) ) |  728       if ( FT_READ_LONG( entry_id ) ) | 
|  729         return error; |  729         return error; | 
|  730       if ( entry_id == resource_fork_entry_id ) |  730       if ( entry_id == resource_fork_entry_id ) | 
|  731       { |  731       { | 
|  732         if ( FT_READ_LONG( entry_offset ) || |  732         if ( FT_READ_LONG( entry_offset ) || | 
|  733              FT_READ_LONG( entry_length ) ) |  733              FT_READ_LONG( entry_length ) ) | 
|  734           continue; |  734           continue; | 
|  735         *result_offset = entry_offset; |  735         *result_offset = entry_offset; | 
|  736  |  736  | 
|  737         return FT_Err_Ok; |  737         return FT_Err_Ok; | 
|  738       } |  738       } | 
|  739       else |  739       else | 
|  740       { |  740       { | 
|  741         error = FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */ |  741         error = FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */ | 
|  742         if ( error ) |  742         if ( error ) | 
|  743           return error; |  743           return error; | 
|  744       } |  744       } | 
|  745     } |  745     } | 
|  746  |  746  | 
|  747     return FT_Err_Unknown_File_Format; |  747     return FT_THROW( Unknown_File_Format ); | 
|  748   } |  748   } | 
|  749  |  749  | 
|  750  |  750  | 
|  751   static FT_Error |  751   static FT_Error | 
|  752   raccess_guess_linux_double_from_file_name( FT_Library  library, |  752   raccess_guess_linux_double_from_file_name( FT_Library  library, | 
|  753                                              char       *file_name, |  753                                              char       *file_name, | 
|  754                                              FT_Long    *result_offset ) |  754                                              FT_Long    *result_offset ) | 
|  755   { |  755   { | 
|  756     FT_Open_Args  args2; |  756     FT_Open_Args  args2; | 
|  757     FT_Stream     stream2; |  757     FT_Stream     stream2; | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  820   /*************************************************************************/ |  820   /*************************************************************************/ | 
|  821  |  821  | 
|  822   FT_BASE_DEF( void ) |  822   FT_BASE_DEF( void ) | 
|  823   FT_Raccess_Guess( FT_Library  library, |  823   FT_Raccess_Guess( FT_Library  library, | 
|  824                     FT_Stream   stream, |  824                     FT_Stream   stream, | 
|  825                     char       *base_name, |  825                     char       *base_name, | 
|  826                     char      **new_names, |  826                     char      **new_names, | 
|  827                     FT_Long    *offsets, |  827                     FT_Long    *offsets, | 
|  828                     FT_Error   *errors ) |  828                     FT_Error   *errors ) | 
|  829   { |  829   { | 
|  830     int  i; |  830     FT_Int  i; | 
|  831  |  831  | 
|  832     FT_UNUSED( library ); |  832     FT_UNUSED( library ); | 
|  833     FT_UNUSED( stream ); |  833     FT_UNUSED( stream ); | 
|  834     FT_UNUSED( base_name ); |  834     FT_UNUSED( base_name ); | 
|  835  |  835  | 
|  836  |  836  | 
|  837     for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) |  837     for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) | 
|  838     { |  838     { | 
|  839       new_names[i] = NULL; |  839       new_names[i] = NULL; | 
|  840       offsets[i]   = 0; |  840       offsets[i]   = 0; | 
|  841       errors[i]    = FT_Err_Unimplemented_Feature; |  841       errors[i]    = FT_ERR( Unimplemented_Feature ); | 
|  842     } |  842     } | 
|  843   } |  843   } | 
|  844  |  844  | 
|  845  |  845  | 
|  846 #endif  /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ |  846 #endif  /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ | 
|  847  |  847  | 
|  848  |  848  | 
|  849 /* END */ |  849 /* END */ | 
| OLD | NEW |