Skip to content

Julia nightly: ERROR: TypeError: in RefArray, in A, expected A<:(AbstractArray{Ptr{UInt8}}), got Type{Vector{Ptr{Gray{N0f8}}}} #74

Closed
@IanButterworth

Description

@IanButterworth
julia> using PNGFiles

julia> PNGFiles.load(pkgdir(PNGFiles, "test/temp/PngSuite/basi0g01.png"))
ERROR: TypeError: in RefArray, in A, expected A<:(AbstractArray{Ptr{UInt8}}), got Type{Vector{Ptr{Gray{N0f8}}}}
Stacktrace:
  [1] Ref{Ptr{UInt8}}(a::Vector{Ptr{Gray{N0f8}}})
    @ Base ./refpointer.jl:158
  [2] cconvert(::Type{Ptr{Ptr{UInt8}}}, a::Vector{Ptr{Gray{N0f8}}})
    @ Base ./refpointer.jl:176
  [3] png_read_image(png_ptr::Ptr{Nothing}, image::Vector{Ptr{Gray{N0f8}}})
    @ PNGFiles ~/.julia/dev/PNGFiles/gen/libpng/libpng_api.jl:558
  [4] _load!(buffer::Matrix{Gray{N0f8}}, png_ptr::Ptr{Nothing}, info_ptr::Ptr{Nothing})
    @ PNGFiles ~/.julia/dev/PNGFiles/src/io.jl:256
  [5] #invokelatest#2
    @ Base ./essentials.jl:955 [inlined]
  [6] invokelatest
    @ Base ./essentials.jl:952 [inlined]
  [7] _load(png_ptr::Ptr{Nothing}, info_ptr::Ptr{Nothing}; gamma::Nothing, expand_paletted::Bool, background::Bool)
    @ PNGFiles ~/.julia/dev/PNGFiles/src/io.jl:243
  [8] _load
    @ PNGFiles ~/.julia/dev/PNGFiles/src/io.jl:105 [inlined]
  [9] load(fpath::String; gamma::Nothing, expand_paletted::Bool, background::Bool)
    @ PNGFiles ~/.julia/dev/PNGFiles/src/io.jl:54
 [10] load(fpath::String)
    @ PNGFiles ~/.julia/dev/PNGFiles/src/io.jl:47
 [11] top-level scope
    @ REPL[8]:1

function png_read_image(png_ptr, image)
ccall((:png_read_image, libpng), Cvoid, (png_structrp, png_bytepp), png_ptr, image)
end

PNGFiles.jl/src/io.jl

Lines 255 to 260 in f1bf24f

function _load!(buffer::Matrix{T}, png_ptr, info_ptr) where T # separate to support precompilation of permutedims
png_read_image(png_ptr, map(pointer, eachcol(buffer)))
png_read_end(png_ptr, info_ptr)
png_destroy_read_struct(Ref{Ptr{Cvoid}}(png_ptr), Ref{Ptr{Cvoid}}(info_ptr), C_NULL)
return permutedims(buffer, (2, 1))
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions