home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Server, plugin: Fix buggy passing of strings to C library.
[plomrogue]
/
server
/
utils.py
diff --git
a/server/utils.py
b/server/utils.py
index 22acb0dec6564eda7729be8b918e2e85ee9232a6..43ca9f28660d7a1963d720a40a475e51bdd4c32f 100644
(file)
--- a/
server/utils.py
+++ b/
server/utils.py
@@
-84,8
+84,14
@@
def prep_library():
def c_pointer_to_bytearray(ba):
"""Return C char * pointer to ba."""
def c_pointer_to_bytearray(ba):
"""Return C char * pointer to ba."""
- type = ctypes.c_char * len(ba)
- return type.from_buffer(ba)
+ ty = ctypes.c_char * len(ba)
+ return ty.from_buffer(ba)
+
+
+def c_pointer_to_string(string):
+ """Return C char * pointer to string."""
+ p = ctypes.c_char_p(string.encode("ascii"))
+ return p
def parse_command_line_arguments():
def parse_command_line_arguments():