aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eet/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-22 09:19:23 +1000
committerDavid Walter Seikel2012-04-22 09:19:23 +1000
commitc963d75dfdeec11f82e79e727062fbf89afa2c04 (patch)
tree895633dbf641110be46f117c29890c49b3ffc0bd /libraries/eet/src
parentAdding the new extantz viewer and grid manager. (diff)
downloadSledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2
SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz
Update EFL to latest beta.
Diffstat (limited to 'libraries/eet/src')
-rw-r--r--libraries/eet/src/Makefile.in4
-rw-r--r--libraries/eet/src/bin/Makefile.am2
-rw-r--r--libraries/eet/src/bin/Makefile.in6
-rw-r--r--libraries/eet/src/bin/eet_main.c60
-rw-r--r--libraries/eet/src/examples/Makefile.in4
-rw-r--r--libraries/eet/src/lib/Eet.h17
-rw-r--r--libraries/eet/src/lib/Makefile.in4
-rw-r--r--libraries/eet/src/lib/eet_alloc.c2
-rw-r--r--libraries/eet/src/lib/eet_cipher.c71
-rw-r--r--libraries/eet/src/lib/eet_data.c21
-rw-r--r--libraries/eet/src/lib/eet_dictionary.c6
-rw-r--r--libraries/eet/src/lib/eet_image.c19
-rw-r--r--libraries/eet/src/tests/Makefile.in4
-rw-r--r--libraries/eet/src/tests/eet_suite.c2
14 files changed, 178 insertions, 44 deletions
diff --git a/libraries/eet/src/Makefile.in b/libraries/eet/src/Makefile.in
index 8b2aa37..bfdc4f6 100644
--- a/libraries/eet/src/Makefile.in
+++ b/libraries/eet/src/Makefile.in
@@ -143,6 +143,8 @@ EINA_LIBS = @EINA_LIBS@
143EVIL_CFLAGS = @EVIL_CFLAGS@ 143EVIL_CFLAGS = @EVIL_CFLAGS@
144EVIL_LIBS = @EVIL_LIBS@ 144EVIL_LIBS = @EVIL_LIBS@
145EXEEXT = @EXEEXT@ 145EXEEXT = @EXEEXT@
146EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
147EXOTIC_LIBS = @EXOTIC_LIBS@
146FGREP = @FGREP@ 148FGREP = @FGREP@
147GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ 149GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
148GNUTLS_LIBS = @GNUTLS_LIBS@ 150GNUTLS_LIBS = @GNUTLS_LIBS@
@@ -182,6 +184,8 @@ PACKAGE_URL = @PACKAGE_URL@
182PACKAGE_VERSION = @PACKAGE_VERSION@ 184PACKAGE_VERSION = @PACKAGE_VERSION@
183PATH_SEPARATOR = @PATH_SEPARATOR@ 185PATH_SEPARATOR = @PATH_SEPARATOR@
184PKG_CONFIG = @PKG_CONFIG@ 186PKG_CONFIG = @PKG_CONFIG@
187PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
188PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
185RANLIB = @RANLIB@ 189RANLIB = @RANLIB@
186SED = @SED@ 190SED = @SED@
187SET_MAKE = @SET_MAKE@ 191SET_MAKE = @SET_MAKE@
diff --git a/libraries/eet/src/bin/Makefile.am b/libraries/eet/src/bin/Makefile.am
index ba7d67e..89c68f1 100644
--- a/libraries/eet/src/bin/Makefile.am
+++ b/libraries/eet/src/bin/Makefile.am
@@ -17,5 +17,5 @@ EXTRA_PROGRAMS = eet
17 17
18eet_SOURCES = eet_main.c 18eet_SOURCES = eet_main.c
19eet_CFLAGS = @EET_CFLAGS@ 19eet_CFLAGS = @EET_CFLAGS@
20eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ 20eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ @EXOTIC_LIBS@
21eet_LDFLAGS = @lt_enable_auto_import@ 21eet_LDFLAGS = @lt_enable_auto_import@
diff --git a/libraries/eet/src/bin/Makefile.in b/libraries/eet/src/bin/Makefile.in
index 4a899f5..a7e94cb 100644
--- a/libraries/eet/src/bin/Makefile.in
+++ b/libraries/eet/src/bin/Makefile.in
@@ -138,6 +138,8 @@ EINA_LIBS = @EINA_LIBS@
138EVIL_CFLAGS = @EVIL_CFLAGS@ 138EVIL_CFLAGS = @EVIL_CFLAGS@
139EVIL_LIBS = @EVIL_LIBS@ 139EVIL_LIBS = @EVIL_LIBS@
140EXEEXT = @EXEEXT@ 140EXEEXT = @EXEEXT@
141EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
142EXOTIC_LIBS = @EXOTIC_LIBS@
141FGREP = @FGREP@ 143FGREP = @FGREP@
142GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ 144GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
143GNUTLS_LIBS = @GNUTLS_LIBS@ 145GNUTLS_LIBS = @GNUTLS_LIBS@
@@ -177,6 +179,8 @@ PACKAGE_URL = @PACKAGE_URL@
177PACKAGE_VERSION = @PACKAGE_VERSION@ 179PACKAGE_VERSION = @PACKAGE_VERSION@
178PATH_SEPARATOR = @PATH_SEPARATOR@ 180PATH_SEPARATOR = @PATH_SEPARATOR@
179PKG_CONFIG = @PKG_CONFIG@ 181PKG_CONFIG = @PKG_CONFIG@
182PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
183PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
180RANLIB = @RANLIB@ 184RANLIB = @RANLIB@
181SED = @SED@ 185SED = @SED@
182SET_MAKE = @SET_MAKE@ 186SET_MAKE = @SET_MAKE@
@@ -259,7 +263,7 @@ AM_CPPFLAGS = \
259bin_PROGRAMS = @EET_PRG@ 263bin_PROGRAMS = @EET_PRG@
260eet_SOURCES = eet_main.c 264eet_SOURCES = eet_main.c
261eet_CFLAGS = @EET_CFLAGS@ 265eet_CFLAGS = @EET_CFLAGS@
262eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ 266eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@ @EXOTIC_LIBS@
263eet_LDFLAGS = @lt_enable_auto_import@ 267eet_LDFLAGS = @lt_enable_auto_import@
264all: all-am 268all: all-am
265 269
diff --git a/libraries/eet/src/bin/eet_main.c b/libraries/eet/src/bin/eet_main.c
index 0d577ad..8a93d11 100644
--- a/libraries/eet/src/bin/eet_main.c
+++ b/libraries/eet/src/bin/eet_main.c
@@ -69,6 +69,63 @@ do_eet_list(const char *file)
69} /* do_eet_list */ 69} /* do_eet_list */
70 70
71static void 71static void
72do_eet_stats(const char *file)
73{
74 int i, num;
75 int count[2] = { 0, 0 };
76 int size[2] = { 0, 0 };
77 char **list;
78 Eet_File *ef;
79 Eet_Dictionary *ed;
80
81 ef = eet_open(file, EET_FILE_MODE_READ);
82 if (!ef)
83 {
84 ERR("cannot open for reading: %s", file);
85 exit(-1);
86 }
87
88 printf("*** sections stats ***\n");
89 list = eet_list(ef, "*", &num);
90 if (list)
91 {
92 for (i = 0; i < num; i++)
93 {
94 const void *ro = NULL;
95 void *rw = NULL;
96 int tsize;
97
98 ro = eet_read_direct(ef, list[i], &tsize);
99 if (!ro) rw = eet_read(ef, list[i], &tsize);
100 printf(rw ? "%s of size %i is compressed.\n" : "%s of size %i is not compressed.\n", list[i], tsize);
101 count[rw ? 0 : 1]++;
102 size[rw ? 0 : 1] += tsize;
103 free(rw);
104 }
105 free(list);
106 }
107
108 printf("*** dictionary ***\n");
109 ed = eet_dictionary_get(ef);
110 if (ed)
111 {
112 printf("%i strings inside the dictionary.\n", eet_dictionary_count(ed));
113 }
114 else
115 {
116 printf("no dictionary in this file.\n");
117 }
118 printf("*** global ***\n");
119 printf("%i sections\n", num);
120 printf("- %i of them are compressed (%02.2f%%) expanding in %i bytes.\n",
121 count[0], (float) count[0] * 100 / (float) num, size[0]);
122 printf("- %i of them are directly mappable in memory (%02.2f%%) representing %i bytes.\n",
123 count[1], (float) count[1] * 100 / (float) num, size[1]);
124
125 eet_close(ef);
126}
127
128static void
72do_eet_extract(const char *file, 129do_eet_extract(const char *file,
73 const char *key, 130 const char *key,
74 const char *out, 131 const char *out,
@@ -366,6 +423,7 @@ help:
366 " eet -r FILE.EET KEY remove KEY in FILE.EET\n" 423 " eet -r FILE.EET KEY remove KEY in FILE.EET\n"
367 " eet -c FILE.EET report and check the signature information of an eet file\n" 424 " eet -c FILE.EET report and check the signature information of an eet file\n"
368 " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n" 425 " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n"
426 " eet -t FILE.EET give some statistic about a file\n"
369 ); 427 );
370 eet_shutdown(); 428 eet_shutdown();
371 return -1; 429 return -1;
@@ -437,6 +495,8 @@ help:
437 do_eet_check(argv[2]); 495 do_eet_check(argv[2]);
438 else if ((!strcmp(argv[1], "-s")) && (argc > 4)) 496 else if ((!strcmp(argv[1], "-s")) && (argc > 4))
439 do_eet_sign(argv[2], argv[3], argv[4]); 497 do_eet_sign(argv[2], argv[3], argv[4]);
498 else if ((!strcmp(argv[1], "-t")) && (argc > 2))
499 do_eet_stats(argv[2]);
440 else 500 else
441 goto help; 501 goto help;
442 502
diff --git a/libraries/eet/src/examples/Makefile.in b/libraries/eet/src/examples/Makefile.in
index 5830132..1e979ab 100644
--- a/libraries/eet/src/examples/Makefile.in
+++ b/libraries/eet/src/examples/Makefile.in
@@ -226,6 +226,8 @@ EINA_LIBS = @EINA_LIBS@
226EVIL_CFLAGS = @EVIL_CFLAGS@ 226EVIL_CFLAGS = @EVIL_CFLAGS@
227EVIL_LIBS = @EVIL_LIBS@ 227EVIL_LIBS = @EVIL_LIBS@
228EXEEXT = @EXEEXT@ 228EXEEXT = @EXEEXT@
229EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
230EXOTIC_LIBS = @EXOTIC_LIBS@
229FGREP = @FGREP@ 231FGREP = @FGREP@
230GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ 232GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
231GNUTLS_LIBS = @GNUTLS_LIBS@ 233GNUTLS_LIBS = @GNUTLS_LIBS@
@@ -265,6 +267,8 @@ PACKAGE_URL = @PACKAGE_URL@
265PACKAGE_VERSION = @PACKAGE_VERSION@ 267PACKAGE_VERSION = @PACKAGE_VERSION@
266PATH_SEPARATOR = @PATH_SEPARATOR@ 268PATH_SEPARATOR = @PATH_SEPARATOR@
267PKG_CONFIG = @PKG_CONFIG@ 269PKG_CONFIG = @PKG_CONFIG@
270PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
271PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
268RANLIB = @RANLIB@ 272RANLIB = @RANLIB@
269SED = @SED@ 273SED = @SED@
270SET_MAKE = @SET_MAKE@ 274SET_MAKE = @SET_MAKE@
diff --git a/libraries/eet/src/lib/Eet.h b/libraries/eet/src/lib/Eet.h
index 2df7fbf..7495090 100644
--- a/libraries/eet/src/lib/Eet.h
+++ b/libraries/eet/src/lib/Eet.h
@@ -6,7 +6,7 @@
6 @mainpage Eet Library Documentation 6 @mainpage Eet Library Documentation
7 7
8 @version 1.5.0 8 @version 1.5.0
9 @date 2000-2011 9 @date 2000-2012
10 10
11 Please see the @ref authors page for contact details. 11 Please see the @ref authors page for contact details.
12 12
@@ -30,7 +30,7 @@
30 Eet is extremely fast, small and simple. Eet files can be very small and 30 Eet is extremely fast, small and simple. Eet files can be very small and
31 highly compressed, making them very optimal for just sending across the 31 highly compressed, making them very optimal for just sending across the
32 internet without having to archive, compress or decompress and install them. 32 internet without having to archive, compress or decompress and install them.
33 They allow for lightning-fast random-acess reads once created, making them 33 They allow for lightning-fast random-access reads once created, making them
34 perfect for storing data that is written once (or rarely) and read many 34 perfect for storing data that is written once (or rarely) and read many
35 times, but the program does not want to have to read it all in at once. 35 times, but the program does not want to have to read it all in at once.
36 36
@@ -577,7 +577,7 @@ EAPI Eet_File_Mode
577eet_mode_get(Eet_File *ef); 577eet_mode_get(Eet_File *ef);
578 578
579/** 579/**
580 * Close an eet file handle and flush and writes pending. 580 * Close an eet file handle and flush pending writes.
581 * @param ef A valid eet file handle. 581 * @param ef A valid eet file handle.
582 * 582 *
583 * This function will flush any pending writes to disk if the eet file 583 * This function will flush any pending writes to disk if the eet file
@@ -645,6 +645,17 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
645 const char *string); 645 const char *string);
646 646
647/** 647/**
648 * Return the number of strings inside a dictionary
649 * @param ed A valid dictionary handle
650 * @return the number of strings inside a dictionary
651 *
652 * @since 1.6.0
653 * @ingroup Eet_File_Group
654 */
655EAPI int
656eet_dictionary_count(const Eet_Dictionary *ed);
657
658/**
648 * Read a specified entry from an eet file and return data 659 * Read a specified entry from an eet file and return data
649 * @param ef A valid eet file handle opened for reading. 660 * @param ef A valid eet file handle opened for reading.
650 * @param name Name of the entry. eg: "/base/file_i_want". 661 * @param name Name of the entry. eg: "/base/file_i_want".
diff --git a/libraries/eet/src/lib/Makefile.in b/libraries/eet/src/lib/Makefile.in
index 2a3fec0..c0367b3 100644
--- a/libraries/eet/src/lib/Makefile.in
+++ b/libraries/eet/src/lib/Makefile.in
@@ -172,6 +172,8 @@ EINA_LIBS = @EINA_LIBS@
172EVIL_CFLAGS = @EVIL_CFLAGS@ 172EVIL_CFLAGS = @EVIL_CFLAGS@
173EVIL_LIBS = @EVIL_LIBS@ 173EVIL_LIBS = @EVIL_LIBS@
174EXEEXT = @EXEEXT@ 174EXEEXT = @EXEEXT@
175EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
176EXOTIC_LIBS = @EXOTIC_LIBS@
175FGREP = @FGREP@ 177FGREP = @FGREP@
176GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ 178GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
177GNUTLS_LIBS = @GNUTLS_LIBS@ 179GNUTLS_LIBS = @GNUTLS_LIBS@
@@ -211,6 +213,8 @@ PACKAGE_URL = @PACKAGE_URL@
211PACKAGE_VERSION = @PACKAGE_VERSION@ 213PACKAGE_VERSION = @PACKAGE_VERSION@
212PATH_SEPARATOR = @PATH_SEPARATOR@ 214PATH_SEPARATOR = @PATH_SEPARATOR@
213PKG_CONFIG = @PKG_CONFIG@ 215PKG_CONFIG = @PKG_CONFIG@
216PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
217PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
214RANLIB = @RANLIB@ 218RANLIB = @RANLIB@
215SED = @SED@ 219SED = @SED@
216SET_MAKE = @SET_MAKE@ 220SET_MAKE = @SET_MAKE@
diff --git a/libraries/eet/src/lib/eet_alloc.c b/libraries/eet/src/lib/eet_alloc.c
index 85351ad..29e276c 100644
--- a/libraries/eet/src/lib/eet_alloc.c
+++ b/libraries/eet/src/lib/eet_alloc.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include <Eina.h> 5#include <Eina.h>
6
6#include "Eet.h" 7#include "Eet.h"
7#include "Eet_private.h" 8#include "Eet_private.h"
8 9
@@ -90,4 +91,3 @@ eet_mempool_shutdown(void)
90 mempool_array[i]->mp = NULL; 91 mempool_array[i]->mp = NULL;
91 } 92 }
92} 93}
93
diff --git a/libraries/eet/src/lib/eet_cipher.c b/libraries/eet/src/lib/eet_cipher.c
index 37a0899..2425e22 100644
--- a/libraries/eet/src/lib/eet_cipher.c
+++ b/libraries/eet/src/lib/eet_cipher.c
@@ -56,6 +56,9 @@ void *alloca(size_t);
56 56
57#ifdef HAVE_CIPHER 57#ifdef HAVE_CIPHER
58# ifdef HAVE_GNUTLS 58# ifdef HAVE_GNUTLS
59# if defined EET_USE_NEW_PUBKEY_VERIFY_HASH || defined EET_USE_NEW_PRIVKEY_SIGN_DATA
60# include <gnutls/abstract.h>
61# endif
59# include <gnutls/x509.h> 62# include <gnutls/x509.h>
60# include <gcrypt.h> 63# include <gcrypt.h>
61# else /* ifdef HAVE_GNUTLS */ 64# else /* ifdef HAVE_GNUTLS */
@@ -497,6 +500,10 @@ eet_identity_sign(FILE *fp,
497 gnutls_datum_t datum = { NULL, 0 }; 500 gnutls_datum_t datum = { NULL, 0 };
498 size_t sign_len = 0; 501 size_t sign_len = 0;
499 size_t cert_len = 0; 502 size_t cert_len = 0;
503#ifdef EET_USE_NEW_PRIVKEY_SIGN_DATA
504 gnutls_datum_t signum = { NULL, 0 };
505 gnutls_privkey_t privkey;
506#endif
500# else /* ifdef HAVE_GNUTLS */ 507# else /* ifdef HAVE_GNUTLS */
501 EVP_MD_CTX md_ctx; 508 EVP_MD_CTX md_ctx;
502 unsigned int sign_len = 0; 509 unsigned int sign_len = 0;
@@ -528,6 +535,28 @@ eet_identity_sign(FILE *fp,
528 datum.size = st_buf.st_size; 535 datum.size = st_buf.st_size;
529 536
530 /* Get the signature length */ 537 /* Get the signature length */
538#ifdef EET_USE_NEW_PRIVKEY_SIGN_DATA
539 if (gnutls_privkey_init(&privkey) < 0)
540 {
541 err = EET_ERROR_SIGNATURE_FAILED;
542 goto on_error;
543 }
544
545 if (gnutls_privkey_import_x509(privkey, key->private_key, 0) < 0)
546 {
547 err = EET_ERROR_SIGNATURE_FAILED;
548 goto on_error;
549 }
550
551 if (gnutls_privkey_sign_data(privkey, GNUTLS_DIG_SHA1, 0, &datum, &signum) < 0)
552 {
553 err = EET_ERROR_SIGNATURE_FAILED;
554 goto on_error;
555 }
556
557 sign = signum.data;
558 sign_len = signum.size;
559#else
531 if (gnutls_x509_privkey_sign_data(key->private_key, GNUTLS_DIG_SHA1, 0, 560 if (gnutls_x509_privkey_sign_data(key->private_key, GNUTLS_DIG_SHA1, 0,
532 &datum, sign, &sign_len) && 561 &datum, sign, &sign_len) &&
533 !sign_len) 562 !sign_len)
@@ -550,6 +579,7 @@ eet_identity_sign(FILE *fp,
550 579
551 goto on_error; 580 goto on_error;
552 } 581 }
582#endif
553 583
554 /* Get the certificate length */ 584 /* Get the certificate length */
555 if (gnutls_x509_crt_export(key->certificate, GNUTLS_X509_FMT_DER, cert, 585 if (gnutls_x509_crt_export(key->certificate, GNUTLS_X509_FMT_DER, cert,
@@ -696,6 +726,10 @@ eet_identity_check(const void *data_base,
696 gnutls_datum_t datum; 726 gnutls_datum_t datum;
697 gnutls_datum_t signature; 727 gnutls_datum_t signature;
698# if EET_USE_NEW_GNUTLS_API 728# if EET_USE_NEW_GNUTLS_API
729# if EET_USE_NEW_PUBKEY_VERIFY_HASH
730 gnutls_pubkey_t pubkey;
731 gnutls_digest_algorithm_t hash_algo;
732# endif
699 unsigned char *hash; 733 unsigned char *hash;
700 gcry_md_hd_t md; 734 gcry_md_hd_t md;
701 int err; 735 int err;
@@ -724,28 +758,32 @@ eet_identity_check(const void *data_base,
724 758
725 hash = gcry_md_read(md, GCRY_MD_SHA1); 759 hash = gcry_md_read(md, GCRY_MD_SHA1);
726 if (!hash) 760 if (!hash)
727 { 761 goto on_error;
728 gcry_md_close(md);
729 return NULL;
730 }
731 762
732 datum.size = gcry_md_get_algo_dlen(GCRY_MD_SHA1); 763 datum.size = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
733 datum.data = hash; 764 datum.data = hash;
734 765
766# ifdef EET_USE_NEW_PUBKEY_VERIFY_HASH
767 if (gnutls_pubkey_init(&pubkey) < 0)
768 goto on_error;
769
770 if (gnutls_pubkey_import_x509(pubkey, cert, 0) < 0)
771 goto on_error;
772
773 if (gnutls_pubkey_get_verify_algorithm(pubkey, &signature, &hash_algo) < 0)
774 goto on_error;
775
776 if (gnutls_pubkey_verify_hash(pubkey, 0, &datum, &signature) < 0)
777 goto on_error;
778# else
735 if (!gnutls_x509_crt_verify_hash(cert, 0, &datum, &signature)) 779 if (!gnutls_x509_crt_verify_hash(cert, 0, &datum, &signature))
736 { 780 goto on_error;
737 gcry_md_close(md); 781# endif
738 return NULL;
739 }
740 782
741 if (sha1) 783 if (sha1)
742 { 784 {
743 *sha1 = malloc(datum.size); 785 *sha1 = malloc(datum.size);
744 if (!*sha1) 786 if (!*sha1) goto on_error;
745 {
746 gcry_md_close(md);
747 return NULL;
748 }
749 787
750 memcpy(*sha1, hash, datum.size); 788 memcpy(*sha1, hash, datum.size);
751 *sha1_length = datum.size; 789 *sha1_length = datum.size;
@@ -818,6 +856,13 @@ eet_identity_check(const void *data_base,
818 *raw_signature_length = sign_len; 856 *raw_signature_length = sign_len;
819 857
820 return cert_der; 858 return cert_der;
859# ifdef HAVE_GNUTLS
860# if EET_USE_NEW_GNUTLS_API
861 on_error:
862 gcry_md_close(md);
863 return NULL;
864# endif
865# endif
821#else /* ifdef HAVE_SIGNATURE */ 866#else /* ifdef HAVE_SIGNATURE */
822 data_base = NULL; 867 data_base = NULL;
823 data_length = 0; 868 data_length = 0;
diff --git a/libraries/eet/src/lib/eet_data.c b/libraries/eet/src/lib/eet_data.c
index 56b9ee0..d502f44 100644
--- a/libraries/eet/src/lib/eet_data.c
+++ b/libraries/eet/src/lib/eet_data.c
@@ -21,18 +21,6 @@
21#include "Eet.h" 21#include "Eet.h"
22#include "Eet_private.h" 22#include "Eet_private.h"
23 23
24#ifdef _WIN32
25# define FMT_CHAR "%c"
26# define FMT_UCHAR "%c"
27# define FMT_LONG_LONG "%I64i"
28# define FMT_ULONG_LONG "%I64u"
29#else
30# define FMT_CHAR "%hhi"
31# define FMT_UCHAR "%hhu"
32# define FMT_LONG_LONG "%lli"
33# define FMT_ULONG_LONG "%llu"
34#endif
35
36/* 24/*
37 * routines for doing data -> struct and struct -> data conversion 25 * routines for doing data -> struct and struct -> data conversion
38 * 26 *
@@ -3108,7 +3096,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
3108 if (!strcmp(tok3, "char:")) 3096 if (!strcmp(tok3, "char:"))
3109 { 3097 {
3110 n->type = EET_T_CHAR; 3098 n->type = EET_T_CHAR;
3111 sscanf(tok4, FMT_CHAR, 3099 sscanf(tok4, "%hhi",
3112 &(n->data.value.c)); 3100 &(n->data.value.c));
3113 } 3101 }
3114 else if (!strcmp(tok3, "short:")) 3102 else if (!strcmp(tok3, "short:"))
@@ -3126,7 +3114,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
3126 else if (!strcmp(tok3, "long_long:")) 3114 else if (!strcmp(tok3, "long_long:"))
3127 { 3115 {
3128 n->type = EET_T_LONG_LONG; 3116 n->type = EET_T_LONG_LONG;
3129 sscanf(tok4, FMT_LONG_LONG, 3117 sscanf(tok4, "%lli",
3130 &(n->data.value.l)); 3118 &(n->data.value.l));
3131 } 3119 }
3132 else if (!strcmp(tok3, "float:")) 3120 else if (!strcmp(tok3, "float:"))
@@ -3144,7 +3132,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
3144 else if (!strcmp(tok3, "uchar:")) 3132 else if (!strcmp(tok3, "uchar:"))
3145 { 3133 {
3146 n->type = EET_T_UCHAR; 3134 n->type = EET_T_UCHAR;
3147 sscanf(tok4, FMT_UCHAR, 3135 sscanf(tok4, "%hhu",
3148 &(n->data.value.uc)); 3136 &(n->data.value.uc));
3149 } 3137 }
3150 else if (!strcmp(tok3, "ushort:")) 3138 else if (!strcmp(tok3, "ushort:"))
@@ -3162,7 +3150,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
3162 else if (!strcmp(tok3, "ulong_long:")) 3150 else if (!strcmp(tok3, "ulong_long:"))
3163 { 3151 {
3164 n->type = EET_T_ULONG_LONG; 3152 n->type = EET_T_ULONG_LONG;
3165 sscanf(tok4, FMT_ULONG_LONG, 3153 sscanf(tok4, "%llu",
3166 &(n->data.value.ul)); 3154 &(n->data.value.ul));
3167 } 3155 }
3168 else if (!strcmp(tok3, "string:")) 3156 else if (!strcmp(tok3, "string:"))
@@ -4996,4 +4984,3 @@ eet_data_xattr_cipher_set(const char *filename,
4996 4984
4997 return ret; 4985 return ret;
4998} 4986}
4999
diff --git a/libraries/eet/src/lib/eet_dictionary.c b/libraries/eet/src/lib/eet_dictionary.c
index 287860d..c79239b 100644
--- a/libraries/eet/src/lib/eet_dictionary.c
+++ b/libraries/eet/src/lib/eet_dictionary.c
@@ -169,6 +169,12 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed,
169 return 0; 169 return 0;
170} 170}
171 171
172EAPI int
173eet_dictionary_count(const Eet_Dictionary *ed)
174{
175 return ed->count;
176}
177
172int 178int
173eet_dictionary_string_get_hash(const Eet_Dictionary *ed, 179eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
174 int idx) 180 int idx)
diff --git a/libraries/eet/src/lib/eet_image.c b/libraries/eet/src/lib/eet_image.c
index 8c6c03c..b622236 100644
--- a/libraries/eet/src/lib/eet_image.c
+++ b/libraries/eet/src/lib/eet_image.c
@@ -246,7 +246,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
246 unsigned int w, 246 unsigned int w,
247 unsigned int h, 247 unsigned int h,
248 unsigned int row_stride); 248 unsigned int row_stride);
249static void * 249static int
250eet_data_image_jpeg_alpha_decode(const void *data, 250eet_data_image_jpeg_alpha_decode(const void *data,
251 int size, 251 int size,
252 unsigned int src_x, 252 unsigned int src_x,
@@ -560,7 +560,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
560 return 1; 560 return 1;
561} 561}
562 562
563static void * 563static int
564eet_data_image_jpeg_alpha_decode(const void *data, 564eet_data_image_jpeg_alpha_decode(const void *data,
565 int size, 565 int size,
566 unsigned int src_x, 566 unsigned int src_x,
@@ -577,6 +577,10 @@ eet_data_image_jpeg_alpha_decode(const void *data,
577 unsigned int x, y, l, scans; 577 unsigned int x, y, l, scans;
578 unsigned int i, iw; 578 unsigned int i, iw;
579 579
580 /* FIXME: handle src_x, src_y and row_stride correctly */
581 if (!d)
582 return 0;
583
580 memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct)); 584 memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct));
581 585
582 cinfo.err = jpeg_std_error(&(jerr.pub)); 586 cinfo.err = jpeg_std_error(&(jerr.pub));
@@ -584,14 +588,14 @@ eet_data_image_jpeg_alpha_decode(const void *data,
584 jerr.pub.emit_message = _JPEGErrorHandler2; 588 jerr.pub.emit_message = _JPEGErrorHandler2;
585 jerr.pub.output_message = _JPEGErrorHandler; 589 jerr.pub.output_message = _JPEGErrorHandler;
586 if (setjmp(jerr.setjmp_buffer)) 590 if (setjmp(jerr.setjmp_buffer))
587 return NULL; 591 return 0;
588 592
589 jpeg_create_decompress(&cinfo); 593 jpeg_create_decompress(&cinfo);
590 594
591 if (eet_jpeg_membuf_src(&cinfo, data, (size_t)size)) 595 if (eet_jpeg_membuf_src(&cinfo, data, (size_t)size))
592 { 596 {
593 jpeg_destroy_decompress(&cinfo); 597 jpeg_destroy_decompress(&cinfo);
594 return NULL; 598 return 0;
595 } 599 }
596 600
597 jpeg_read_header(&cinfo, TRUE); 601 jpeg_read_header(&cinfo, TRUE);
@@ -609,7 +613,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
609 cinfo.src = NULL; 613 cinfo.src = NULL;
610 614
611 jpeg_destroy_decompress(&cinfo); 615 jpeg_destroy_decompress(&cinfo);
612 return NULL; 616 return 0;
613 } 617 }
614 618
615 /* end head decoding */ 619 /* end head decoding */
@@ -620,11 +624,12 @@ eet_data_image_jpeg_alpha_decode(const void *data,
620 cinfo.src = NULL; 624 cinfo.src = NULL;
621 625
622 jpeg_destroy_decompress(&cinfo); 626 jpeg_destroy_decompress(&cinfo);
623 return NULL; 627 return 0;
624 } 628 }
625 629
626 tdata = alloca(w * 16 * 3); 630 tdata = alloca(w * 16 * 3);
627 ptr2 = d; 631 ptr2 = d;
632
628 if (cinfo.output_components == 1) 633 if (cinfo.output_components == 1)
629 { 634 {
630 for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++) 635 for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++)
@@ -666,7 +671,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
666 /* end data decoding */ 671 /* end data decoding */
667 jpeg_finish_decompress(&cinfo); 672 jpeg_finish_decompress(&cinfo);
668 jpeg_destroy_decompress(&cinfo); 673 jpeg_destroy_decompress(&cinfo);
669 return d; 674 return 1;
670} 675}
671 676
672static void * 677static void *
diff --git a/libraries/eet/src/tests/Makefile.in b/libraries/eet/src/tests/Makefile.in
index 791f9fd..e17a54e 100644
--- a/libraries/eet/src/tests/Makefile.in
+++ b/libraries/eet/src/tests/Makefile.in
@@ -135,6 +135,8 @@ EINA_LIBS = @EINA_LIBS@
135EVIL_CFLAGS = @EVIL_CFLAGS@ 135EVIL_CFLAGS = @EVIL_CFLAGS@
136EVIL_LIBS = @EVIL_LIBS@ 136EVIL_LIBS = @EVIL_LIBS@
137EXEEXT = @EXEEXT@ 137EXEEXT = @EXEEXT@
138EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
139EXOTIC_LIBS = @EXOTIC_LIBS@
138FGREP = @FGREP@ 140FGREP = @FGREP@
139GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ 141GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
140GNUTLS_LIBS = @GNUTLS_LIBS@ 142GNUTLS_LIBS = @GNUTLS_LIBS@
@@ -174,6 +176,8 @@ PACKAGE_URL = @PACKAGE_URL@
174PACKAGE_VERSION = @PACKAGE_VERSION@ 176PACKAGE_VERSION = @PACKAGE_VERSION@
175PATH_SEPARATOR = @PATH_SEPARATOR@ 177PATH_SEPARATOR = @PATH_SEPARATOR@
176PKG_CONFIG = @PKG_CONFIG@ 178PKG_CONFIG = @PKG_CONFIG@
179PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
180PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
177RANLIB = @RANLIB@ 181RANLIB = @RANLIB@
178SED = @SED@ 182SED = @SED@
179SET_MAKE = @SET_MAKE@ 183SET_MAKE = @SET_MAKE@
diff --git a/libraries/eet/src/tests/eet_suite.c b/libraries/eet/src/tests/eet_suite.c
index 3bbc912..91ef2a7 100644
--- a/libraries/eet/src/tests/eet_suite.c
+++ b/libraries/eet/src/tests/eet_suite.c
@@ -1933,7 +1933,7 @@ START_TEST(eet_cache_concurrency)
1933 thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id); 1933 thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id);
1934# endif /* ifdef _EET_INCLUDED_PTHREAD */ 1934# endif /* ifdef _EET_INCLUDED_PTHREAD */
1935 /* clear the cache repeatedly in this thread */ 1935 /* clear the cache repeatedly in this thread */
1936 for (n = 0; n < 50000; ++n) 1936 for (n = 0; n < 20000; ++n)
1937 { 1937 {
1938 eet_clearcache(); 1938 eet_clearcache();
1939 } 1939 }