summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 15:27:34 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 15:30:56 -0200
commitdd5cdda64b5fd3966718af62d417117942e2f323 (patch)
tree28e5ff6f8b5f4fc76fcefce709790b4a91def65b /src
parent25a9e1d886054d3907fb43e3682525b1a3901209 (diff)
more eo simplified to use Eina_Slice instead of pointer to.
Working directly with Eina_Slice is easier than a pointer to it, requires no validation of the pointers and is cheap since it's just putting together size_t + void*. However we can't hint the user of 'const(Eina.Slice)' properties as Eolian is incorrectly generating getters as: const Eina_Slice class_property_get(...) which is makes compilers complain about ignored qualifiers: ../src/lib/ecore/efl_io_copier.eo.h:329:7: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] Leave some TODO so @q66 can fix those.
Diffstat (limited to 'src')
-rw-r--r--src/examples/ecore/efl_io_buffered_stream_example.c2
-rw-r--r--src/examples/ecore/efl_io_copier_example.c2
-rw-r--r--src/examples/ecore/efl_io_queue_example.c4
-rw-r--r--src/examples/ecore/efl_net_control_example.c2
-rw-r--r--src/examples/ecore/efl_net_dialer_simple_example.c2
-rw-r--r--src/examples/ecore/efl_net_ip_address_example.c8
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.c8
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.eo5
-rw-r--r--src/lib/ecore/efl_io_copier.c15
-rw-r--r--src/lib/ecore/efl_io_copier.eo5
-rw-r--r--src/lib/ecore_con/efl_net_dialer_simple.c18
-rw-r--r--src/lib/ecore_con/efl_net_ip_address.c17
-rw-r--r--src/lib/ecore_con/efl_net_ip_address.eo3
-rw-r--r--src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c56
14 files changed, 71 insertions, 76 deletions
diff --git a/src/examples/ecore/efl_io_buffered_stream_example.c b/src/examples/ecore/efl_io_buffered_stream_example.c
index 9e1a7ec7f1..1017b2731e 100644
--- a/src/examples/ecore/efl_io_buffered_stream_example.c
+++ b/src/examples/ecore/efl_io_buffered_stream_example.c
@@ -266,7 +266,7 @@ main(int argc, char **argv)
266 stream = efl_add(EFL_IO_BUFFERED_STREAM_CLASS, loop, 266 stream = efl_add(EFL_IO_BUFFERED_STREAM_CLASS, loop,
267 efl_name_set(efl_added, "stream"), 267 efl_name_set(efl_added, "stream"),
268 efl_io_buffered_stream_inner_io_set(efl_added, dialer), /* mandatory! */ 268 efl_io_buffered_stream_inner_io_set(efl_added, dialer), /* mandatory! */
269 efl_io_buffered_stream_line_delimiter_set(efl_added, &line_delimiter), 269 efl_io_buffered_stream_line_delimiter_set(efl_added, line_delimiter),
270 efl_io_buffered_stream_max_queue_size_input_set(efl_added, buffer_limit), 270 efl_io_buffered_stream_max_queue_size_input_set(efl_added, buffer_limit),
271 efl_io_buffered_stream_max_queue_size_output_set(efl_added, buffer_limit), 271 efl_io_buffered_stream_max_queue_size_output_set(efl_added, buffer_limit),
272 efl_event_callback_array_add(efl_added, stream_cbs(), NULL)); 272 efl_event_callback_array_add(efl_added, stream_cbs(), NULL));
diff --git a/src/examples/ecore/efl_io_copier_example.c b/src/examples/ecore/efl_io_copier_example.c
index 50295bf30c..5e5cbebc66 100644
--- a/src/examples/ecore/efl_io_copier_example.c
+++ b/src/examples/ecore/efl_io_copier_example.c
@@ -880,7 +880,7 @@ main(int argc, char **argv)
880 copier = efl_add(EFL_IO_COPIER_CLASS, ecore_main_loop_get(), 880 copier = efl_add(EFL_IO_COPIER_CLASS, ecore_main_loop_get(),
881 efl_io_copier_source_set(efl_added, input), /* mandatory */ 881 efl_io_copier_source_set(efl_added, input), /* mandatory */
882 efl_io_copier_destination_set(efl_added, output), /* optional, see :none: */ 882 efl_io_copier_destination_set(efl_added, output), /* optional, see :none: */
883 efl_io_copier_line_delimiter_set(efl_added, &line_delm_slice), /* optional */ 883 efl_io_copier_line_delimiter_set(efl_added, line_delm_slice), /* optional */
884 efl_io_copier_buffer_limit_set(efl_added, buffer_limit), /* optional, defaults to unlimited */ 884 efl_io_copier_buffer_limit_set(efl_added, buffer_limit), /* optional, defaults to unlimited */
885 efl_io_copier_read_chunk_size_set(efl_added, read_chunk_size), /* optional, defaults to 4096 */ 885 efl_io_copier_read_chunk_size_set(efl_added, read_chunk_size), /* optional, defaults to 4096 */
886 efl_io_copier_timeout_inactivity_set(efl_added, timeout), /* optional, defaults to 0.0 (disabled) */ 886 efl_io_copier_timeout_inactivity_set(efl_added, timeout), /* optional, defaults to 0.0 (disabled) */
diff --git a/src/examples/ecore/efl_io_queue_example.c b/src/examples/ecore/efl_io_queue_example.c
index d1097efe36..8242a71e3b 100644
--- a/src/examples/ecore/efl_io_queue_example.c
+++ b/src/examples/ecore/efl_io_queue_example.c
@@ -301,7 +301,7 @@ main(int argc, char **argv)
301 /* sender: send_queue->network */ 301 /* sender: send_queue->network */
302 sender = efl_add(EFL_IO_COPIER_CLASS, loop, 302 sender = efl_add(EFL_IO_COPIER_CLASS, loop,
303 efl_name_set(efl_added, "sender"), 303 efl_name_set(efl_added, "sender"),
304 efl_io_copier_line_delimiter_set(efl_added, &line_delimiter), 304 efl_io_copier_line_delimiter_set(efl_added, line_delimiter),
305 efl_io_copier_source_set(efl_added, send_queue), 305 efl_io_copier_source_set(efl_added, send_queue),
306 efl_io_copier_destination_set(efl_added, dialer), 306 efl_io_copier_destination_set(efl_added, dialer),
307 efl_event_callback_array_add(efl_added, copier_cbs(), NULL)); 307 efl_event_callback_array_add(efl_added, copier_cbs(), NULL));
@@ -315,7 +315,7 @@ main(int argc, char **argv)
315 /* receiver: network->receive_queue */ 315 /* receiver: network->receive_queue */
316 receiver = efl_add(EFL_IO_COPIER_CLASS, loop, 316 receiver = efl_add(EFL_IO_COPIER_CLASS, loop,
317 efl_name_set(efl_added, "receiver"), 317 efl_name_set(efl_added, "receiver"),
318 efl_io_copier_line_delimiter_set(efl_added, &line_delimiter), 318 efl_io_copier_line_delimiter_set(efl_added, line_delimiter),
319 efl_io_copier_source_set(efl_added, dialer), 319 efl_io_copier_source_set(efl_added, dialer),
320 efl_io_copier_destination_set(efl_added, receive_queue), 320 efl_io_copier_destination_set(efl_added, receive_queue),
321 efl_event_callback_array_add(efl_added, copier_cbs(), NULL)); 321 efl_event_callback_array_add(efl_added, copier_cbs(), NULL));
diff --git a/src/examples/ecore/efl_net_control_example.c b/src/examples/ecore/efl_net_control_example.c
index 5d5efa5c0c..952d0d9b98 100644
--- a/src/examples/ecore/efl_net_control_example.c
+++ b/src/examples/ecore/efl_net_control_example.c
@@ -1416,7 +1416,7 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1416 input = efl_add(EFL_IO_STDIN_CLASS, ecore_main_loop_get()); 1416 input = efl_add(EFL_IO_STDIN_CLASS, ecore_main_loop_get());
1417 copier = efl_add(EFL_IO_COPIER_CLASS, ecore_main_loop_get(), 1417 copier = efl_add(EFL_IO_COPIER_CLASS, ecore_main_loop_get(),
1418 efl_io_copier_source_set(efl_added, input), 1418 efl_io_copier_source_set(efl_added, input),
1419 efl_io_copier_line_delimiter_set(efl_added, &line_delimiter), 1419 efl_io_copier_line_delimiter_set(efl_added, line_delimiter),
1420 efl_io_copier_buffer_limit_set(efl_added, 8192), 1420 efl_io_copier_buffer_limit_set(efl_added, 8192),
1421 efl_io_copier_read_chunk_size_set(efl_added, 8192), 1421 efl_io_copier_read_chunk_size_set(efl_added, 8192),
1422 efl_event_callback_add(efl_added, EFL_IO_COPIER_EVENT_LINE, _cmd_line, ctl)); 1422 efl_event_callback_add(efl_added, EFL_IO_COPIER_EVENT_LINE, _cmd_line, ctl));
diff --git a/src/examples/ecore/efl_net_dialer_simple_example.c b/src/examples/ecore/efl_net_dialer_simple_example.c
index 7411a58b84..bda865c20e 100644
--- a/src/examples/ecore/efl_net_dialer_simple_example.c
+++ b/src/examples/ecore/efl_net_dialer_simple_example.c
@@ -370,7 +370,7 @@ main(int argc, char **argv)
370 dialer = efl_add(EFL_NET_DIALER_SIMPLE_CLASS, loop, 370 dialer = efl_add(EFL_NET_DIALER_SIMPLE_CLASS, loop,
371 efl_name_set(efl_added, "dialer"), 371 efl_name_set(efl_added, "dialer"),
372 efl_net_dialer_simple_inner_class_set(efl_added, cls), /* alternatively you could create the inner dialer and set with efl_io_buffered_stream_inner_io_set() */ 372 efl_net_dialer_simple_inner_class_set(efl_added, cls), /* alternatively you could create the inner dialer and set with efl_io_buffered_stream_inner_io_set() */
373 efl_io_buffered_stream_line_delimiter_set(efl_added, &line_delm_slice), /* optional */ 373 efl_io_buffered_stream_line_delimiter_set(efl_added, line_delm_slice), /* optional */
374 efl_io_buffered_stream_max_queue_size_input_set(efl_added, buffer_limit), /* optional, defaults to unlimited */ 374 efl_io_buffered_stream_max_queue_size_input_set(efl_added, buffer_limit), /* optional, defaults to unlimited */
375 efl_io_buffered_stream_max_queue_size_output_set(efl_added, buffer_limit), /* optional, defaults to unlimited */ 375 efl_io_buffered_stream_max_queue_size_output_set(efl_added, buffer_limit), /* optional, defaults to unlimited */
376 efl_io_buffered_stream_read_chunk_size_set(efl_added, read_chunk_size), /* optional, defaults to 4096 */ 376 efl_io_buffered_stream_read_chunk_size_set(efl_added, read_chunk_size), /* optional, defaults to 4096 */
diff --git a/src/examples/ecore/efl_net_ip_address_example.c b/src/examples/ecore/efl_net_ip_address_example.c
index 8c817c44b7..37cbc2f2e5 100644
--- a/src/examples/ecore/efl_net_ip_address_example.c
+++ b/src/examples/ecore/efl_net_ip_address_example.c
@@ -12,7 +12,7 @@ static Eina_List *resolving = NULL;
12static void 12static void
13_print_ip_addr_info(const Eo *o) 13_print_ip_addr_info(const Eo *o)
14{ 14{
15 const Eina_Slice *addr; 15 Eina_Slice addr;
16 const struct sockaddr *sa; 16 const struct sockaddr *sa;
17 char buf[INET6_ADDRSTRLEN] = "?"; 17 char buf[INET6_ADDRSTRLEN] = "?";
18 uint16_t port; 18 uint16_t port;
@@ -23,9 +23,9 @@ _print_ip_addr_info(const Eo *o)
23 printf("INFO: - port: %hu\n", efl_net_ip_address_port_get(o)); 23 printf("INFO: - port: %hu\n", efl_net_ip_address_port_get(o));
24 24
25 addr = efl_net_ip_address_get(o); 25 addr = efl_net_ip_address_get(o);
26 printf("INFO: - address %zd bytes:", addr->len); 26 printf("INFO: - address %zd bytes:", addr.len);
27 for (i = 0; i < addr->len; i++) 27 for (i = 0; i < addr.len; i++)
28 printf(" %#hhx", addr->bytes[i]); 28 printf(" %#hhx", addr.bytes[i]);
29 putchar('\n'); 29 putchar('\n');
30 30
31 sa = efl_net_ip_address_sockaddr_get(o); 31 sa = efl_net_ip_address_sockaddr_get(o);
diff --git a/src/lib/ecore/efl_io_buffered_stream.c b/src/lib/ecore/efl_io_buffered_stream.c
index a54d125b2d..3b7b4d267b 100644
--- a/src/lib/ecore/efl_io_buffered_stream.c
+++ b/src/lib/ecore/efl_io_buffered_stream.c
@@ -448,20 +448,20 @@ _efl_io_buffered_stream_max_queue_size_output_get(Eo *o EINA_UNUSED, Efl_Io_Buff
448} 448}
449 449
450EOLIAN static void 450EOLIAN static void
451_efl_io_buffered_stream_line_delimiter_set(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd, const Eina_Slice *slice) 451_efl_io_buffered_stream_line_delimiter_set(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd, Eina_Slice slice)
452{ 452{
453 if (!pd->receiver) 453 if (!pd->receiver)
454 { 454 {
455 DBG("%p inner_io=%p (%s) is not Efl.Io.Reader, slice=%p ignored", o, pd->inner_io, efl_class_name_get(efl_class_get(pd->inner_io)), slice); 455 DBG("%p inner_io=%p (%s) is not Efl.Io.Reader, slice=" EINA_SLICE_FMT " ignored", o, pd->inner_io, efl_class_name_get(efl_class_get(pd->inner_io)), EINA_SLICE_PRINT(slice));
456 return; 456 return;
457 } 457 }
458 efl_io_copier_line_delimiter_set(pd->receiver, slice); 458 efl_io_copier_line_delimiter_set(pd->receiver, slice);
459} 459}
460 460
461EOLIAN static const Eina_Slice * 461EOLIAN static Eina_Slice
462_efl_io_buffered_stream_line_delimiter_get(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd) 462_efl_io_buffered_stream_line_delimiter_get(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd)
463{ 463{
464 if (!pd->receiver) return NULL; 464 if (!pd->receiver) return (Eina_Slice){};
465 return efl_io_copier_line_delimiter_get(pd->receiver); 465 return efl_io_copier_line_delimiter_get(pd->receiver);
466} 466}
467 467
diff --git a/src/lib/ecore/efl_io_buffered_stream.eo b/src/lib/ecore/efl_io_buffered_stream.eo
index e7ebcfa3b8..1e85f85f8f 100644
--- a/src/lib/ecore/efl_io_buffered_stream.eo
+++ b/src/lib/ecore/efl_io_buffered_stream.eo
@@ -84,10 +84,11 @@ class Efl.Io.Buffered_Stream (Efl.Loop_User, Efl.Io.Reader, Efl.Io.Writer, Efl.I
84 [[If set, incoming data will be checked for the delimiter and "line" events are The line may include the delimiter, unless it's end-of-stream on @.max_queue_size_input was reached.]] 84 [[If set, incoming data will be checked for the delimiter and "line" events are The line may include the delimiter, unless it's end-of-stream on @.max_queue_size_input was reached.]]
85 get { } 85 get { }
86 set { 86 set {
87 [[Change line delimiter to use. If NULL or empty, no delimiter is to be used]] 87 [[Change line delimiter to use. If empty, no delimiter is to be used]]
88 } 88 }
89 values { 89 values {
90 slice: ptr(const(Eina.Slice)); [[The contents may contain \0 and will be copied]] 90 // TODO: eolian generates wrong type for getter with const(Eina.Slice)
91 slice: Eina.Slice; [[The contents may contain \0 and will be copied]]
91 } 92 }
92 } 93 }
93 94
diff --git a/src/lib/ecore/efl_io_copier.c b/src/lib/ecore/efl_io_copier.c
index d170a19dce..b6984a2a04 100644
--- a/src/lib/ecore/efl_io_copier.c
+++ b/src/lib/ecore/efl_io_copier.c
@@ -558,32 +558,31 @@ _efl_io_copier_buffer_limit_get(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd)
558} 558}
559 559
560EOLIAN static void 560EOLIAN static void
561_efl_io_copier_line_delimiter_set(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd, const Eina_Slice *slice) 561_efl_io_copier_line_delimiter_set(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd, Eina_Slice slice)
562{ 562{
563 EINA_SAFETY_ON_NULL_RETURN(slice); 563 if (pd->line_delimiter.mem == slice.mem)
564 if (pd->line_delimiter.mem == slice->mem)
565 { 564 {
566 pd->line_delimiter.len = slice->len; 565 pd->line_delimiter.len = slice.len;
567 return; 566 return;
568 } 567 }
569 568
570 free((void *)pd->line_delimiter.mem); 569 free((void *)pd->line_delimiter.mem);
571 if (slice->len == 0) 570 if (slice.len == 0)
572 { 571 {
573 pd->line_delimiter.mem = NULL; 572 pd->line_delimiter.mem = NULL;
574 pd->line_delimiter.len = 0; 573 pd->line_delimiter.len = 0;
575 } 574 }
576 else 575 else
577 { 576 {
578 Eina_Rw_Slice rw_slice = eina_slice_dup(*slice); 577 Eina_Rw_Slice rw_slice = eina_slice_dup(slice);
579 pd->line_delimiter = eina_rw_slice_slice_get(rw_slice); 578 pd->line_delimiter = eina_rw_slice_slice_get(rw_slice);
580 } 579 }
581} 580}
582 581
583EOLIAN static const Eina_Slice * 582EOLIAN static Eina_Slice
584_efl_io_copier_line_delimiter_get(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd) 583_efl_io_copier_line_delimiter_get(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd)
585{ 584{
586 return &pd->line_delimiter; 585 return pd->line_delimiter;
587} 586}
588 587
589 588
diff --git a/src/lib/ecore/efl_io_copier.eo b/src/lib/ecore/efl_io_copier.eo
index 33567c797c..175efcb15f 100644
--- a/src/lib/ecore/efl_io_copier.eo
+++ b/src/lib/ecore/efl_io_copier.eo
@@ -189,10 +189,11 @@ class Efl.Io.Copier (Efl.Loop_User, Efl.Io.Closer) {
189 [[If there is a line delimiter, the reads will buffer/queue up to the line delimiter before calling @Efl.Io.Writer.write on the @.destination and the event line is emitted with current line. The line may include the delimiter, unless it's end-of-stream on @.source or @.buffer_limit was reached.]] 189 [[If there is a line delimiter, the reads will buffer/queue up to the line delimiter before calling @Efl.Io.Writer.write on the @.destination and the event line is emitted with current line. The line may include the delimiter, unless it's end-of-stream on @.source or @.buffer_limit was reached.]]
190 get { } 190 get { }
191 set { 191 set {
192 [[Change line delimiter to use. If NULL or empty, no delimiter is to be used]] 192 [[Change line delimiter to use. If empty, no delimiter is to be used]]
193 } 193 }
194 values { 194 values {
195 slice: ptr(const(Eina.Slice)); [[The contents may contain \0 and will be copied]] 195 // TODO: eolian generates wrong type for getter with const(Eina.Slice)
196 slice: Eina.Slice; [[The contents may contain \0 and will be copied]]
196 } 197 }
197 } 198 }
198 199
diff --git a/src/lib/ecore_con/efl_net_dialer_simple.c b/src/lib/ecore_con/efl_net_dialer_simple.c
index 317f972862..2aca537318 100644
--- a/src/lib/ecore_con/efl_net_dialer_simple.c
+++ b/src/lib/ecore_con/efl_net_dialer_simple.c
@@ -155,7 +155,7 @@ _efl_net_dialer_simple_efl_io_buffered_stream_inner_io_set(Eo *o, Efl_Net_Dialer
155 if (pd->pending.line_delimiter) 155 if (pd->pending.line_delimiter)
156 { 156 {
157 pd->pending.line_delimiter = EINA_FALSE; 157 pd->pending.line_delimiter = EINA_FALSE;
158 efl_io_buffered_stream_line_delimiter_set(o, &pd->line_delimiter); 158 efl_io_buffered_stream_line_delimiter_set(o, pd->line_delimiter);
159 free((void *)pd->line_delimiter.mem); 159 free((void *)pd->line_delimiter.mem);
160 pd->line_delimiter.mem = NULL; 160 pd->line_delimiter.mem = NULL;
161 } 161 }
@@ -313,14 +313,14 @@ _efl_net_dialer_simple_efl_io_buffered_stream_read_chunk_size_get(Eo *o, Efl_Net
313 313
314 314
315EOLIAN static void 315EOLIAN static void
316_efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_set(Eo *o, Efl_Net_Dialer_Simple_Data *pd, const Eina_Slice *slice) 316_efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_set(Eo *o, Efl_Net_Dialer_Simple_Data *pd, Eina_Slice slice)
317{ 317{
318 Eo *inner_io = efl_io_buffered_stream_inner_io_get(o); 318 Eo *inner_io = efl_io_buffered_stream_inner_io_get(o);
319 319
320 if (!inner_io) 320 if (!inner_io)
321 { 321 {
322 free((void *)pd->line_delimiter.mem); 322 free((void *)pd->line_delimiter.mem);
323 if ((!slice) || (!slice->len)) 323 if (!slice.len)
324 { 324 {
325 pd->line_delimiter.mem = NULL; 325 pd->line_delimiter.mem = NULL;
326 pd->line_delimiter.len = 0; 326 pd->line_delimiter.len = 0;
@@ -328,11 +328,11 @@ _efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_set(Eo *o, Efl_Net_
328 else 328 else
329 { 329 {
330 char *mem; 330 char *mem;
331 pd->line_delimiter.mem = mem = malloc(slice->len + 1); 331 pd->line_delimiter.mem = mem = malloc(slice.len + 1);
332 EINA_SAFETY_ON_NULL_RETURN(pd->line_delimiter.mem); 332 EINA_SAFETY_ON_NULL_RETURN(pd->line_delimiter.mem);
333 memcpy(mem, slice->mem, slice->len); 333 memcpy(mem, slice.mem, slice.len);
334 mem[slice->len] = '\0'; 334 mem[slice.len] = '\0';
335 pd->line_delimiter.len = slice->len; 335 pd->line_delimiter.len = slice.len;
336 } 336 }
337 337
338 pd->pending.line_delimiter = EINA_TRUE; 338 pd->pending.line_delimiter = EINA_TRUE;
@@ -341,11 +341,11 @@ _efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_set(Eo *o, Efl_Net_
341 efl_io_buffered_stream_line_delimiter_set(efl_super(o, MY_CLASS), slice); 341 efl_io_buffered_stream_line_delimiter_set(efl_super(o, MY_CLASS), slice);
342} 342}
343 343
344EOLIAN static const Eina_Slice * 344EOLIAN static Eina_Slice
345_efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_get(Eo *o, Efl_Net_Dialer_Simple_Data *pd) 345_efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_get(Eo *o, Efl_Net_Dialer_Simple_Data *pd)
346{ 346{
347 Eo *inner_io = efl_io_buffered_stream_inner_io_get(o); 347 Eo *inner_io = efl_io_buffered_stream_inner_io_get(o);
348 if (!inner_io) return &pd->line_delimiter; 348 if (!inner_io) return pd->line_delimiter;
349 return efl_io_buffered_stream_line_delimiter_get(efl_super(o, MY_CLASS)); 349 return efl_io_buffered_stream_line_delimiter_get(efl_super(o, MY_CLASS));
350} 350}
351 351
diff --git a/src/lib/ecore_con/efl_net_ip_address.c b/src/lib/ecore_con/efl_net_ip_address.c
index e76a3834aa..569b18d13e 100644
--- a/src/lib/ecore_con/efl_net_ip_address.c
+++ b/src/lib/ecore_con/efl_net_ip_address.c
@@ -126,20 +126,19 @@ _efl_net_ip_address_port_get(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd)
126} 126}
127 127
128EOLIAN static void 128EOLIAN static void
129_efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, const Eina_Slice *address) 129_efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, Eina_Slice address)
130{ 130{
131 Eina_Rw_Slice rw_slice; 131 Eina_Rw_Slice rw_slice;
132 size_t i; 132 size_t i;
133 133
134 EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0); 134 EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0);
135 EINA_SAFETY_ON_NULL_RETURN(address);
136 135
137 rw_slice.mem = (void *)pd->addr_slice.mem; 136 rw_slice.mem = (void *)pd->addr_slice.mem;
138 rw_slice.len = pd->addr_slice.len; 137 rw_slice.len = pd->addr_slice.len;
139 138
140 EINA_SAFETY_ON_TRUE_RETURN(rw_slice.len != address->len); 139 EINA_SAFETY_ON_TRUE_RETURN(rw_slice.len != address.len);
141 140
142 if (eina_slice_compare(eina_rw_slice_slice_get(rw_slice), *address) == 0) 141 if (eina_slice_compare(eina_rw_slice_slice_get(rw_slice), address) == 0)
143 return; 142 return;
144 143
145 for (i = 0; i < rw_slice.len; i++) 144 for (i = 0; i < rw_slice.len; i++)
@@ -154,7 +153,7 @@ _efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd,
154 old_str[0] = '?'; 153 old_str[0] = '?';
155 old_str[1] = '\0'; 154 old_str[1] = '\0';
156 } 155 }
157 if (!inet_ntop(pd->addr.sa_family, address->mem, new_str, sizeof(new_str))) 156 if (!inet_ntop(pd->addr.sa_family, address.mem, new_str, sizeof(new_str)))
158 { 157 {
159 new_str[0] = '?'; 158 new_str[0] = '?';
160 new_str[1] = '\0'; 159 new_str[1] = '\0';
@@ -164,13 +163,13 @@ _efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd,
164 } 163 }
165 } 164 }
166 165
167 eina_rw_slice_copy(rw_slice, *address); 166 eina_rw_slice_copy(rw_slice, address);
168} 167}
169 168
170EOLIAN static const Eina_Slice * 169EOLIAN static Eina_Slice
171_efl_net_ip_address_address_get(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd) 170_efl_net_ip_address_address_get(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd)
172{ 171{
173 return &pd->addr_slice; 172 return pd->addr_slice;
174} 173}
175 174
176EOLIAN static void 175EOLIAN static void
@@ -304,7 +303,7 @@ _efl_net_ip_address_create(Eo *cls, void *pd EINA_UNUSED, uint16_t port, const E
304 return efl_add(cls, NULL, 303 return efl_add(cls, NULL,
305 efl_net_ip_address_family_set(efl_added, family), 304 efl_net_ip_address_family_set(efl_added, family),
306 efl_net_ip_address_port_set(efl_added, port), 305 efl_net_ip_address_port_set(efl_added, port),
307 efl_net_ip_address_set(efl_added, &address)); 306 efl_net_ip_address_set(efl_added, address));
308} 307}
309 308
310EOLIAN static Efl_Net_Ip_Address * 309EOLIAN static Efl_Net_Ip_Address *
diff --git a/src/lib/ecore_con/efl_net_ip_address.eo b/src/lib/ecore_con/efl_net_ip_address.eo
index a9e2d7b3e3..e70b578038 100644
--- a/src/lib/ecore_con/efl_net_ip_address.eo
+++ b/src/lib/ecore_con/efl_net_ip_address.eo
@@ -161,7 +161,8 @@ class Efl.Net.Ip.Address (Efl.Object) {
161 Must be set after @.family. 161 Must be set after @.family.
162 ]] 162 ]]
163 values { 163 values {
164 address: const(ptr(Eina.Slice)) @nonull; [[Address bytes. If AF_INET it's 4 bytes. If AF_INET6, it's 16 bytes. This matches exactly what is in struct sockaddr_in::sin_addr or struct sockaddr_in6:sin6_addr, see @.sockaddr]] 164 // TODO: eolian generates wrong type for getter with const(Eina.Slice)
165 address: Eina.Slice; [[Address bytes. If AF_INET it's 4 bytes. If AF_INET6, it's 16 bytes. This matches exactly what is in struct sockaddr_in::sin_addr or struct sockaddr_in6:sin6_addr, see @.sockaddr]]
165 } 166 }
166 } 167 }
167 168
diff --git a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
index cd2999ce57..9eda9ddf3d 100644
--- a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
+++ b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
@@ -268,7 +268,7 @@ static void
268_ipv4_check(Eo *o, const struct sockaddr_in *addr) 268_ipv4_check(Eo *o, const struct sockaddr_in *addr)
269{ 269{
270 Eina_Slice slice = { .mem = &addr->sin_addr, .len = sizeof(addr->sin_addr) }; 270 Eina_Slice slice = { .mem = &addr->sin_addr, .len = sizeof(addr->sin_addr) };
271 const Eina_Slice *rs; 271 Eina_Slice rs;
272 char buf[INET_ADDRSTRLEN + sizeof(":65536")] = ""; 272 char buf[INET_ADDRSTRLEN + sizeof(":65536")] = "";
273 273
274 ck_assert_ptr_ne(o, NULL); 274 ck_assert_ptr_ne(o, NULL);
@@ -277,8 +277,7 @@ _ipv4_check(Eo *o, const struct sockaddr_in *addr)
277 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin_port)); 277 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin_port));
278 278
279 rs = efl_net_ip_address_get(o); 279 rs = efl_net_ip_address_get(o);
280 ck_assert_ptr_ne(rs, NULL); 280 ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
281 ck_assert_int_eq(eina_slice_compare(*rs, slice), 0);
282 281
283 inet_ntop(AF_INET, slice.mem, buf, INET_ADDRSTRLEN); 282 inet_ntop(AF_INET, slice.mem, buf, INET_ADDRSTRLEN);
284 283
@@ -306,7 +305,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_ok)
306 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 305 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
307 efl_net_ip_address_family_set(efl_added, AF_INET), 306 efl_net_ip_address_family_set(efl_added, AF_INET),
308 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 307 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
309 efl_net_ip_address_set(efl_added, &slice)); 308 efl_net_ip_address_set(efl_added, slice));
310 _ipv4_check(o, &addr); 309 _ipv4_check(o, &addr);
311 efl_del(o); 310 efl_del(o);
312 311
@@ -315,7 +314,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_ok)
315 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 314 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
316 efl_net_ip_address_family_set(efl_added, AF_INET), 315 efl_net_ip_address_family_set(efl_added, AF_INET),
317 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 316 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
318 efl_net_ip_address_set(efl_added, &slice)); 317 efl_net_ip_address_set(efl_added, slice));
319 _ipv4_check(o, &addr); 318 _ipv4_check(o, &addr);
320 efl_del(o); 319 efl_del(o);
321 320
@@ -323,7 +322,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_ok)
323 addr.sin_addr.s_addr = htonl(0x12345678); 322 addr.sin_addr.s_addr = htonl(0x12345678);
324 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 323 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
325 efl_net_ip_address_family_set(efl_added, AF_INET), 324 efl_net_ip_address_family_set(efl_added, AF_INET),
326 efl_net_ip_address_set(efl_added, &slice)); 325 efl_net_ip_address_set(efl_added, slice));
327 _ipv4_check(o, &addr); 326 _ipv4_check(o, &addr);
328 efl_del(o); 327 efl_del(o);
329 328
@@ -356,7 +355,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
356 355
357 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 356 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
358 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 357 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
359 efl_net_ip_address_set(efl_added, &wrong_slice)); 358 efl_net_ip_address_set(efl_added, wrong_slice));
360 ck_assert_ptr_eq(o, NULL); 359 ck_assert_ptr_eq(o, NULL);
361 TRAP_ERRORS_FINISH(2); 360 TRAP_ERRORS_FINISH(2);
362 361
@@ -369,14 +368,14 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
369 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 368 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
370 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 369 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
371 efl_net_ip_address_port_set(efl_added, 1234), 370 efl_net_ip_address_port_set(efl_added, 1234),
372 efl_net_ip_address_set(efl_added, &wrong_slice)); 371 efl_net_ip_address_set(efl_added, wrong_slice));
373 ck_assert_ptr_eq(o, NULL); 372 ck_assert_ptr_eq(o, NULL);
374 TRAP_ERRORS_FINISH(3); 373 TRAP_ERRORS_FINISH(3);
375 374
376 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address->len is true"); 375 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
377 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 376 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
378 efl_net_ip_address_family_set(efl_added, AF_INET), 377 efl_net_ip_address_family_set(efl_added, AF_INET),
379 efl_net_ip_address_set(efl_added, &wrong_slice)); 378 efl_net_ip_address_set(efl_added, wrong_slice));
380 _ipv4_check(o, &addr); 379 _ipv4_check(o, &addr);
381 efl_del(o); 380 efl_del(o);
382 TRAP_ERRORS_FINISH(1); 381 TRAP_ERRORS_FINISH(1);
@@ -386,7 +385,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
386 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 385 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
387 efl_net_ip_address_family_set(efl_added, AF_INET), 386 efl_net_ip_address_family_set(efl_added, AF_INET),
388 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 387 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
389 efl_net_ip_address_set(efl_added, &slice)); 388 efl_net_ip_address_set(efl_added, slice));
390 _ipv4_check(o, &addr); 389 _ipv4_check(o, &addr);
391 390
392 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 391 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
@@ -397,24 +396,20 @@ START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
397 efl_net_ip_address_port_set(o, 999); 396 efl_net_ip_address_port_set(o, 999);
398 TRAP_ERRORS_FINISH(1); 397 TRAP_ERRORS_FINISH(1);
399 398
400 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: address == NULL"); 399 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
401 efl_net_ip_address_set(o, NULL);
402 TRAP_ERRORS_FINISH(1);
403
404 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address->len is true");
405 slice.len = 1; 400 slice.len = 1;
406 efl_net_ip_address_set(o, &slice); 401 efl_net_ip_address_set(o, slice);
407 TRAP_ERRORS_FINISH(1); 402 TRAP_ERRORS_FINISH(1);
408 403
409 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s"); 404 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
410 slice.len = sizeof(addr.sin_addr.s_addr); 405 slice.len = sizeof(addr.sin_addr.s_addr);
411 efl_net_ip_address_set(o, &slice); 406 efl_net_ip_address_set(o, slice);
412 TRAP_ERRORS_FINISH(0); 407 TRAP_ERRORS_FINISH(0);
413 408
414 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s"); 409 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
415 addr.sin_addr.s_addr = htonl(0x12345678); 410 addr.sin_addr.s_addr = htonl(0x12345678);
416 slice.len = sizeof(addr.sin_addr.s_addr); 411 slice.len = sizeof(addr.sin_addr.s_addr);
417 efl_net_ip_address_set(o, &slice); 412 efl_net_ip_address_set(o, slice);
418 TRAP_ERRORS_FINISH(1); 413 TRAP_ERRORS_FINISH(1);
419 414
420 efl_del(o); 415 efl_del(o);
@@ -729,7 +724,7 @@ static void
729_ipv6_check(Eo *o, const struct sockaddr_in6 *addr) 724_ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
730{ 725{
731 Eina_Slice slice = { .mem = &addr->sin6_addr, .len = sizeof(addr->sin6_addr) }; 726 Eina_Slice slice = { .mem = &addr->sin6_addr, .len = sizeof(addr->sin6_addr) };
732 const Eina_Slice *rs; 727 Eina_Slice rs;
733 char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")] = ""; 728 char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")] = "";
734 729
735 ck_assert_ptr_ne(o, NULL); 730 ck_assert_ptr_ne(o, NULL);
@@ -738,8 +733,7 @@ _ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
738 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin6_port)); 733 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin6_port));
739 734
740 rs = efl_net_ip_address_get(o); 735 rs = efl_net_ip_address_get(o);
741 ck_assert_ptr_ne(rs, NULL); 736 ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
742 ck_assert_int_eq(eina_slice_compare(*rs, slice), 0);
743 737
744 buf[0] = '['; 738 buf[0] = '[';
745 inet_ntop(AF_INET6, slice.mem, buf + 1, INET6_ADDRSTRLEN); 739 inet_ntop(AF_INET6, slice.mem, buf + 1, INET6_ADDRSTRLEN);
@@ -777,7 +771,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_ok)
777 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 771 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
778 efl_net_ip_address_family_set(efl_added, AF_INET6), 772 efl_net_ip_address_family_set(efl_added, AF_INET6),
779 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 773 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
780 efl_net_ip_address_set(efl_added, &slice)); 774 efl_net_ip_address_set(efl_added, slice));
781 _ipv6_check(o, &addr); 775 _ipv6_check(o, &addr);
782 efl_del(o); 776 efl_del(o);
783 777
@@ -786,7 +780,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_ok)
786 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 780 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
787 efl_net_ip_address_family_set(efl_added, AF_INET6), 781 efl_net_ip_address_family_set(efl_added, AF_INET6),
788 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 782 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
789 efl_net_ip_address_set(efl_added, &slice)); 783 efl_net_ip_address_set(efl_added, slice));
790 _ipv6_check(o, &addr); 784 _ipv6_check(o, &addr);
791 efl_del(o); 785 efl_del(o);
792 786
@@ -808,10 +802,10 @@ START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
808 802
809 /* generic errors checked at ecore_test_efl_net_ip_address_ipv4_manual_fail */ 803 /* generic errors checked at ecore_test_efl_net_ip_address_ipv4_manual_fail */
810 804
811 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address->len is true"); 805 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
812 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 806 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
813 efl_net_ip_address_family_set(efl_added, AF_INET6), 807 efl_net_ip_address_family_set(efl_added, AF_INET6),
814 efl_net_ip_address_set(efl_added, &wrong_slice)); 808 efl_net_ip_address_set(efl_added, wrong_slice));
815 _ipv6_check(o, &addr); 809 _ipv6_check(o, &addr);
816 efl_del(o); 810 efl_del(o);
817 TRAP_ERRORS_FINISH(1); 811 TRAP_ERRORS_FINISH(1);
@@ -821,7 +815,7 @@ START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
821 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL, 815 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, NULL,
822 efl_net_ip_address_family_set(efl_added, AF_INET6), 816 efl_net_ip_address_family_set(efl_added, AF_INET6),
823 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 817 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
824 efl_net_ip_address_set(efl_added, &slice)); 818 efl_net_ip_address_set(efl_added, slice));
825 _ipv6_check(o, &addr); 819 _ipv6_check(o, &addr);
826 820
827 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 821 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
@@ -832,20 +826,20 @@ START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
832 efl_net_ip_address_port_set(o, 999); 826 efl_net_ip_address_port_set(o, 999);
833 TRAP_ERRORS_FINISH(1); 827 TRAP_ERRORS_FINISH(1);
834 828
835 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address->len is true"); 829 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
836 slice.len = 1; 830 slice.len = 1;
837 efl_net_ip_address_set(o, &slice); 831 efl_net_ip_address_set(o, slice);
838 TRAP_ERRORS_FINISH(1); 832 TRAP_ERRORS_FINISH(1);
839 833
840 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s"); 834 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
841 slice.len = sizeof(addr.sin6_addr); 835 slice.len = sizeof(addr.sin6_addr);
842 efl_net_ip_address_set(o, &slice); 836 efl_net_ip_address_set(o, slice);
843 TRAP_ERRORS_FINISH(0); 837 TRAP_ERRORS_FINISH(0);
844 838
845 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s"); 839 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
846 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8); 840 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
847 slice.len = sizeof(addr.sin6_addr); 841 slice.len = sizeof(addr.sin6_addr);
848 efl_net_ip_address_set(o, &slice); 842 efl_net_ip_address_set(o, slice);
849 TRAP_ERRORS_FINISH(1); 843 TRAP_ERRORS_FINISH(1);
850 844
851 efl_del(o); 845 efl_del(o);