On Thu, 18 Nov 2010 10:04:29 +0100
Cedric BAIL <cedric.b...@free.fr> wrote:

> On Thu, Nov 18, 2010 at 4:39 AM, Mike Blumenkrantz <m...@zentific.com> wrote:
> > eet_read/write_cipher() are broken now when calling them directly (with and
> > without compression from my tests), I'm unable to read back data that has
> > been written. Should be the same in all cases, though I can provide an
> > example using small strings if you can't reproduce.
> 
> Yes provide a sample code please. A simple test is present in the eet
> tests suite and it work. So it's sounds like an interesting
> combination of parameter that trigger it.
Nothing very interesting about this, just simple use of ciphers.

-- 
Mike Blumenkrantz
Zentific: Our boolean values are huge.
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <Eet.h>

static char *cipher = "1234851713";
static char *file = "test.eet";

static Eina_Bool
_main_eet_read(void)
{
   Eet_File *ef;
   struct stat st;
   int size, size2;
   char *ret, *ret2;
   
   if (stat(file, &st) < 0)
     {
        printf("fail\n");
        return EINA_FALSE;
     }
   if (!S_ISREG(st.st_mode))
     {
        printf("fail\n");
        return EINA_FALSE;
     }   

   ef = eet_open(file, EET_FILE_MODE_READ);
   if (!ef)
     {
        printf("fail\n");
        return EINA_FALSE;
     }
   ret = (char*)eet_read_cipher(ef, "test1", &size, cipher);
   ret2 = (char*)eet_read_cipher(ef, "test2", &size2, cipher);

   eet_close(ef);
   if ((!ret) || (!ret2))
     {
        printf("fail\n");
        if (ret)
          free(ret);
        else if (ret2)
          free(ret2);
        unlink(file);
        return EINA_FALSE;
     }
   printf("read %s and %s\n", ret, ret2);
   free(ret);
   free(ret2);
   return EINA_TRUE;
}

static void
_main_eet_write(const char *test1, const char *test2)
{
   Eet_File *ef;
   int ret;

   ef = eet_open(file, EET_FILE_MODE_WRITE);
   if (!ef)
     {
        printf("fail\n");
        return;
     }
   ret = eet_write_cipher(ef, "test1", test1, strlen(test1), EINA_TRUE, cipher);
   if (!ret)
     {
        printf("fail\n");
        goto error;
     }
   ret = eet_write_cipher(ef, "test2", test2, strlen(test2), EINA_TRUE, cipher);

   if (!ret)
     {
        printf("fail\n");
        goto error;
     }
   eet_sync(ef);
   eet_close(ef);
   printf("wrote %s and %s\n", test1, test2);
   return;

error:
   eet_close(ef);
   unlink(file);
}

int
main(void)
{
   eina_init();
   eet_init();
   _main_eet_read();
   _main_eet_write("tests", "arefun");

   return 0;
}
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to