freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] doc: Clarify description of `FT_Stream_


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] doc: Clarify description of `FT_Stream_IoFunc`.
Date: Wed, 06 Jul 2022 10:56:11 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • d5d048bb
    by Stephen Holdaway at 2022-07-06T12:55:40+02:00
    doc: Clarify description of `FT_Stream_IoFunc`.
    
    The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual
    seek/read behavior required for custom stream implementations to work, but
    it didn't explicitly explain it.  Without looking at the internals of
    FreeType, it was easy for someone to assume their implementation should
    handle both seek and read operations all the time.  If this is done, you get
    a variety of errors, but mostly just `Unknown_File_Format` (error code
    0x02).
    

1 changed file:

Changes:

  • include/freetype/ftsystem.h
    ... ... @@ -229,7 +229,8 @@ FT_BEGIN_HEADER
    229 229
        *     A handle to the source stream.
    
    230 230
        *
    
    231 231
        *   offset ::
    
    232
    -   *     The offset of read in stream (always from start).
    
    232
    +   *     The offset from the start of the stream to seek to if this is a seek
    
    233
    +   *     operation (see note).
    
    233 234
        *
    
    234 235
        *   buffer ::
    
    235 236
        *     The address of the read buffer.
    
    ... ... @@ -241,8 +242,13 @@ FT_BEGIN_HEADER
    241 242
        *   The number of bytes effectively read by the stream.
    
    242 243
        *
    
    243 244
        * @note:
    
    244
    -   *   This function might be called to perform a seek or skip operation with
    
    245
    -   *   a `count` of~0.  A non-zero return value then indicates an error.
    
    245
    +   *   This function performs a seek *or* a read operation depending on the
    
    246
    +   *   argument values.  If `count` is zero, the operation is a seek to
    
    247
    +   *   `offset` bytes.  If `count` is >~0, the operation is a read of `count`
    
    248
    +   *   bytes from the current position in the stream, and the `offset` value
    
    249
    +   *   should be ignored.
    
    250
    +   *
    
    251
    +   *   For seek operations, a non-zero return value indicates an error.
    
    246 252
        *
    
    247 253
        */
    
    248 254
       typedef unsigned long
    


  • reply via email to

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