Skip to content

Commit

Permalink
buffer: Add read_fixed_string()
Browse files Browse the repository at this point in the history
Co-authored-by: Håvard Sørbø <[email protected]>
  • Loading branch information
oleavr and hsorbo committed May 14, 2024
1 parent 6fbb7d9 commit fa71e1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/base/buffer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ namespace Frida {
return val->substring (0, (long) max_length);
}

public string read_fixed_string (size_t offset, size_t size) {
string * val = (string *) get_pointer (offset, size);
return val->substring (0, (long) size);
}

public unowned Buffer write_string (size_t offset, string val) {
uint size = val.length + 1;
Memory.copy (get_pointer (offset, size), val, size);
Expand Down

0 comments on commit fa71e1f

Please sign in to comment.