summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 14:46:37 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 15:30:56 -0200
commit25a9e1d886054d3907fb43e3682525b1a3901209 (patch)
tree1b231755171bb24e4353183a907cf242deab9c23 /src
parent6f9deb976a9774a14636cb3131743245347b2dd4 (diff)
Efl.Io.{Queue,Buffer,Buffered_Stream}: slice_get is now a property.
Previously we couldn't return a slice, instead required the user to pass a slice and we'd fill it since Eolian couldn't generate fallbacks for structures. Since @q66 fixed eolian, we can now return the structure itself as initially wanted, ditching some TODO from the code.
Diffstat (limited to 'src')
-rw-r--r--src/bin/eeze/eeze_scanner_monitor.c6
-rw-r--r--src/bin/efl/efl_debug_common.c4
-rw-r--r--src/examples/ecore/efl_io_buffered_stream_example.c4
-rw-r--r--src/examples/ecore/efl_io_copier_example.c26
-rw-r--r--src/examples/ecore/efl_io_queue_example.c4
-rw-r--r--src/examples/ecore/efl_net_dialer_simple_example.c15
-rw-r--r--src/examples/ecore/efl_net_server_example.c102
-rw-r--r--src/examples/ecore/efl_net_server_simple_example.c15
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.c20
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.eo20
-rw-r--r--src/lib/ecore_con/ecore_con_legacy.c4
-rw-r--r--src/lib/ecore_con/efl_net_dialer_simple.eo4
-rw-r--r--src/lib/ecore_con/efl_net_socket_simple.eo4
-rw-r--r--src/lib/efl/interfaces/efl_io_buffer.c16
-rw-r--r--src/lib/efl/interfaces/efl_io_buffer.eo12
-rw-r--r--src/lib/efl/interfaces/efl_io_queue.c16
-rw-r--r--src/lib/efl/interfaces/efl_io_queue.eo14
17 files changed, 122 insertions, 164 deletions
diff --git a/src/bin/eeze/eeze_scanner_monitor.c b/src/bin/eeze/eeze_scanner_monitor.c
index afed23c974..fd01d2c2d3 100644
--- a/src/bin/eeze/eeze_scanner_monitor.c
+++ b/src/bin/eeze/eeze_scanner_monitor.c
@@ -70,11 +70,7 @@ _on_data(void *data, const Efl_Event *event)
70 Eo *dialer = event->object; 70 Eo *dialer = event->object;
71 Eina_Slice slice; 71 Eina_Slice slice;
72 72
73 if (!efl_io_buffered_stream_slice_get(dialer, &slice)) 73 slice = efl_io_buffered_stream_slice_get(dialer);
74 {
75 fprintf(stderr, "ERROR: could not get buffered stream slice\n");
76 goto error;
77 }
78 if (slice.len == 0) return; 74 if (slice.len == 0) return;
79 75
80 if (eet_connection_received(ec, slice.mem, slice.len) != 0) 76 if (eet_connection_received(ec, slice.mem, slice.len) != 0)
diff --git a/src/bin/efl/efl_debug_common.c b/src/bin/efl/efl_debug_common.c
index 28e44c2497..f37f17f16b 100644
--- a/src/bin/efl/efl_debug_common.c
+++ b/src/bin/efl/efl_debug_common.c
@@ -24,9 +24,7 @@ received_data(Eo *sock, void (*handle)(void *data, const char op[static 4], cons
24 Eina_Slice slice, payload; 24 Eina_Slice slice, payload;
25 Efl_Debug_Message_Header msgheader; 25 Efl_Debug_Message_Header msgheader;
26 26
27 if (!efl_io_buffered_stream_slice_get(sock, &slice)) 27 slice = efl_io_buffered_stream_slice_get(sock);
28 return EINA_TRUE;
29
30 if (slice.len < sizeof(msgheader)) 28 if (slice.len < sizeof(msgheader))
31 return EINA_TRUE; 29 return EINA_TRUE;
32 30
diff --git a/src/examples/ecore/efl_io_buffered_stream_example.c b/src/examples/ecore/efl_io_buffered_stream_example.c
index ec8ff1fd4d..9e1a7ec7f1 100644
--- a/src/examples/ecore/efl_io_buffered_stream_example.c
+++ b/src/examples/ecore/efl_io_buffered_stream_example.c
@@ -38,9 +38,7 @@ _command_next(void)
38static void 38static void
39_receiver_data(void *data EINA_UNUSED, const Efl_Event *event) 39_receiver_data(void *data EINA_UNUSED, const Efl_Event *event)
40{ 40{
41 Eina_Slice slice; 41 Eina_Slice slice = efl_io_buffered_stream_slice_get(event->object);
42
43 if (!efl_io_buffered_stream_slice_get(event->object, &slice)) return;
44 42
45 /* this will happen when we're called when we issue our own 43 /* this will happen when we're called when we issue our own
46 * efl_io_buffered_stream_clear() below. 44 * efl_io_buffered_stream_clear() below.
diff --git a/src/examples/ecore/efl_io_copier_example.c b/src/examples/ecore/efl_io_copier_example.c
index 4bde9a5dd8..50295bf30c 100644
--- a/src/examples/ecore/efl_io_copier_example.c
+++ b/src/examples/ecore/efl_io_copier_example.c
@@ -43,13 +43,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(output_cbs,
43static void 43static void
44_output_buffer_reallocated(void *data EINA_UNUSED, const Efl_Event *event) 44_output_buffer_reallocated(void *data EINA_UNUSED, const Efl_Event *event)
45{ 45{
46 Eina_Slice slice; 46 Eina_Slice slice = efl_io_buffer_slice_get(event->object);
47
48 if (!efl_io_buffer_slice_get(event->object, &slice))
49 {
50 fprintf(stderr, "ERROR: could not get buffer slice\n");
51 return;
52 }
53 47
54 fprintf(stderr, "INFO: output buffer reallocated=" EINA_SLICE_FMT "\n", 48 fprintf(stderr, "INFO: output buffer reallocated=" EINA_SLICE_FMT "\n",
55 EINA_SLICE_PRINT(slice)); 49 EINA_SLICE_PRINT(slice));
@@ -196,17 +190,13 @@ _copier_done(void *data EINA_UNUSED, const Efl_Event *event)
196 * an Eina_Binbuf, you own the ownership and must call 190 * an Eina_Binbuf, you own the ownership and must call
197 * eina_binbuf_free() to release it. 191 * eina_binbuf_free() to release it.
198 */ 192 */
199 Eina_Slice slice; 193 Eina_Slice slice = efl_io_buffer_slice_get(destination);
200 194 fprintf(stderr,
201 if (!efl_io_buffer_slice_get(destination, &slice)) 195 "INFO: :memory: resulted in slice=" EINA_SLICE_FMT ":"
202 fprintf(stderr, "ERROR: could not get buffer slice\n"); 196 "\n--BEGIN DATA--\n"
203 else 197 EINA_SLICE_STR_FMT
204 fprintf(stderr, 198 "\n--END DATA--\n",
205 "INFO: :memory: resulted in slice=" EINA_SLICE_FMT ":" 199 EINA_SLICE_PRINT(slice), EINA_SLICE_STR_PRINT(slice));
206 "\n--BEGIN DATA--\n"
207 EINA_SLICE_STR_FMT
208 "\n--END DATA--\n",
209 EINA_SLICE_PRINT(slice), EINA_SLICE_STR_PRINT(slice));
210 } 200 }
211 201
212 fprintf(stderr, "INFO: done\n"); 202 fprintf(stderr, "INFO: done\n");
diff --git a/src/examples/ecore/efl_io_queue_example.c b/src/examples/ecore/efl_io_queue_example.c
index 9b5f3a229d..d1097efe36 100644
--- a/src/examples/ecore/efl_io_queue_example.c
+++ b/src/examples/ecore/efl_io_queue_example.c
@@ -39,9 +39,7 @@ _command_next(void)
39static void 39static void
40_receiver_data(void *data EINA_UNUSED, const Efl_Event *event) 40_receiver_data(void *data EINA_UNUSED, const Efl_Event *event)
41{ 41{
42 Eina_Slice slice; 42 Eina_Slice slice = efl_io_queue_slice_get(event->object);
43
44 if (!efl_io_queue_slice_get(event->object, &slice)) return;
45 43
46 /* this will happen when we're called when we issue our own 44 /* this will happen when we're called when we issue our own
47 * efl_io_queue_clear() below. 45 * efl_io_queue_clear() below.
diff --git a/src/examples/ecore/efl_net_dialer_simple_example.c b/src/examples/ecore/efl_net_dialer_simple_example.c
index 9b790c822d..7411a58b84 100644
--- a/src/examples/ecore/efl_net_dialer_simple_example.c
+++ b/src/examples/ecore/efl_net_dialer_simple_example.c
@@ -28,22 +28,17 @@ _connected(void *data EINA_UNUSED, const Efl_Event *event)
28static void 28static void
29_eos(void *data EINA_UNUSED, const Efl_Event *event) 29_eos(void *data EINA_UNUSED, const Efl_Event *event)
30{ 30{
31 Eina_Slice s;
32
33 fprintf(stderr, "INFO: end of stream.\n"); 31 fprintf(stderr, "INFO: end of stream.\n");
34 32
35 /* on _error() we close it, then do not read as it has nothing */ 33 /* on _error() we close it, then do not read as it has nothing */
36 if (efl_io_closer_closed_get(event->object)) 34 if (efl_io_closer_closed_get(event->object))
37 return; 35 return;
38 36
39 if (efl_io_buffered_stream_slice_get(event->object, &s)) 37 fprintf(stderr,
40 { 38 "-- BEGIN RECEIVED DATA --\n"
41 fprintf(stderr, 39 EINA_SLICE_STR_FMT
42 "-- BEGIN RECEIVED DATA --\n" 40 "-- END RECEIVED DATA--\n",
43 EINA_SLICE_STR_FMT 41 EINA_SLICE_STR_PRINT(efl_io_buffered_stream_slice_get(event->object)));
44 "-- END RECEIVED DATA--\n",
45 EINA_SLICE_STR_PRINT(s));
46 }
47} 42}
48 43
49static void 44static void
diff --git a/src/examples/ecore/efl_net_server_example.c b/src/examples/ecore/efl_net_server_example.c
index edd540876f..22efdd0719 100644
--- a/src/examples/ecore/efl_net_server_example.c
+++ b/src/examples/ecore/efl_net_server_example.c
@@ -142,19 +142,16 @@ _send_copier_done(void *data, const Efl_Event *event)
142 Eo *buffer = efl_io_copier_source_get(copier); 142 Eo *buffer = efl_io_copier_source_get(copier);
143 Eo *client = efl_io_copier_destination_get(copier); 143 Eo *client = efl_io_copier_destination_get(copier);
144 Send_Recv_Data *d = data; 144 Send_Recv_Data *d = data;
145 Eina_Slice slice; 145 Eina_Slice slice = efl_io_buffer_slice_get(buffer);
146 146
147 /* show what we sent, just for debug */ 147 /* show what we sent, just for debug */
148 if (!efl_io_buffer_slice_get(buffer, &slice)) 148 fprintf(stderr,
149 fprintf(stderr, "ERROR: could not get buffer slice\n"); 149 "INFO: sent to %s %zd bytes:"
150 else 150 "\n--BEGIN SENT DATA--\n"
151 fprintf(stderr, 151 EINA_SLICE_STR_FMT
152 "INFO: sent to %s %zd bytes:" 152 "\n--END SENT DATA--\n",
153 "\n--BEGIN SENT DATA--\n" 153 efl_net_socket_address_remote_get(client),
154 EINA_SLICE_STR_FMT 154 slice.len, EINA_SLICE_STR_PRINT(slice));
155 "\n--END SENT DATA--\n",
156 efl_net_socket_address_remote_get(client),
157 slice.len, EINA_SLICE_STR_PRINT(slice));
158 155
159 if (d->recv_copier) 156 if (d->recv_copier)
160 { 157 {
@@ -175,7 +172,7 @@ _send_copier_error(void *data, const Efl_Event *event)
175 const Eina_Error *perr = event->info; 172 const Eina_Error *perr = event->info;
176 Send_Recv_Data *d = data; 173 Send_Recv_Data *d = data;
177 uint64_t offset; 174 uint64_t offset;
178 Eina_Slice slice; 175 Eina_Slice slice, remaining;
179 176
180 if (*perr == ETIMEDOUT) 177 if (*perr == ETIMEDOUT)
181 { 178 {
@@ -188,30 +185,26 @@ _send_copier_error(void *data, const Efl_Event *event)
188 retval = EXIT_FAILURE; 185 retval = EXIT_FAILURE;
189 186
190 offset = efl_io_buffer_position_read_get(buffer); 187 offset = efl_io_buffer_position_read_get(buffer);
191 if (!efl_io_buffer_slice_get(buffer, &slice)) 188 slice = efl_io_buffer_slice_get(buffer);
192 fprintf(stderr, "ERROR: could not get buffer slice\n"); 189
193 else 190 remaining = slice;
194 { 191 remaining.bytes += offset;
195 Eina_Slice remaining = slice; 192 remaining.len -= offset;
196 193
197 remaining.bytes += offset; 194 slice.len = offset;
198 remaining.len -= offset; 195
199 196 fprintf(stderr,
200 slice.len = offset; 197 "ERROR: sent to %s only %zd bytes:"
201 198 "\n--BEGIN SENT DATA--\n"
202 fprintf(stderr, 199 EINA_SLICE_STR_FMT
203 "ERROR: sent to %s only %zd bytes:" 200 "\n--END SENT DATA--\n"
204 "\n--BEGIN SENT DATA--\n" 201 "Remaining %zd bytes:"
205 EINA_SLICE_STR_FMT 202 "\n--BEGIN REMAINING DATA--\n"
206 "\n--END SENT DATA--\n" 203 EINA_SLICE_STR_FMT
207 "Remaining %zd bytes:" 204 "\n--END REMAINING DATA--\n",
208 "\n--BEGIN REMAINING DATA--\n" 205 efl_net_socket_address_remote_get(client),
209 EINA_SLICE_STR_FMT 206 slice.len, EINA_SLICE_STR_PRINT(slice),
210 "\n--END REMAINING DATA--\n", 207 remaining.len, EINA_SLICE_STR_PRINT(remaining));
211 efl_net_socket_address_remote_get(client),
212 slice.len, EINA_SLICE_STR_PRINT(slice),
213 remaining.len, EINA_SLICE_STR_PRINT(remaining));
214 }
215 208
216 fprintf(stderr, "ERROR: send copier %p failed %d '%s', check if should close..\n", 209 fprintf(stderr, "ERROR: send copier %p failed %d '%s', check if should close..\n",
217 copier, *perr, eina_error_msg_get(*perr)); 210 copier, *perr, eina_error_msg_get(*perr));
@@ -229,7 +222,7 @@ _recv_copier_done(void *data, const Efl_Event *event)
229 Eo *client = efl_io_copier_source_get(copier); 222 Eo *client = efl_io_copier_source_get(copier);
230 Eo *buffer = efl_io_copier_destination_get(copier); 223 Eo *buffer = efl_io_copier_destination_get(copier);
231 Send_Recv_Data *d = data; 224 Send_Recv_Data *d = data;
232 Eina_Slice slice; 225 Eina_Slice slice = efl_io_buffer_slice_get(buffer);
233 226
234 /* show case, you could use a copier to Efl_Io_Stdout, a 227 /* show case, you could use a copier to Efl_Io_Stdout, a
235 * file... and get progressive processing. 228 * file... and get progressive processing.
@@ -240,16 +233,13 @@ _recv_copier_done(void *data, const Efl_Event *event)
240 * You could also steal the binbuf with 233 * You could also steal the binbuf with
241 * efl_io_buffer_binbuf_steal() 234 * efl_io_buffer_binbuf_steal()
242 */ 235 */
243 if (!efl_io_buffer_slice_get(buffer, &slice)) 236 fprintf(stderr,
244 fprintf(stderr, "ERROR: could not get buffer slice\n"); 237 "INFO: recv from %s %zd bytes:"
245 else 238 "\n--BEGIN RECV DATA--\n"
246 fprintf(stderr, 239 EINA_SLICE_STR_FMT "\n"
247 "INFO: recv from %s %zd bytes:" 240 "\n--END RECV DATA--\n",
248 "\n--BEGIN RECV DATA--\n" 241 efl_net_socket_address_remote_get(client),
249 EINA_SLICE_STR_FMT "\n" 242 slice.len, EINA_SLICE_STR_PRINT(slice));
250 "\n--END RECV DATA--\n",
251 efl_net_socket_address_remote_get(client),
252 slice.len, EINA_SLICE_STR_PRINT(slice));
253 243
254 fprintf(stderr, "INFO: receive copier done, check if should close %p\n", copier); 244 fprintf(stderr, "INFO: receive copier done, check if should close %p\n", copier);
255 _send_recv_done(d, copier); 245 _send_recv_done(d, copier);
@@ -275,16 +265,14 @@ _recv_copier_error(void *data, const Efl_Event *event)
275 265
276 retval = EXIT_FAILURE; 266 retval = EXIT_FAILURE;
277 267
278 if (!efl_io_buffer_slice_get(buffer, &slice)) 268 slice = efl_io_buffer_slice_get(buffer);
279 fprintf(stderr, "ERROR: could not get buffer slice\n"); 269 fprintf(stderr,
280 else 270 "ERROR: recv to %s only %zd bytes:"
281 fprintf(stderr, 271 "\n--BEGIN RECV DATA--\n"
282 "ERROR: recv to %s only %zd bytes:" 272 EINA_SLICE_STR_FMT "\n"
283 "\n--BEGIN RECV DATA--\n" 273 "\n--END RECV DATA--\n",
284 EINA_SLICE_STR_FMT "\n" 274 efl_net_socket_address_remote_get(client),
285 "\n--END RECV DATA--\n", 275 slice.len, EINA_SLICE_STR_PRINT(slice));
286 efl_net_socket_address_remote_get(client),
287 slice.len, EINA_SLICE_STR_PRINT(slice));
288 276
289 fprintf(stderr, "ERROR: receive copier %p failed %d '%s', check if should close..\n", 277 fprintf(stderr, "ERROR: receive copier %p failed %d '%s', check if should close..\n",
290 copier, *perr, eina_error_msg_get(*perr)); 278 copier, *perr, eina_error_msg_get(*perr));
diff --git a/src/examples/ecore/efl_net_server_simple_example.c b/src/examples/ecore/efl_net_server_simple_example.c
index cef0a3ac53..548dd92ccc 100644
--- a/src/examples/ecore/efl_net_server_simple_example.c
+++ b/src/examples/ecore/efl_net_server_simple_example.c
@@ -37,22 +37,17 @@ _client_eos(void *data EINA_UNUSED, const Efl_Event *event)
37static void 37static void
38_client_read_finished(void *data EINA_UNUSED, const Efl_Event *event) 38_client_read_finished(void *data EINA_UNUSED, const Efl_Event *event)
39{ 39{
40 Eina_Slice s;
41
42 /* on _error() we close it, then do not read as it has nothing */ 40 /* on _error() we close it, then do not read as it has nothing */
43 if (efl_io_closer_closed_get(event->object)) 41 if (efl_io_closer_closed_get(event->object))
44 return; 42 return;
45 43
46 if (echo) return; 44 if (echo) return;
47 45
48 if (efl_io_buffered_stream_slice_get(event->object, &s)) 46 fprintf(stderr,
49 { 47 "-- BEGIN RECEIVED DATA --\n"
50 fprintf(stderr, 48 EINA_SLICE_STR_FMT
51 "-- BEGIN RECEIVED DATA --\n" 49 "-- END RECEIVED DATA--\n",
52 EINA_SLICE_STR_FMT 50 EINA_SLICE_STR_PRINT(efl_io_buffered_stream_slice_get(event->object)));
53 "-- END RECEIVED DATA--\n",
54 EINA_SLICE_STR_PRINT(s));
55 }
56} 51}
57 52
58static void 53static void
diff --git a/src/lib/ecore/efl_io_buffered_stream.c b/src/lib/ecore/efl_io_buffered_stream.c
index 82de769bf0..a54d125b2d 100644
--- a/src/lib/ecore/efl_io_buffered_stream.c
+++ b/src/lib/ecore/efl_io_buffered_stream.c
@@ -533,19 +533,15 @@ _efl_io_buffered_stream_progress_get(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_D
533 if (pw) *pw = w; 533 if (pw) *pw = w;
534} 534}
535 535
536EOLIAN static Eina_Bool 536EOLIAN static Eina_Slice
537_efl_io_buffered_stream_slice_get(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd, Eina_Slice *slice) 537_efl_io_buffered_stream_slice_get(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd)
538{ 538{
539 if (!pd->incoming) 539 Eina_Slice slice = { };
540 { 540
541 if (slice) 541 if (pd->incoming)
542 { 542 slice = efl_io_queue_slice_get(pd->incoming);
543 slice->mem = NULL; 543
544 slice->len = 0; 544 return slice;
545 }
546 return EINA_FALSE;
547 }
548 return efl_io_queue_slice_get(pd->incoming, slice);
549} 545}
550 546
551EOLIAN static void 547EOLIAN static void
diff --git a/src/lib/ecore/efl_io_buffered_stream.eo b/src/lib/ecore/efl_io_buffered_stream.eo
index fd8f1a9859..e7ebcfa3b8 100644
--- a/src/lib/ecore/efl_io_buffered_stream.eo
+++ b/src/lib/ecore/efl_io_buffered_stream.eo
@@ -19,13 +19,13 @@ class Efl.Io.Buffered_Stream (Efl.Loop_User, Efl.Io.Reader, Efl.Io.Writer, Efl.I
19 19
20 Reading is also much simpler since incoming data is kept in an 20 Reading is also much simpler since incoming data is kept in an
21 @Efl.Io.Queue, thus its size can be queried with @.pending_read 21 @Efl.Io.Queue, thus its size can be queried with @.pending_read
22 and read with @Efl.Io.Reader.read or peeked with @.slice_get, 22 and read with @Efl.Io.Reader.read or peeked with @.slice,
23 then discarded with @.discard or @.clear. 23 then discarded with @.discard or @.clear.
24 24
25 Then when waiting for a complete message, just peek at its 25 Then when waiting for a complete message, just peek at its
26 contents, if not complete do nothing and wait, if complete then 26 contents, if not complete do nothing and wait, if complete then
27 either @Efl.Io.Reader.read to get a copy or manipulate a 27 either @Efl.Io.Reader.read to get a copy or manipulate a
28 read-only reference from @.slice_get and then @.discard 28 read-only reference from @.slice and then @.discard
29 29
30 The actual I/O is set with the constructor method @.inner_io.set 30 The actual I/O is set with the constructor method @.inner_io.set
31 and can be retrieved with @.inner_io.get, which should be used 31 and can be retrieved with @.inner_io.get, which should be used
@@ -155,17 +155,17 @@ class Efl.Io.Buffered_Stream (Efl.Loop_User, Efl.Io.Reader, Efl.Io.Writer, Efl.I
155 } 155 }
156 } 156 }
157 157
158 slice_get { // TODO: property and return of Eina.Slice (not pointer) 158 @property slice {
159 [[Get a temporary access to input queue's internal read memory. 159 [[Get a temporary access to input queue's internal read memory.
160 160
161 The memory pointed by slice may be changed by other 161 The memory pointed by slice may be changed by other
162 methods of this class. The event "slice,changed" will be 162 methods of this class. The event "slice,changed" will be
163 called in those situations. 163 called in those situations.
164 ]] 164 ]]
165 params { 165 get { }
166 @out slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Reader.read are called. It is the full slice available for reading.]] 166 values {
167 slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Reader.read are called. It is the full slice available for reading.]]
167 } 168 }
168 return: bool (false); [[$true on success, $false otherwise]]
169 } 169 }
170 170
171 discard { 171 discard {
@@ -175,12 +175,12 @@ class Efl.Io.Buffered_Stream (Efl.Loop_User, Efl.Io.Reader, Efl.Io.Writer, Efl.I
175 given amount of bytes, without executing the actual 175 given amount of bytes, without executing the actual
176 copy. 176 copy.
177 177
178 It's often paired with @.slice_get, if users read the 178 It's often paired with @.slice, if users read the
179 information from the slice and once they're done, that 179 information from the slice and once they're done, that
180 data must be discarded. 180 data must be discarded.
181 181
182 As an example, some protocols provide messages with a 182 As an example, some protocols provide messages with a
183 "size" header, then @.slice_get is used to peek into the 183 "size" header, then @.slice is used to peek into the
184 available memory to see if there is a "size" and if the 184 available memory to see if there is a "size" and if the
185 rest of the slice is the full payload, in this case the 185 rest of the slice is the full payload, in this case the
186 slice may be handled to some processing function. When 186 slice may be handled to some processing function. When
@@ -241,8 +241,8 @@ class Efl.Io.Buffered_Stream (Efl.Loop_User, Efl.Io.Reader, Efl.Io.Writer, Efl.I
241 finished; [[Both read and write are finished.]] 241 finished; [[Both read and write are finished.]]
242 error: Eina.Error; [[An error happened and the I/O stopped]] 242 error: Eina.Error; [[An error happened and the I/O stopped]]
243 progress; [[Property @.progress changed]] 243 progress; [[Property @.progress changed]]
244 slice,changed; [[The read-slice returned by @.slice_get may have changed.]] 244 slice,changed; [[The read-slice returned by @.slice may have changed.]]
245 line: ptr(const(Eina.Slice)); [[If @.line_delimiter is set, will be emitted with current line. The memory is only valid during event callback dispatched and should not be modified. Note that the line slice may not be inside @.slice_get, don't assume that!]] 245 line: ptr(const(Eina.Slice)); [[If @.line_delimiter is set, will be emitted with current line. The memory is only valid during event callback dispatched and should not be modified. Note that the line slice may not be inside @.slice, don't assume that!]]
246 } 246 }
247 247
248 implements { 248 implements {
diff --git a/src/lib/ecore_con/ecore_con_legacy.c b/src/lib/ecore_con/ecore_con_legacy.c
index 684c25da58..54b929dc53 100644
--- a/src/lib/ecore_con/ecore_con_legacy.c
+++ b/src/lib/ecore_con/ecore_con_legacy.c
@@ -530,7 +530,7 @@ _ecore_con_client_socket_slice_changed(void *data, const Efl_Event *event EINA_U
530 if (cl->delete_me) return; 530 if (cl->delete_me) return;
531 if (cl->ssl.upgrading) return; 531 if (cl->ssl.upgrading) return;
532 532
533 if (!efl_io_buffered_stream_slice_get(cl->socket, &ro_slice)) return; 533 ro_slice = efl_io_buffered_stream_slice_get(cl->socket);
534 if (ro_slice.len == 0) return; 534 if (ro_slice.len == 0) return;
535 535
536 rw_slice = eina_slice_dup(ro_slice); 536 rw_slice = eina_slice_dup(ro_slice);
@@ -1211,7 +1211,7 @@ _ecore_con_server_dialer_slice_changed(void *data, const Efl_Event *event EINA_U
1211 if (svr->delete_me) return; 1211 if (svr->delete_me) return;
1212 if (svr->ssl.upgrading) return; 1212 if (svr->ssl.upgrading) return;
1213 1213
1214 if (!efl_io_buffered_stream_slice_get(svr->dialer, &ro_slice)) return; 1214 ro_slice = efl_io_buffered_stream_slice_get(svr->dialer);
1215 if (ro_slice.len == 0) return; 1215 if (ro_slice.len == 0) return;
1216 1216
1217 rw_slice = eina_slice_dup(ro_slice); 1217 rw_slice = eina_slice_dup(ro_slice);
diff --git a/src/lib/ecore_con/efl_net_dialer_simple.eo b/src/lib/ecore_con/efl_net_dialer_simple.eo
index 2d51234759..22e40b0910 100644
--- a/src/lib/ecore_con/efl_net_dialer_simple.eo
+++ b/src/lib/ecore_con/efl_net_dialer_simple.eo
@@ -20,14 +20,14 @@ class Efl.Net.Dialer.Simple (Efl.Net.Socket.Simple, Efl.Net.Dialer) {
20 @Efl.Io.Queue, thus its size can be queried with 20 @Efl.Io.Queue, thus its size can be queried with
21 @Efl.Io.Buffered_Stream.pending_read and read with 21 @Efl.Io.Buffered_Stream.pending_read and read with
22 @Efl.Io.Reader.read or peeked with 22 @Efl.Io.Reader.read or peeked with
23 @Efl.Io.Buffered_Stream.slice_get, then discarded with 23 @Efl.Io.Buffered_Stream.slice, then discarded with
24 @Efl.Io.Buffered_Stream.discard or 24 @Efl.Io.Buffered_Stream.discard or
25 @Efl.Io.Buffered_Stream.clear. 25 @Efl.Io.Buffered_Stream.clear.
26 26
27 Then when waiting for a complete message, just peek at its 27 Then when waiting for a complete message, just peek at its
28 contents, if not complete do nothing, if complete then either 28 contents, if not complete do nothing, if complete then either
29 @Efl.Io.Reader.read to get a copy or manipulate a read-only 29 @Efl.Io.Reader.read to get a copy or manipulate a read-only
30 reference from @Efl.Io.Buffered_Stream.slice_get and then 30 reference from @Efl.Io.Buffered_Stream.slice and then
31 @Efl.Io.Buffered_Stream.discard 31 @Efl.Io.Buffered_Stream.discard
32 32
33 The actual dialer is created using the class given as the 33 The actual dialer is created using the class given as the
diff --git a/src/lib/ecore_con/efl_net_socket_simple.eo b/src/lib/ecore_con/efl_net_socket_simple.eo
index b6339ace66..bfdd24f5e6 100644
--- a/src/lib/ecore_con/efl_net_socket_simple.eo
+++ b/src/lib/ecore_con/efl_net_socket_simple.eo
@@ -19,14 +19,14 @@ class Efl.Net.Socket.Simple (Efl.Io.Buffered_Stream, Efl.Net.Socket) {
19 @Efl.Io.Queue, thus its size can be queried with 19 @Efl.Io.Queue, thus its size can be queried with
20 @Efl.Io.Buffered_Stream.pending_read and read with 20 @Efl.Io.Buffered_Stream.pending_read and read with
21 @Efl.Io.Reader.read or peeked with 21 @Efl.Io.Reader.read or peeked with
22 @Efl.Io.Buffered_Stream.slice_get, then discarded with 22 @Efl.Io.Buffered_Stream.slice, then discarded with
23 @Efl.Io.Buffered_Stream.discard or 23 @Efl.Io.Buffered_Stream.discard or
24 @Efl.Io.Buffered_Stream.clear. 24 @Efl.Io.Buffered_Stream.clear.
25 25
26 Then when waiting for a complete message, just peek at its 26 Then when waiting for a complete message, just peek at its
27 contents, if not complete do nothing, if complete then either 27 contents, if not complete do nothing, if complete then either
28 @Efl.Io.Reader.read to get a copy or manipulate a read-only 28 @Efl.Io.Reader.read to get a copy or manipulate a read-only
29 reference from @Efl.Io.Buffered_Stream.slice_get and then 29 reference from @Efl.Io.Buffered_Stream.slice and then
30 @Efl.Io.Buffered_Stream.discard 30 @Efl.Io.Buffered_Stream.discard
31 31
32 The actual socket is set with the constructor method 32 The actual socket is set with the constructor method
diff --git a/src/lib/efl/interfaces/efl_io_buffer.c b/src/lib/efl/interfaces/efl_io_buffer.c
index f60fe65f6d..66b5338e2f 100644
--- a/src/lib/efl/interfaces/efl_io_buffer.c
+++ b/src/lib/efl/interfaces/efl_io_buffer.c
@@ -107,16 +107,18 @@ _efl_io_buffer_limit_get(Eo *o EINA_UNUSED, Efl_Io_Buffer_Data *pd)
107 return pd->limit; 107 return pd->limit;
108} 108}
109 109
110EOLIAN static Eina_Bool 110EOLIAN static Eina_Slice
111_efl_io_buffer_slice_get(Eo *o, Efl_Io_Buffer_Data *pd, Eina_Slice *slice) 111_efl_io_buffer_slice_get(Eo *o, Efl_Io_Buffer_Data *pd)
112{ 112{
113 if (slice) 113 Eina_Slice slice = { };
114
115 if (!efl_io_closer_closed_get(o))
114 { 116 {
115 slice->mem = pd->bytes; 117 slice.mem = pd->bytes;
116 slice->len = efl_io_sizer_size_get(o); 118 slice.len = efl_io_sizer_size_get(o);
117 } 119 }
118 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_io_closer_closed_get(o), EINA_FALSE); 120
119 return EINA_TRUE; 121 return slice;
120} 122}
121 123
122EOLIAN static Eina_Binbuf * 124EOLIAN static Eina_Binbuf *
diff --git a/src/lib/efl/interfaces/efl_io_buffer.eo b/src/lib/efl/interfaces/efl_io_buffer.eo
index 5912858637..30b75d2341 100644
--- a/src/lib/efl/interfaces/efl_io_buffer.eo
+++ b/src/lib/efl/interfaces/efl_io_buffer.eo
@@ -6,7 +6,7 @@ class Efl.Io.Buffer (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Ef
6 use different offsets/position internally. 6 use different offsets/position internally.
7 7
8 One can get temporary direct access to internal buffer with 8 One can get temporary direct access to internal buffer with
9 @.slice_get or steal the buffer with @.binbuf_steal. 9 @.slice or steal the buffer with @.binbuf_steal.
10 10
11 A fixed sized buffer can be implemented by setting @.limit 11 A fixed sized buffer can be implemented by setting @.limit
12 followed by @.preallocate 12 followed by @.preallocate
@@ -78,17 +78,17 @@ class Efl.Io.Buffer (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Ef
78 } 78 }
79 } 79 }
80 80
81 slice_get { // TODO: property and return of Eina.Slice (not pointer) 81 @property slice {
82 [[Get a temporary access to buffer's internal memory. 82 [[Get a temporary access to buffer's internal memory.
83 83
84 The memory pointed by slice may be changed by other 84 The memory pointed by slice may be changed by other
85 methods of this class. The event "reallocated" will be 85 methods of this class. The event "reallocated" will be
86 called in those situations. 86 called in those situations.
87 ]] 87 ]]
88 params { 88 get { }
89 @out slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Sizer.resize are called. It is the full slice, not a partial one starting at current position.]] 89 values {
90 slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Sizer.resize are called. It is the full slice, not a partial one starting at current position.]]
90 } 91 }
91 return: bool (false); [[$true on success, $false otherwise]]
92 } 92 }
93 93
94 binbuf_steal { 94 binbuf_steal {
@@ -103,7 +103,7 @@ class Efl.Io.Buffer (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Ef
103 events { 103 events {
104 position_read,changed; [[Notifies @.position_read changed]] 104 position_read,changed; [[Notifies @.position_read changed]]
105 position_write,changed; [[Notifies @.position_write changed]] 105 position_write,changed; [[Notifies @.position_write changed]]
106 reallocated; [[Notifies the internal buffer was reallocated, thus whatever was returned by @.slice_get becomes invalid]] 106 reallocated; [[Notifies the internal buffer was reallocated, thus whatever was returned by @.slice becomes invalid]]
107 } 107 }
108 108
109 implements { 109 implements {
diff --git a/src/lib/efl/interfaces/efl_io_queue.c b/src/lib/efl/interfaces/efl_io_queue.c
index 503adc6e69..deda2d6850 100644
--- a/src/lib/efl/interfaces/efl_io_queue.c
+++ b/src/lib/efl/interfaces/efl_io_queue.c
@@ -200,16 +200,18 @@ _efl_io_queue_usage_get(Eo *o EINA_UNUSED, Efl_Io_Queue_Data *pd)
200 return pd->position_write - pd->position_read; 200 return pd->position_write - pd->position_read;
201} 201}
202 202
203EOLIAN static Eina_Bool 203EOLIAN static Eina_Slice
204_efl_io_queue_slice_get(Eo *o, Efl_Io_Queue_Data *pd, Eina_Slice *slice) 204_efl_io_queue_slice_get(Eo *o, Efl_Io_Queue_Data *pd)
205{ 205{
206 if (slice) 206 Eina_Slice slice = { };
207
208 if (!efl_io_closer_closed_get(o))
207 { 209 {
208 slice->mem = pd->bytes + pd->position_read; 210 slice.mem = pd->bytes + pd->position_read;
209 slice->len = efl_io_queue_usage_get(o); 211 slice.len = efl_io_queue_usage_get(o);
210 } 212 }
211 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_io_closer_closed_get(o), EINA_FALSE); 213
212 return EINA_TRUE; 214 return slice;
213} 215}
214 216
215EOLIAN static void 217EOLIAN static void
diff --git a/src/lib/efl/interfaces/efl_io_queue.eo b/src/lib/efl/interfaces/efl_io_queue.eo
index c5d5ac444a..e3457ed8cc 100644
--- a/src/lib/efl/interfaces/efl_io_queue.eo
+++ b/src/lib/efl/interfaces/efl_io_queue.eo
@@ -45,17 +45,17 @@ class Efl.Io.Queue (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer) {
45 } 45 }
46 } 46 }
47 47
48 slice_get { // TODO: property and return of Eina.Slice (not pointer) 48 @property slice {
49 [[Get a temporary access to queue's internal read memory. 49 [[Get a temporary access to queue's internal read memory.
50 50
51 The memory pointed by slice may be changed by other 51 The memory pointed by slice may be changed by other
52 methods of this class. The event "slice,changed" will be 52 methods of this class. The event "slice,changed" will be
53 called in those situations. 53 called in those situations.
54 ]] 54 ]]
55 params { 55 get { }
56 @out slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Reader.read are called. It is the full slice available for reading.]] 56 values {
57 slice: Eina.Slice; [[Slice of the current buffer, may be invalidated if @Efl.Io.Writer.write, @Efl.Io.Closer.close or @Efl.Io.Reader.read are called. It is the full slice available for reading.]]
57 } 58 }
58 return: bool (false); [[$true on success, $false otherwise]]
59 } 59 }
60 60
61 discard { 61 discard {
@@ -65,12 +65,12 @@ class Efl.Io.Queue (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer) {
65 given amount of bytes, without executing the actual 65 given amount of bytes, without executing the actual
66 copy. 66 copy.
67 67
68 It's often paired with @.slice_get, if users read the 68 It's often paired with @.slice, if users read the
69 information from the slice and once they're done, that 69 information from the slice and once they're done, that
70 data must be discarded. 70 data must be discarded.
71 71
72 As an example, some protocols provide messages with a 72 As an example, some protocols provide messages with a
73 "size" header, then @.slice_get is used to peek into the 73 "size" header, then @.slice is used to peek into the
74 available memory to see if there is a "size" and if the 74 available memory to see if there is a "size" and if the
75 rest of the slice is the full payload, in this case the 75 rest of the slice is the full payload, in this case the
76 slice may be handled to some processing function. When 76 slice may be handled to some processing function. When
@@ -102,7 +102,7 @@ class Efl.Io.Queue (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer) {
102 } 102 }
103 103
104 events { 104 events {
105 slice,changed; [[The read-slice returned by @.slice_get may have changed.]] 105 slice,changed; [[The read-slice returned by @.slice may have changed.]]
106 } 106 }
107 107
108 implements { 108 implements {