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

ci: fix byteptr cast in embed_file.v

This commit is contained in:
Delyan Angelov 2021-04-04 23:43:03 +03:00
parent 77d8336db9
commit e9b8d9ba9e
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -8,8 +8,8 @@ pub struct EmbedFileData {
path string path string
apath string apath string
mut: mut:
compressed byteptr compressed &byte
uncompressed byteptr uncompressed &byte
free_compressed bool free_compressed bool
free_uncompressed bool free_uncompressed bool
pub: pub:
@ -27,11 +27,11 @@ pub fn (mut ed EmbedFileData) free() {
ed.apath.free() ed.apath.free()
if ed.free_compressed { if ed.free_compressed {
free(ed.compressed) free(ed.compressed)
ed.compressed = byteptr(0) ed.compressed = &byte(0)
} }
if ed.free_uncompressed { if ed.free_uncompressed {
free(ed.uncompressed) free(ed.uncompressed)
ed.uncompressed = byteptr(0) ed.uncompressed = &byte(0)
} }
} }
} }
@ -39,8 +39,8 @@ pub fn (mut ed EmbedFileData) free() {
pub fn (original &EmbedFileData) to_string() string { pub fn (original &EmbedFileData) to_string() string {
unsafe { unsafe {
mut ed := &EmbedFileData(original) mut ed := &EmbedFileData(original)
the_copy := memdup(ed.data(), ed.len) the_copy := &byte(memdup(ed.data(), ed.len))
return byteptr(the_copy).vstring_with_len(ed.len) return the_copy.vstring_with_len(ed.len)
} }
} }
@ -52,7 +52,7 @@ pub fn (original &EmbedFileData) to_bytes() []byte {
} }
} }
pub fn (mut ed EmbedFileData) data() byteptr { pub fn (mut ed EmbedFileData) data() &byte {
if !isnil(ed.uncompressed) { if !isnil(ed.uncompressed) {
return ed.uncompressed return ed.uncompressed
} else { } else {
@ -87,7 +87,7 @@ pub fn (mut ed EmbedFileData) data() byteptr {
pub struct EmbedFileIndexEntry { pub struct EmbedFileIndexEntry {
id int id int
path string path string
data byteptr data &byte
} }
// find_index_entry_by_path is used internally by the V compiler: // find_index_entry_by_path is used internally by the V compiler: