nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
combined
(merge:
b8d1117
35be616
)
Merge: Binary over network
author
Jean Privat
<jean@pryen.org>
Tue, 26 May 2015 10:12:35 +0000
(06:12 -0400)
committer
Jean Privat
<jean@pryen.org>
Tue, 26 May 2015 12:38:00 +0000
(08:38 -0400)
Add services to write strings in binary streams and better support for binary in network modules.
Pull-Request: #1390
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
1
2
lib/socket/socket_c.nit
patch
|
diff1
|
diff2
|
blob
|
history
diff --cc
lib/socket/socket_c.nit
index
627fb06
,
518fcb5
..
fbf2923
---
1
/
lib/socket/socket_c.nit
---
2
/
lib/socket/socket_c.nit
+++ b/
lib/socket/socket_c.nit
@@@
-134,12
-134,13
+134,13
@@@
extern class NativeSocket `{ int* `
# Write `value` as a single byte
fun write_byte(value: Int): Int `{
- return write(*recv, &value, 1);
+ unsigned char byt = (unsigned char)value;
+ return write(*recv, &byt, 1);
`}
- fun read: String import NativeString.to_s_with_length `{
+ fun read: String import NativeString.to_s_with_length, NativeString.to_s_with_copy `{
static char c[1024];
- int n = read(*recv, c, 1024);
+ int n = read(*recv, c, 1023);
if(n < 0) {
return NativeString_to_s_with_length("",0);
}