freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 2 commits: [build/windows] Improve UWP


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: [build/windows] Improve UWP support.
Date: Thu, 24 Mar 2022 02:56:16 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • builds/windows/ftsystem.c
    ... ... @@ -196,25 +196,65 @@
    196 196
       }
    
    197 197
     
    
    198 198
     
    
    199
    -#if defined( NTDDI_VERSION ) && NTDDI_VERSION < 0x0A000007 && \
    
    200
    -    defined( WINAPI_FAMILY_PARTITION )                 &&     \
    
    199
    +  /* non-desktop Universal Windows Platform */
    
    200
    +#if defined( WINAPI_FAMILY_PARTITION )                 &&     \
    
    201 201
         !WINAPI_FAMILY_PARTITION( WINAPI_PARTITION_DESKTOP )
    
    202 202
     
    
    203 203
     #define PACK_DWORD64( hi, lo )  ( ( (DWORD64)(hi) << 32 ) | (DWORD)(lo) )
    
    204 204
     
    
    205
    -#define CreateFileW( a, b, c, d, e, f, g ) \
    
    206
    -        CreateFileFromAppW( a, b, c, d, e, f, g )
    
    207 205
     #define CreateFileMapping( a, b, c, d, e, f ) \
    
    208 206
             CreateFileMappingFromApp( a, b, c, PACK_DWORD64( d, e ), f )
    
    209 207
     #define MapViewOfFile( a, b, c, d, e ) \
    
    210 208
             MapViewOfFileFromApp( a, b, PACK_DWORD64( c, d ), e )
    
    211 209
     
    
    212
    -#define UWP_LEGACY
    
    210
    +  FT_LOCAL_DEF( HANDLE )
    
    211
    +  CreateFileA( LPCSTR                lpFileName,
    
    212
    +               DWORD                 dwDesiredAccess,
    
    213
    +               DWORD                 dwShareMode,
    
    214
    +               LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    
    215
    +               DWORD                 dwCreationDisposition,
    
    216
    +               DWORD                 dwFlagsAndAttributes,
    
    217
    +               HANDLE                hTemplateFile )
    
    218
    +  {
    
    219
    +    int            len;
    
    220
    +    LPWSTR         lpFileNameW;
    
    221
    +
    
    222
    +    CREATEFILE2_EXTENDED_PARAMETERS  createExParams = {
    
    223
    +                               sizeof ( CREATEFILE2_EXTENDED_PARAMETERS ),
    
    224
    +                               dwFlagsAndAttributes & 0x0000FFFF,
    
    225
    +                               dwFlagsAndAttributes & 0xFFF00000,
    
    226
    +                               dwFlagsAndAttributes & 0x000F0000,
    
    227
    +                               lpSecurityAttributes,
    
    228
    +                               hTemplateFile };
    
    229
    +
    
    230
    +
    
    231
    +    /* allocate memory space for converted path name */
    
    232
    +    len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
    
    233
    +                               lpFileName, -1, NULL, 0 );
    
    234
    +
    
    235
    +    lpFileNameW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
    
    236
    +
    
    237
    +    if ( !len || !lpFileNameW )
    
    238
    +    {
    
    239
    +      FT_ERROR(( "FT_Stream_Open: cannot convert file name to LPWSTR\n" ));
    
    240
    +      return INVALID_HANDLE_VALUE;
    
    241
    +    }
    
    242
    +
    
    243
    +    /* now it is safe to do the translation */
    
    244
    +    MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
    
    245
    +                         lpFileName, -1, lpFileNameW, len );
    
    246
    +
    
    247
    +    /* open the file */
    
    248
    +    return CreateFile2( lpFileNameW, dwDesiredAccess, dwShareMode,
    
    249
    +                        dwCreationDisposition, &createExParams );
    
    250
    +  }
    
    213 251
     
    
    214 252
     #endif
    
    215 253
     
    
    216 254
     
    
    217
    -#if defined( _WIN32_WCE ) || defined( UWP_LEGACY )
    
    255
    +#if defined( _WIN32_WCE )
    
    256
    +  /* malloc.h provides implementation of alloca()/_alloca() */
    
    257
    +  #include <malloc.h>
    
    218 258
     
    
    219 259
       FT_LOCAL_DEF( HANDLE )
    
    220 260
       CreateFileA( LPCSTR                lpFileName,
    


  • reply via email to

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