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:
parent
9553c5a4e6
commit
e54af19b25
@ -35,7 +35,6 @@ const (
|
||||
'vlib/v/tests/interop_test.v', /* bad comment formatting */
|
||||
'vlib/v/tests/string_interpolation_test.v' /* TODO byteptr: &byte.str() behaves differently than byteptr.str() */,
|
||||
'vlib/v/gen/js/tests/js.v', /* local `hello` fn, gets replaced with module `hello` aliased as `hl` */
|
||||
'examples/c_interop_wkhtmltopdf.v' /* &charptr --> &&char */,
|
||||
]
|
||||
vfmt_verify_list = [
|
||||
'cmd/',
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user