Skip to content

Bug: Signed data values are handled incorrectly #7

@jeremy-code

Description

@jeremy-code

For SBYTE, SSHORT, SLONG, and SRATIONAL formats, .data returns a Uint8Array, which doesn't really make sense:

const signedArr1 = new Int8Array([-128, -1, 127])
new Uint8Array(signedArr1.buffer) // Uint8Array(3) [ 128, 255, 127 ]

Truthfully, using Uint8Array as the ONLY return type for .data probably shouldn't be done, and it probably should be done using the proper TypedArray for the different types, that being:

BYTE: Uint8Array
ASCII: Uint8Array(?) Or string
SHORT: Uint16Array
LONG: Uint32Array
RATIONAL: Uint32Array(?)
SBYTE: Int8Array
SSHORT: Int16Array
SLONG: Int32Array
SRATIONAL: Int32Array(?)
UNDEFINED: Uint8Array(?)

FLOAT and DOUBLE aren't handled in libexif, so those should be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions