examples: fix -cstrict compilation of c_interop_wkhtmltopdf.v
parent
9553c5a4e6
commit
e54af19b25
|
@ -35,7 +35,6 @@ const (
|
||||||
'vlib/v/tests/interop_test.v', /* bad comment formatting */
|
'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/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` */
|
'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 = [
|
vfmt_verify_list = [
|
||||||
'cmd/',
|
'cmd/',
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn main() {
|
||||||
// init
|
// init
|
||||||
init := C.wkhtmltopdf_init(0)
|
init := C.wkhtmltopdf_init(0)
|
||||||
println('wkhtmltopdf_init: $init')
|
println('wkhtmltopdf_init: $init')
|
||||||
version := int(C.wkhtmltopdf_version())
|
version := unsafe { cstring_to_vstring(&char(C.wkhtmltopdf_version())) }
|
||||||
println('wkhtmltopdf_version: $version')
|
println('wkhtmltopdf_version: $version')
|
||||||
global_settings := C.wkhtmltopdf_create_global_settings()
|
global_settings := C.wkhtmltopdf_create_global_settings()
|
||||||
println('wkhtmltopdf_create_global_settings: ${voidptr(global_settings)}')
|
println('wkhtmltopdf_create_global_settings: ${voidptr(global_settings)}')
|
||||||
|
@ -71,14 +71,15 @@ fn main() {
|
||||||
error_code := C.wkhtmltopdf_http_error_code(converter)
|
error_code := C.wkhtmltopdf_http_error_code(converter)
|
||||||
println('wkhtmltopdf_http_error_code: $error_code')
|
println('wkhtmltopdf_http_error_code: $error_code')
|
||||||
if result {
|
if result {
|
||||||
data := &charptr(0)
|
pdata := &char(0)
|
||||||
size := C.wkhtmltopdf_get_output(converter, data)
|
ppdata := &pdata
|
||||||
|
size := C.wkhtmltopdf_get_output(converter, voidptr(ppdata))
|
||||||
println('wkhtmltopdf_get_output: $size bytes')
|
println('wkhtmltopdf_get_output: $size bytes')
|
||||||
mut file := os.open_file('./google.pdf', 'w+', 0o666) or {
|
mut file := os.open_file('./google.pdf', 'w+', 0o666) or {
|
||||||
println('ERR: $err')
|
println('ERR: $err')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
wrote := unsafe { file.write_ptr(data, size) }
|
wrote := unsafe { file.write_ptr(pdata, size) }
|
||||||
println('write_bytes: $wrote [./google.pdf]')
|
println('write_bytes: $wrote [./google.pdf]')
|
||||||
file.flush()
|
file.flush()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
Loading…
Reference in New Issue