Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nim >= 1.2.0 #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions png.nimble
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Package

version = "0.2.2"
version = "0.3.0"
author = "Charles Barto"
description = "Wrapper around the libpng library for png graphics"
license = "MIT"
# Dependencies

requires "nim >= 0.17.2"
requires "nim >= 1.2.0"


srcDir = "src"
12 changes: 6 additions & 6 deletions src/png.nim
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type
png_const_structp = ptr png_struct
png_structpp = ptr ptr png_struct
png_const_charp = cstring
png_byte = cuchar
png_byte = int8
png_bytep = ptr png_byte
png_const_bytep = ptr png_byte
png_bytepp = ptr ptr png_byte
Expand All @@ -95,8 +95,8 @@ type
alpha*: png_byte
png_color_8p = ptr png_color_8
png_color_8pp = ptr ptr png_color_8
png_alloc_size_t = csize
png_size_t = csize
png_alloc_size_t = csize_t
png_size_t = csize_t
png_voidp = pointer
png_const_voidp = pointer
png_uint_16 = uint16
Expand Down Expand Up @@ -492,7 +492,7 @@ proc png_handle_as_unknown*(png_ptr: png_structp; chunk_name: png_bytep): cint {
cdecl, importc: "png_handle_as_unknown", dynlib: pnglib.}
proc png_image_begin_read_from_file*(image: png_imagep; file_name: cstring): cint {.
cdecl, importc: "png_image_begin_read_from_file", dynlib: pnglib.}
proc png_image_begin_read_from_stdio*(image: png_imagep; file: TFile): cint {.
proc png_image_begin_read_from_stdio*(image: png_imagep; file: File): cint {.
cdecl, importc: "png_image_begin_read_from_stdio", dynlib: pnglib.}
proc png_image_begin_read_from_memory*(image: png_imagep;
memory: png_const_voidp; size: png_size_t): cint {.
Expand All @@ -507,13 +507,13 @@ proc png_image_write_to_file*(image: png_imagep; file: cstring;
convert_to_8bit: cint; buffer: pointer;
row_stride: png_int_32; colormap: pointer): cint {.
cdecl, importc: "png_image_write_to_file", dynlib: pnglib.}
proc png_image_write_to_stdio*(image: png_imagep; file: TFile;
proc png_image_write_to_stdio*(image: png_imagep; file: File;
convert_to_8_bit: cint; buffer: pointer;
row_stride: png_int_32; colormap: pointer): cint {.
cdecl, importc: "png_image_write_to_stdio", dynlib: pnglib.}
proc png_info_init_3*(info_ptr: png_infopp; png_info_struct_size: png_size_t) {.
cdecl, importc: "png_info_init_3", dynlib: pnglib.}
proc png_init_io*(png_ptr: png_structp; fp: TFile) {.cdecl,
proc png_init_io*(png_ptr: png_structp; fp: File) {.cdecl,
importc: "png_init_io", dynlib: pnglib.}
proc png_longjmp*(png_ptr: png_structp; val: cint) {.cdecl,
importc: "png_longjmp", dynlib: pnglib.}
Expand Down
1 change: 1 addition & 0 deletions tests/config.nims
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
switch("path", "$projectDir/../src")
4 changes: 2 additions & 2 deletions tests/testSigMatch.nim
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import png
proc testOwl(): bool =
var image = Open("OwlAlpha.png")
var image = open("tests/OwlAlpha.png")
var header: array[0..7, int8]
discard readBytes(image, header, 0, 8)
var is_png = png_sig_cmp(cast[ptr cuchar](header), 0, 8)
var is_png = png_sig_cmp(header[0].addr, 0, 8)
result = is_png == 0
when isMainModule:
var testRes = testOwl()
Expand Down