Hello,

I'm writing test for eina_value_convert
Almost all are ok, but I tried to check overflow handling and see
strange results:

<code>
START_TEST(eina_value_test_convert_short)
{
   Eina_Value *value, conv;
   short s;
   const char *str;

   eina_init();

   value = eina_value_new(EINA_VALUE_TYPE_SHORT);
   fail_unless(value != NULL);

   // value too big and will be truncated
   fail_unless(eina_value_set(value, 0x1e240)); // after this set
value will be truncated to 0xe240 because of line 385 in file:
eina_inline_value.x
                                                                   //
short *tmem = (short *) mem;
   fail_unless(eina_value_get(&value, &s)); // and this line then
produce error, but why?

   fail_unless(eina_value_setup(&conv, EINA_VALUE_TYPE_STRING));
   fail_unless(eina_value_convert(value, &conv));
   fail_unless(eina_value_get(&conv, &str)); // in this line str == "-7616"
   fail_unless(str != NULL);

......
</code>

Is it correct behaviour that value 0x1e240 is truncated to 0xe240 and
if this is true why eina_value_get(&value, &s) returns false?
Maybe need to insert addtional checks for overflow?

Vlad

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to