1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: fix -cstrict compilation of c_interop_wkhtmltopdf.v

This commit is contained in:
Delyan Angelov
2021-06-05 10:03:05 +03:00
parent 9553c5a4e6
commit e54af19b25
2 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,7 @@ fn main() {
// init
init := C.wkhtmltopdf_init(0)
println('wkhtmltopdf_init: $init')
version := int(C.wkhtmltopdf_version())
version := unsafe { cstring_to_vstring(&char(C.wkhtmltopdf_version())) }
println('wkhtmltopdf_version: $version')
global_settings := C.wkhtmltopdf_create_global_settings()
println('wkhtmltopdf_create_global_settings: ${voidptr(global_settings)}')
@ -71,14 +71,15 @@ fn main() {
error_code := C.wkhtmltopdf_http_error_code(converter)
println('wkhtmltopdf_http_error_code: $error_code')
if result {
data := &charptr(0)
size := C.wkhtmltopdf_get_output(converter, data)
pdata := &char(0)
ppdata := &pdata
size := C.wkhtmltopdf_get_output(converter, voidptr(ppdata))
println('wkhtmltopdf_get_output: $size bytes')
mut file := os.open_file('./google.pdf', 'w+', 0o666) or {
println('ERR: $err')
return
}
wrote := unsafe { file.write_ptr(data, size) }
wrote := unsafe { file.write_ptr(pdata, size) }
println('write_bytes: $wrote [./google.pdf]')
file.flush()
file.close()