svn update: 53177 (latest:53437)
authorEFL <efl@efl-desktop.(none)>
Tue, 19 Oct 2010 23:49:21 +0000 (08:49 +0900)
committerEFL <efl@efl-desktop.(none)>
Tue, 19 Oct 2010 23:49:21 +0000 (08:49 +0900)
17 files changed:
ChangeLog
README.in
configure.ac
debian/SVN_REV
debian/_original/control
doc/eet.dox.in
eet.spec.in
m4/efl_binary.m4
src/bin/eet_main.c
src/lib/Eet.h
src/lib/eet_cipher.c
src/lib/eet_data.c
src/lib/eet_dictionary.c
src/lib/eet_image.c
src/lib/eet_lib.c
src/lib/eet_node.c
src/tests/eet_suite.c

index ce4ec2f..3881dff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,7 @@
 
 2008-05-14  Cedric BAIL
 
-       * Fix convertion from a text to a hash (EET_G_HASH).
+       * Fix conversion from a text to a hash (EET_G_HASH).
 
        * Fix inlined string (EET_T_INLINED_STRING) dump/undump by introducing
        the new word for the parser 'inlined'.
 2009-12-07  Cedric BAIL
 
        * Fix error when retrieving a different float type than the stored one.
-       * Reduce convertion with a little memory overhead.
+       * Reduce conversion with a little memory overhead.
 
 2009-12-07  Vincent Torri
 
 
        * Add a specific allocator for array. This should fix wrong allocation
        case discovered with recent edje file format change.
+
+2010-08-23  Carsten Haitzler (The Rasterman)
+
+        * Fix some cppcheck complaints - all of them bogus though.
+        Nothing actually fixed.
+
+2010-08-27  Cedric BAIL
+
+       * Prevent the build of eet data structure that doesn't match what
+       the application is expecting.
+
+2010-09-02  Cedric BAIL
+
+       * Fix bug of ever growing dictionnary and improve strcmp comparison.
index 182ac0a..dac94d2 100644 (file)
--- a/README.in
+++ b/README.in
@@ -1,4 +1,4 @@
-Eet @VERSION@ ALPHA
+Eet @VERSION@ BETA
 
 ******************************************************************************
 
@@ -21,7 +21,7 @@ Optional requirements:
   gnutls (1.7.6 or better)
   openssl
 
-Eet is a tiny library designed to write an arbitary set of chunks of
+Eet is a tiny library designed to write an arbitrary set of chunks of
 data to a file and optionally compress each chunk (very much like a
 zip file) and allow fast random-access reading of the file later
 on. It does not do zip as a zip itself has more complexity than is
@@ -29,8 +29,8 @@ needed, and it was much simpler to implement this once here.
 
 It also can encode and decode data structures in memory, as well as
 image data for saving to eet files or sending across the network to
-other machines, or just writing to arbitary files on the system. All
-data is encoded in a platform independant way and can be written and
+other machines, or just writing to arbitrary files on the system. All
+data is encoded in a platform independent way and can be written and
 read by any architecture. This data once encoded can be sent to
 another process or machine and decoded on the other end without
 needing to go into an eet file. Eet can also optionally encrypt files
index 33c8574..00eb7b8 100644 (file)
@@ -18,7 +18,7 @@ m4_define([lt_age], v_min)
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 
-AC_INIT([eet], [v_ver-alpha], [enlightenment-devel@lists.sourceforge.net])
+AC_INIT([eet], [v_ver.beta], [enlightenment-devel@lists.sourceforge.net])
 AC_PREREQ([2.52])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_MACRO_DIR([m4])
index 7da86ca..6557fef 100644 (file)
@@ -1,2 +1,2 @@
-Revision 51480
-Last Changed Rev 51457
+Revision 53437
+Last Changed Rev 53177
index 082b929..ed910ae 100644 (file)
@@ -14,7 +14,7 @@ Architecture: any
 Depends: libeet1 (= ${binary:Version}), libjpeg62-dev, pkg-config
 Recommends: libeet-doc
 Description: Enlightenment DR17 file chunk reading/writing library development files
- Eet is a tiny library designed to write an arbitary set of chunks of data to a
+ Eet is a tiny library designed to write an arbitrary set of chunks of data to a
  file and optionally compress each chunk (very much like a zip file) and allow
  fast random-access reading of the file later on. It does not do zip as zip
  itself has more complexity than we need, and it was much simpler to implement
@@ -27,7 +27,7 @@ Section: doc
 Architecture: all
 Enhances: libeet-dev
 Description: libeet1 API documentation
- Eet is a tiny library designed to write an arbitary set of chunks of data to a
+ Eet is a tiny library designed to write an arbitrary set of chunks of data to a
  file and optionally compress each chunk (very much like a zip file) and allow
  fast random-access reading of the file later on. It does not do zip as zip
  itself has more complexity than we need, and it was much simpler to implement
@@ -40,7 +40,7 @@ Package: libeet1
 Architecture: any
 Depends: ${shlibs:Depends}
 Description: Enlightenment DR17 file chunk reading/writing library
- Eet is a tiny library designed to write an arbitary set of chunks of data to a
+ Eet is a tiny library designed to write an arbitrary set of chunks of data to a
  file and optionally compress each chunk (very much like a zip file) and allow
  fast random-access reading of the file later on. It does not do zip as zip
  itself has more complexity than we need, and it was much simpler to implement
@@ -52,7 +52,7 @@ Package: libeet-bin
 Architecture: any
 Depends: ${shlibs:Depends}
 Description: Enlightenment DR17 file chunk reading/writing utility
- Eet is a tiny library designed to write an arbitary set of chunks of data to a
+ Eet is a tiny library designed to write an arbitrary set of chunks of data to a
  file and optionally compress each chunk (very much like a zip file) and allow
  fast random-access reading of the file later on. It does not do zip as zip
  itself has more complexity than we need, and it was much simpler to implement
@@ -67,7 +67,7 @@ Section: libdevel
 Priority: extra
 Depends: libeet1 (= ${binary:Version})
 Description: Enlightenment DR17 file chunk reading/writing library - debug symbols
- Eet is a tiny library designed to write an arbitary set of chunks of data to a
+ Eet is a tiny library designed to write an arbitrary set of chunks of data to a
  file and optionally compress each chunk (very much like a zip file) and allow
  fast random-access reading of the file later on. It does not do zip as zip
  itself has more complexity than we need, and it was much simpler to implement
index d6a7bfb..14c0ed4 100644 (file)
@@ -39,11 +39,11 @@ These routines are used for Eet Library interaction
 
 @section intro What is Eet?
 
-It is a tiny library designed to write an arbitary set of chunks of data
+It is a tiny library designed to write an arbitrary set of chunks of data
 to a file and optionally compress each chunk (very much like a zip file)
 and allow fast random-access reading of the file later on. It does not
 do zip as a zip itself has more complexity than is needed, and it was much
-simpler to impliment this once here.
+simpler to implement this once here.
 
 Eet is extremely fast, small and simple. Eet files can be very small and
 highly compressed, making them very optimal for just sending across the
@@ -54,8 +54,8 @@ times, but the program does not want to have to read it all in at once.
 
 It also can encode and decode data structures in memory, as well as image
 data for saving to Eet files or sending across the network to other
-machines, or just writing to arbitary files on the system. All data is
-encoded in a platform independant way and can be written and read by any
+machines, or just writing to arbitrary files on the system. All data is
+encoded in a platform independent way and can be written and read by any
 architecture.
 
 @section example A simple example on using Eet
index 58d64c5..119266b 100644 (file)
@@ -16,7 +16,7 @@ BuildRequires: libjpeg-devel zlib-devel
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 
 %description
-Eet is a tiny library designed to write an arbitary set of chunks of
+Eet is a tiny library designed to write an arbitrary set of chunks of
 data to a file and optionally compress each chunk (very much like a
 zip file) and allow fast random-access reading of the file later
 on. It does not do zip as a zip itself has more complexity than is
@@ -24,8 +24,8 @@ needed, and it was much simpler to implement this once here.
 
 It also can encode and decode data structures in memory, as well as
 image data for saving to eet files or sending across the network to
-other machines, or just writing to arbitary files on the system. All
-data is encoded in a platform independant way and can be written and
+other machines, or just writing to arbitrary files on the system. All
+data is encoded in a platform independent way and can be written and
 read by any architecture.
 
 %package devel
index 0873256..fc2f200 100644 (file)
@@ -4,9 +4,9 @@ dnl That code is public domain and can be freely used or copied.
 dnl Macro that checks if a binary is built or not
 
 dnl Usage: EFL_ENABLE_BIN(binary)
-dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
-dnl Define have_binary (- is tranformed into _)
-dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
+dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being transformed into _)
+dnl Define have_binary (- is transformed into _)
+dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being transformed into _)
 
 AC_DEFUN([EFL_ENABLE_BIN],
 [
@@ -46,9 +46,9 @@ AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3])
 dnl Macro that specifies the binary to be used
 
 dnl Usage: EFL_WITH_BIN(binary, package, msg)
-dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
-dnl Define with_binary (- is tranformed into _)
-dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
+dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being transformed into _)
+dnl Define with_binary (- is transformed into _)
+dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being transformed into _)
 
 AC_DEFUN([EFL_WITH_BIN],
 [
index 0302924..e55a300 100644 (file)
@@ -52,7 +52,7 @@ do_eet_list(const char * file)
    ef = eet_open(file, EET_FILE_MODE_READ);
    if (!ef)
      {
-        ERR("cannot open for reading: %s\n", file);
+        ERR("cannot open for reading: %s", file);
         exit(-1);
      }
 
@@ -81,27 +81,27 @@ do_eet_extract(const char * file,
    ef = eet_open(file, EET_FILE_MODE_READ);
    if (!ef)
      {
-        ERR("cannot open for reading: %s\n", file);
+        ERR("cannot open for reading: %s", file);
         exit(-1);
      }
 
    data = eet_read_cipher(ef, key, &size, crypto_key);
    if (!data)
      {
-        ERR("cannot read key %s\n", key);
+        ERR("cannot read key %s", key);
         exit(-1);
      }
 
    f = fopen(out, "wb");
    if (!f)
      {
-        ERR("cannot open %s\n", out);
+        ERR("cannot open %s", out);
         exit(-1);
      }
 
    if (fwrite(data, size, 1, f) != 1)
      {
-        ERR("cannot write to %s\n", out);
+        ERR("cannot write to %s", out);
         exit(-1);
      }
 
@@ -128,20 +128,20 @@ do_eet_decode(const char * file,
    ef = eet_open(file, EET_FILE_MODE_READ);
    if (!ef)
      {
-        ERR("cannot open for reading: %s\n", file);
+        ERR("cannot open for reading: %s", file);
         exit(-1);
      }
 
    f = fopen(out, "wb");
    if (!f)
      {
-        ERR("cannot open %s\n", out);
+        ERR("cannot open %s", out);
         exit(-1);
      }
 
    if (!eet_data_dump_cipher(ef, key, crypto_key, do_eet_decode_dump, f))
      {
-        ERR("cannot write to %s\n", out);
+        ERR("cannot write to %s", out);
         exit(-1);
      }
 
@@ -167,14 +167,14 @@ do_eet_insert(const char * file,
 
    if (!ef)
      {
-        ERR("cannot open for read+write: %s\n", file);
+        ERR("cannot open for read+write: %s", file);
         exit(-1);
      }
 
    f = fopen(out, "rb");
    if (!f)
      {
-        ERR("cannot open %s\n", out);
+        ERR("cannot open %s", out);
         exit(-1);
      }
 
@@ -184,13 +184,13 @@ do_eet_insert(const char * file,
    data = malloc(size);
    if (!data)
      {
-        ERR("cannot allocate %i bytes\n", size);
+        ERR("cannot allocate %i bytes", size);
         exit(-1);
      }
 
    if (fread(data, size, 1, f) != 1)
      {
-        ERR("cannot read file %s\n", out);
+        ERR("cannot read file %s", out);
         exit(-1);
      }
 
@@ -219,14 +219,14 @@ do_eet_encode(const char * file,
 
    if (!ef)
      {
-        ERR("cannot open for read+write: %s\n", file);
+        ERR("cannot open for read+write: %s", file);
         exit(-1);
      }
 
    f = fopen(out, "rb");
    if (!f)
      {
-        ERR("cannot open %s\n", out);
+        ERR("cannot open %s", out);
         exit(-1);
      }
 
@@ -236,20 +236,20 @@ do_eet_encode(const char * file,
    text = malloc(textlen);
    if (!text)
      {
-        ERR("cannot allocate %i bytes\n", size);
+        ERR("cannot allocate %i bytes", size);
         exit(-1);
      }
 
    if (fread(text, textlen, 1, f) != 1)
      {
-        ERR("cannot read file %s\n", out);
+        ERR("cannot read file %s", out);
         exit(-1);
      }
 
    fclose(f);
    if (!eet_data_undump_cipher(ef, key, crypto_key, text, textlen, compress))
      {
-        ERR("cannot parse %s\n", out);
+        ERR("cannot parse %s", out);
         exit(-1);
      }
 
@@ -265,7 +265,7 @@ do_eet_remove(const char * file, const char * key)
    ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
    if (!ef)
      {
-        ERR("cannot open for read+write: %s\n", file);
+        ERR("cannot open for read+write: %s", file);
         exit(-1);
      }
 
@@ -284,7 +284,7 @@ do_eet_check(const char * file)
    ef = eet_open(file, EET_FILE_MODE_READ);
    if (!ef)
      {
-        ERR("checking signature of `%s` failed\n", file);
+        ERR("checking signature of `%s` failed", file);
         exit(-1);
      }
 
@@ -308,14 +308,14 @@ do_eet_sign(const char * file, const char * private_key, const char * public_key
    ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
    if (!ef)
      {
-        ERR("cannot open for read+write: %s.\n", file);
+        ERR("cannot open for read+write: %s.", file);
         exit(-1);
      }
 
    key = eet_identity_open(public_key, private_key, NULL);
    if (!key)
      {
-        ERR("cannot open key '%s:%s'.\n", public_key, private_key);
+        ERR("cannot open key '%s:%s'.", public_key, private_key);
         exit(-1);
      }
 
@@ -333,10 +333,10 @@ main(int argc, char ** argv)
    if (!eet_init())
       return -1;
 
-   _eet_main_log_dom = eina_log_domain_register("Eet_Main",EINA_COLOR_CYAN);
+   _eet_main_log_dom = eina_log_domain_register("eet_main", EINA_COLOR_CYAN);
    if(_eet_main_log_dom < -1)
      {
-        EINA_LOG_ERR("Impossible to create a log domain for eet_main.\n");
+        EINA_LOG_ERR("Impossible to create a log domain for eet_main.");
         eet_shutdown();
         return(-1);
      }
index 9ca3658..7a97368 100644 (file)
@@ -629,7 +629,7 @@ eet_write_cipher(Eet_File   *ef,
  * @param compress A pointer to the int to hold the compression amount.
  * @param quality A pointer to the int to hold the quality amount.
  * @param lossy A pointer to the int to hold the lossiness flag.
- * @return 1 on successfull decode, 0 otherwise
+ * @return 1 on successful decode, 0 otherwise
  *
  * This function reads an image from an eet file stored under the named
  * key in the eet file and return a pointer to the decompressed pixel data.
@@ -1027,7 +1027,7 @@ eet_data_image_encode(const void  *data,
  * @param compress A pointer to the int to hold the compression amount.
  * @param quality A pointer to the int to hold the quality amount.
  * @param lossy A pointer to the int to hold the lossiness flag.
- * @return 1 on successfull decode, 0 otherwise
+ * @return 1 on successful decode, 0 otherwise
  *
  * This function reads an image from an eet file stored under the named
  * key in the eet file and return a pointer to the decompressed pixel data.
@@ -1820,7 +1820,7 @@ struct _Eet_Data_Descriptor_Class
       char       *(*str_direct_alloc)(const char *str);   /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
       void        (*str_direct_free)(const char *str);   /**< how to free a string returned by str_direct_alloc */
       const char *(*type_get)(const void *data, Eina_Bool *unknow);    /**< convert any kind of data type to a name that define an Eet_Data_Element. */
-      Eina_Bool   (*type_set)(const char *type, void *data, Eina_Bool unknow);    /**< set the type at a particular adress */
+      Eina_Bool   (*type_set)(const char *type, void *data, Eina_Bool unknow);    /**< set the type at a particular address */
       void       *(*array_alloc)(size_t size); /**< how to allocate memory for array (usually malloc()) */
       void        (*array_free)(void *mem); /**< how to free memory for array (usually free()) */
    } func;
@@ -1856,7 +1856,7 @@ struct _Eet_Data_Descriptor_Class
  *
  * Once you have described all the members of a struct you want loaded, or
  * saved eet can load and save those members for you, encode them into
- * endian-independant serialised data chunks for transmission across a
+ * endian-independent serialised data chunks for transmission across a
  * a network or more.
  *
  * The function pointers to the list and hash table functions are only
@@ -1905,11 +1905,11 @@ eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
  *
  * Once you have described all the members of a struct you want loaded, or
  * saved eet can load and save those members for you, encode them into
- * endian-independant serialised data chunks for transmission across a
+ * endian-independent serialised data chunks for transmission across a
  * a network or more.
  *
  * This function specially ignore str_direct_alloc and str_direct_free. It
- * is usefull when the eet_data you are reading don't have a dictionnary
+ * is useful when the eet_data you are reading don't have a dictionnary
  * like network stream or ipc. It also mean that all string will be allocated
  * and duplicated in memory.
  *
@@ -1932,11 +1932,11 @@ eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class *eddc);
  *
  * Once you have described all the members of a struct you want loaded, or
  * saved eet can load and save those members for you, encode them into
- * endian-independant serialised data chunks for transmission across a
+ * endian-independent serialised data chunks for transmission across a
  * a network or more.
  *
  * This function use str_direct_alloc and str_direct_free. It is
- * usefull when the eet_data you are reading come from a file and
+ * useful when the eet_data you are reading come from a file and
  * have a dictionnary. This will reduce memory use, improve the
  * possibility for the OS to page this string out. But be carrefull
  * all EET_T_STRING are pointer to a mmapped area and it will point
@@ -1955,6 +1955,7 @@ eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc);
  * with a stream.
  * @param eddc The Eet_Data_Descriptor_Class you want to set.
  * @param name The name of the structure described by this class.
+ * @param eddc_size The size of the Eet_Data_Descriptor_Class at the compilation time.
  * @param size The size of the structure described by this class.
  * @return EINA_TRUE if the structure was correctly set (The only
  *         reason that could make it fail is if you did give wrong
@@ -1973,8 +1974,8 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
  * This macro is an helper that set all the parameter of an
  * Eet_Data_Descriptor_Class correctly when you use Eina data type
  * with stream.
- * @param Clas The Eet_Data_Descriptor_Class you want to set.
- * @param Type The type of the structure described by this class.
+ * @param clas The Eet_Data_Descriptor_Class you want to set.
+ * @param type The type of the structure described by this class.
  * @return EINA_TRUE if the structure was correctly set (The only
  *         reason that could make it fail is if you did give wrong
  *         parameter).
@@ -1990,6 +1991,7 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
  * Eet_Data_Descriptor_Class correctly when you use Eina data type
  * with a file.
  * @param eddc The Eet_Data_Descriptor_Class you want to set.
+ * @param eddc_size The size of the Eet_Data_Descriptor_Class at the compilation time.
  * @param name The name of the structure described by this class.
  * @param size The size of the structure described by this class.
  * @return EINA_TRUE if the structure was correctly set (The only
@@ -2009,8 +2011,8 @@ eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
  * This macro is an helper that set all the parameter of an
  * Eet_Data_Descriptor_Class correctly when you use Eina data type
  * with file.
- * @param Clas The Eet_Data_Descriptor_Class you want to set.
- * @param Type The type of the structure described by this class.
+ * @param clas The Eet_Data_Descriptor_Class you want to set.
+ * @param type The type of the structure described by this class.
  * @return EINA_TRUE if the structure was correctly set (The only
  *         reason that could make it fail is if you did give wrong
  *         parameter).
@@ -2264,7 +2266,7 @@ eet_data_undump(Eet_File   *ef,
                 int         compress);
 
 /**
- * Decode a data structure from an arbitary location in memory.
+ * Decode a data structure from an arbitrary location in memory.
  * @param edd The data  descriptor to use when decoding.
  * @param data_in The pointer to the data to decode into a struct.
  * @param size_in The size of the data pointed to in bytes.
@@ -2826,7 +2828,7 @@ eet_data_undump_cipher(Eet_File   *ef,
                        int         compress);
 
 /**
- * Decode a data structure from an arbitary location in memory
+ * Decode a data structure from an arbitrary location in memory
  * using a cipher.
  * @param edd The data  descriptor to use when decoding.
  * @param data_in The pointer to the data to decode into a struct.
@@ -3245,7 +3247,7 @@ typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data);
 
 /**
  * Instanciate a new connection to track.
- * @oaram eet_read_cb Function to call when one Eet_Data packet has been fully assemble.
+ * @param eet_read_cb Function to call when one Eet_Data packet has been fully assemble.
  * @param eet_write_cb Function to call when one Eet_Data packet is ready to be send over the wire.
  * @param user_data Pointer provided to both functions to be used as a context handler.
  * @return NULL on failure, or a valid Eet_Connection handler.
@@ -3262,7 +3264,7 @@ eet_connection_new(Eet_Read_Cb  *eet_read_cb,
 
 /**
  * Process a raw packet received over the link
- * @oaram conn Connection handler to track.
+ * @param conn Connection handler to track.
  * @param data Raw data packet.
  * @param size The size of that packet.
  * @return 0 on complete success, any other value indicate where in the stream it got wrong (It could be before that packet).
@@ -3281,7 +3283,7 @@ eet_connection_received(Eet_Connection *conn,
 
 /**
  * Convert a complex structure and prepare it to be send.
- * @oaram conn Connection handler to track.
+ * @param conn Connection handler to track.
  * @param edd The data descriptor to use when encoding.
  * @param data_in The pointer to the struct to encode into data.
  * @param cipher_key The key to use as cipher.
@@ -3304,7 +3306,7 @@ eet_connection_send(Eet_Connection      *conn,
 
 /**
  * Convert a Eet_Node tree and prepare it to be send.
- * @oaram conn Connection handler to track.
+ * @param conn Connection handler to track.
  * @param node The data tree to use when encoding.
  * @param cipher_key The key to use as cipher.
  * @return EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.
@@ -3325,7 +3327,7 @@ eet_connection_node_send(Eet_Connection *conn,
 
 /**
  * Close a connection and lost its track.
- * @oaram conn Connection handler to close.
+ * @param conn Connection handler to close.
  * @param on_going Signal if a partial packet wasn't completed.
  * @return the user_data passed to both callback.
  *
index 7821759..6eff8de 100644 (file)
@@ -279,6 +279,10 @@ on_error:
       EVP_PKEY_free(pkey);
 
 # endif /* ifdef HAVE_GNUTLS */
+#else
+   certificate_file = NULL;
+   private_key_file = NULL;
+   cb = NULL;
 #endif /* ifdef HAVE_SIGNATURE */
    return NULL;
 } /* eet_identity_open */
@@ -298,6 +302,8 @@ eet_identity_close(Eet_Key *key)
    EVP_PKEY_free(key->private_key);
 # endif /* ifdef HAVE_GNUTLS */
    free(key);
+#else
+   key = NULL;
 #endif /* ifdef HAVE_SIGNATURE */
 } /* eet_identity_close */
 
@@ -419,6 +425,8 @@ on_error:
    X509_print_fp(out, key->certificate);
 # endif /* ifdef HAVE_GNUTLS */
 #else /* ifdef HAVE_SIGNATURE */
+   key = NULL;
+   out = NULL;
    ERR("You need to compile signature support in EET.");
 #endif /* ifdef HAVE_SIGNATURE */
 } /* eet_identity_print */
@@ -426,7 +434,7 @@ on_error:
 void
 eet_identity_ref(Eet_Key *key)
 {
-   if (key == NULL)
+   if (!key)
       return;
 
    key->references++;
@@ -435,7 +443,7 @@ eet_identity_ref(Eet_Key *key)
 void
 eet_identity_unref(Eet_Key *key)
 {
-   if (key == NULL)
+   if (!key)
       return;
 
    key->references--;
@@ -474,6 +482,9 @@ eet_identity_compute_sha1(const void  *data_base,
 #  endif /* ifdef HAVE_OPENSSL */
 # endif /* ifdef HAVE_GNUTLS */
 #else /* ifdef HAVE_SIGNATURE */
+   data_base = NULL;
+   data_length = 0;
+   sha1_length = NULL;
    result = NULL;
 #endif /* ifdef HAVE_SIGNATURE */
 
@@ -573,7 +584,7 @@ eet_identity_sign(FILE    *fp,
 # else /* ifdef HAVE_GNUTLS */
    sign_len = EVP_PKEY_size(key->private_key);
    sign = malloc(sign_len);
-   if (sign == NULL)
+   if (!sign)
      {
         err = EET_ERROR_OUT_OF_MEMORY;
         goto on_error;
@@ -642,6 +653,8 @@ on_error:
    munmap(data, st_buf.st_size);
    return err;
 #else /* ifdef HAVE_SIGNATURE */
+   fp = NULL;
+   key = NULL;
    return EET_ERROR_NOT_IMPLEMENTED;
 #endif /* ifdef HAVE_SIGNATURE */
 } /* eet_identity_sign */
@@ -717,7 +730,7 @@ eet_identity_check(const void   *data_base,
    gcry_md_write(md, data_base, data_length);
 
    hash = gcry_md_read(md, GCRY_MD_SHA1);
-   if (hash == NULL)
+   if (!hash)
      {
         gcry_md_close(md);
         return NULL;
@@ -773,12 +786,12 @@ eet_identity_check(const void   *data_base,
    tmp = alloca(cert_len);
    memcpy((char *)tmp, cert_der, cert_len);
    x509 = d2i_X509(NULL, &tmp, cert_len);
-   if (x509 == NULL)
+   if (!x509)
       return NULL;
 
    /* Get public key - eay */
    pkey = X509_get_pubkey(x509);
-   if (pkey == NULL)
+   if (!pkey)
      {
         X509_free(x509);
         return NULL;
@@ -813,6 +826,15 @@ eet_identity_check(const void   *data_base,
 
    return cert_der;
 #else /* ifdef HAVE_SIGNATURE */
+   data_base = NULL;
+   data_length = 0;
+   sha1 = NULL;
+   sha1_length = NULL;
+   signature_base = NULL;
+   signature_length = 0;
+   raw_signature_base = NULL;
+   raw_signature_length = NULL;
+   x509_length = NULL;
    return NULL;
 #endif /* ifdef HAVE_SIGNATURE */
 } /* eet_identity_check */
@@ -864,7 +886,7 @@ on_error:
    tmp = alloca(der_length);
    memcpy((char *)tmp, certificate, der_length);
    x509 = d2i_X509(NULL, &tmp, der_length);
-   if (x509 == NULL)
+   if (!x509)
      {
         INF("Not a valid certificate.");
         return;
@@ -876,6 +898,9 @@ on_error:
    X509_free(x509);
 # endif /* ifdef HAVE_GNUTLS */
 #else /* ifdef HAVE_SIGNATURE */
+   certificate = NULL;
+   der_length = 0;
+   out = NULL;
    ERR("You need to compile signature support in EET.");
 #endif /* ifdef HAVE_SIGNATURE */
 } /* eet_identity_certificate_print */
@@ -1236,7 +1261,7 @@ eet_hmac_sha1(const void    *key,
    gcry_md_write(mdh, data, data_len);
 
    hash = gcry_md_read(mdh, GCRY_MD_SHA1);
-   if (hash == NULL)
+   if (!hash)
      {
         gcry_md_close(mdh);
         return 1;
index 995d55b..f607e6b 100644 (file)
@@ -727,7 +727,7 @@ eet_data_get_string(const Eet_Dictionary *ed,
            return -1;
 
         str = eet_dictionary_string_get_char(ed, idx);
-        if (str == NULL)
+        if (!str)
            return -1;
 
         *d = (char *)str;
@@ -735,7 +735,7 @@ eet_data_get_string(const Eet_Dictionary *ed,
      }
 
    s = (char *)src;
-   if (s == NULL)
+   if (!s)
      {
         *d = NULL;
         return 0;
@@ -1873,9 +1873,9 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
         || group_type == EET_G_VARIANT)
        &&
        (type != EET_T_UNKNOW
-        || subtype == NULL
-        || subtype->func.type_get == NULL
-        || subtype->func.type_set == NULL))
+        || !subtype
+        || !subtype->func.type_get
+        || !subtype->func.type_set))
       return;
 
    /* VARIANT type will only work if the map only contains EET_G_*, but not UNION, VARIANT and ARRAY. */
@@ -1918,7 +1918,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
        && (group_type < EET_G_LAST)
        && (((type > EET_T_UNKNOW) && (type < EET_T_STRING))
            || ((type > EET_T_NULL) && (type < EET_T_LAST)))
-       && (subtype == NULL))
+       && (!subtype))
      {
         subtype = calloc(1, sizeof (Eet_Data_Descriptor));
         if (!subtype)
@@ -2115,6 +2115,23 @@ _eet_free_add(Eet_Free *ef,
 } /* _eet_free_add */
 
 static void
+_eet_free_del(Eet_Free *ef,
+              void     *data)
+{
+   int hash;
+   int i;
+
+   hash = _eet_free_hash(data);
+
+   for (i = 0; i < ef->num[hash]; ++i)
+      if (ef->list[hash][i] == data)
+       {
+          ef->list[hash][i] = NULL;
+          return;
+       }
+}
+
+static void
 _eet_free_reset(Eet_Free *ef)
 {
    int i;
@@ -2146,6 +2163,7 @@ _eet_free_unref(Eet_Free *ef)
 } /* _eet_free_unref */
 
 #define _eet_freelist_add(Ctx, Data) _eet_free_add(&Ctx->freelist, Data);
+#define _eet_freelist_del(Ctx, Data) _eet_free_del(&Ctx->freelist, Data);
 #define _eet_freelist_reset(Ctx)     _eet_free_reset(&Ctx->freelist);
 #define _eet_freelist_ref(Ctx)       _eet_free_ref(&Ctx->freelist);
 #define _eet_freelist_unref(Ctx)     _eet_free_unref(&Ctx->freelist);
@@ -2162,16 +2180,18 @@ _eet_freelist_free(Eet_Free_Context    *context,
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist.num[j]; ++i)
-        {
-           if (edd)
-              edd->func.mem_free(context->freelist.list[j][i]);
-           else
-              free(context->freelist.list[j][i]);
-        }
+       if (context->freelist.list[j][i])
+         {
+            if (edd)
+              edd->func.mem_free(context->freelist.list[j][i]);
+            else
+              free(context->freelist.list[j][i]);
+         }
    _eet_free_reset(&context->freelist);
 } /* _eet_freelist_free */
 
 #define _eet_freelist_array_add(Ctx, Data) _eet_free_add(&Ctx->freelist_array, Data);
+#define _eet_freelist_array_del(Ctx, Data) _eet_free_del(&Ctx->freelist_array, Data);
 #define _eet_freelist_array_reset(Ctx)     _eet_free_reset(&Ctx->freelist_array);
 #define _eet_freelist_array_ref(Ctx)       _eet_free_ref(&Ctx->freelist_array);
 #define _eet_freelist_array_unref(Ctx)     _eet_free_unref(&Ctx->freelist_array);
@@ -2188,21 +2208,23 @@ _eet_freelist_array_free(Eet_Free_Context    *context,
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist_array.num[j]; ++i)
-        {
-           if (edd)
-            {
-               if (edd->func.array_free)
-                 edd->func.array_free(context->freelist_array.list[j][i]);
-               else
-                 edd->func.mem_free(context->freelist_array.list[j][i]);
-            }
-           else
-              free(context->freelist_array.list[j][i]);
-        }
+       if (context->freelist_array.list[j][i])
+         {
+            if (edd)
+              {
+                 if (edd->func.array_free)
+                   edd->func.array_free(context->freelist_array.list[j][i]);
+                 else
+                   edd->func.mem_free(context->freelist_array.list[j][i]);
+              }
+            else
+              free(context->freelist_array.list[j][i]);
+         }
    _eet_free_reset(&context->freelist_array);
 } /* _eet_freelist_array_free */
 
 #define _eet_freelist_list_add(Ctx, Data) _eet_free_add(&Ctx->freelist_list, Data);
+#define _eet_freelist_list_del(Ctx, Data) _eet_free_del(&Ctx->freelist_list, Data);
 #define _eet_freelist_list_reset(Ctx)     _eet_free_reset(&Ctx->freelist_list);
 #define _eet_freelist_list_ref(Ctx)       _eet_free_ref(&Ctx->freelist_list);
 #define _eet_freelist_list_unref(Ctx)     _eet_free_unref(&Ctx->freelist_list);
@@ -2219,14 +2241,16 @@ _eet_freelist_list_free(Eet_Free_Context    *context,
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist_list.num[j]; ++i)
-        {
-           if (edd)
-              edd->func.list_free(*((void **)(context->freelist_list.list[j][i])));
-        }
+       if (context->freelist_list.list[j][i])
+         {
+            if (edd)
+              edd->func.list_free(*((void **)(context->freelist_list.list[j][i])));
+         }
    _eet_free_reset(&context->freelist_list);
 } /* _eet_freelist_list_free */
 
 #define _eet_freelist_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_str, Data);
+#define _eet_freelist_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_str, Data);
 #define _eet_freelist_str_reset(Ctx)     _eet_free_reset(&Ctx->freelist_str);
 #define _eet_freelist_str_ref(Ctx)       _eet_free_ref(&Ctx->freelist_str);
 #define _eet_freelist_str_unref(Ctx)     _eet_free_unref(&Ctx->freelist_str);
@@ -2242,16 +2266,18 @@ _eet_freelist_str_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist_str.num[j]; ++i)
-        {
-           if (edd)
-              edd->func.str_free(context->freelist_str.list[j][i]);
-           else
-              free(context->freelist_str.list[j][i]);
-        }
+       if (context->freelist_str.list[j][i])
+         {
+            if (edd)
+              edd->func.str_free(context->freelist_str.list[j][i]);
+            else
+              free(context->freelist_str.list[j][i]);
+         }
    _eet_free_reset(&context->freelist_str);
 } /* _eet_freelist_str_free */
 
 #define _eet_freelist_direct_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_direct_str, Data);
+#define _eet_freelist_direct_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_direct_str, Data);
 #define _eet_freelist_direct_str_reset(Ctx)     _eet_free_reset(&Ctx->freelist_direct_str);
 #define _eet_freelist_direct_str_ref(Ctx)       _eet_free_ref(&Ctx->freelist_direct_str);
 #define _eet_freelist_direct_str_unref(Ctx)     _eet_free_unref(&Ctx->freelist_direct_str);
@@ -2268,16 +2294,18 @@ _eet_freelist_direct_str_free(Eet_Free_Context    *context,
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist_direct_str.num[j]; ++i)
-        {
-           if (edd)
-              edd->func.str_direct_free(context->freelist_direct_str.list[j][i]);
-           else
-              free(context->freelist_direct_str.list[j][i]);
-        }
+       if (context->freelist_direct_str.list[j][i])
+         {
+            if (edd)
+              edd->func.str_direct_free(context->freelist_direct_str.list[j][i]);
+            else
+              free(context->freelist_direct_str.list[j][i]);
+         }
    _eet_free_reset(&context->freelist_direct_str);
 } /* _eet_freelist_direct_str_free */
 
 #define _eet_freelist_hash_add(Ctx, Data) _eet_free_add(&Ctx->freelist_hash, Data);
+#define _eet_freelist_hash_del(Ctx, Data) _eet_free_del(&Ctx->freelist_hash, Data);
 #define _eet_freelist_hash_reset(Ctx)     _eet_free_reset(&Ctx->freelist_hash);
 #define _eet_freelist_hash_ref(Ctx)       _eet_free_ref(&Ctx->freelist_hash);
 #define _eet_freelist_hash_unref(Ctx)     _eet_free_unref(&Ctx->freelist_hash);
@@ -2294,12 +2322,13 @@ _eet_freelist_hash_free(Eet_Free_Context    *context,
 
    for (j = 0; j < 256; ++j)
       for (i = 0; i < context->freelist_hash.num[j]; ++i)
-        {
-           if (edd)
-              edd->func.hash_free(context->freelist_hash.list[j][i]);
-           else
-              free(context->freelist_hash.list[j][i]);
-        }
+       if (context->freelist_hash.list[j][i])
+         {
+            if (edd)
+              edd->func.hash_free(context->freelist_hash.list[j][i]);
+            else
+              free(context->freelist_hash.list[j][i]);
+         }
    _eet_free_reset(&context->freelist_hash);
 } /* _eet_freelist_hash_free */
 
@@ -2522,7 +2551,7 @@ _eet_data_dump_encode(int             parent_type,
            _eet_data_words_bigendian = 0;
      }
 
-   if (node == NULL)
+   if (!node)
       return NULL;
 
    ds = eet_data_stream_new();
@@ -3248,17 +3277,12 @@ _eet_data_descriptor_decode(Eet_Free_Context     *context,
                    &echnk,
                    type,
                    group_type,
-                   ede ? (void *)(((char
-                                    *)
-                                   data)
-                                  + ede->
-                                  offset)
-                   : (void **)&result,
+                   ede ? (void *)(((char*) data) + ede->offset) : (void **)&result,
                    &p,
                    &size);
 
              if (ret <= 0)
-                goto error;
+               goto error;
           }
 
         /* advance to next chunk */
@@ -3324,7 +3348,7 @@ eet_data_get_list(Eet_Free_Context     *context,
 
    EET_ASSERT(!((type > EET_T_UNKNOW) && (type < EET_T_STRING)), return 0);
 
-   if (edd)
+   if (ede)
      {
         subtype = ede->subtype;
 
@@ -3403,6 +3427,9 @@ eet_data_get_hash(Eet_Free_Context     *context,
    if (ret <= 0)
       goto on_error;
 
+   if (!key)
+      goto on_error;
+
    /* Advance to next chunk */
    NEXT_CHUNK((*p), (*size), (*echnk), ed);
    memset(echnk, 0, sizeof(Eet_Data_Chunk));
@@ -3412,6 +3439,11 @@ eet_data_get_hash(Eet_Free_Context     *context,
    if (!echnk->name)
       goto on_error;
 
+   if (ede)
+     if ((ede->group_type != echnk->group_type)
+        || (ede->type != echnk->type))
+       goto on_error;
+
    if (IS_POINTER_TYPE(echnk->type))
       POINTER_TYPE_DECODE(context,
                           ed,
@@ -3444,7 +3476,7 @@ eet_data_get_hash(Eet_Free_Context     *context,
    return 1;
 
 on_error:
-   return ret;
+   return 0;
 } /* eet_data_get_hash */
 
 /* var arrays and fixed arrays have to
@@ -3583,6 +3615,7 @@ eet_data_get_array(Eet_Free_Context     *context,
                   memcpy(dst, data_ret, subsize);
                  if (edd) edd->func.mem_free(data_ret);
                  else free(data_ret);
+                 _eet_freelist_del(context, data_ret);
                }
 
              if (!edd)
@@ -3972,7 +4005,7 @@ eet_data_get_variant(Eet_Free_Context        *context,
                                 sede->group_type, data, &p2, &size2);
 
                           if (ret <= 0)
-                             goto on_error;
+                            goto on_error;
 
 /* advance to next chunk */
                           NEXT_CHUNK(p2, size2, chnk, ed);
@@ -4123,7 +4156,7 @@ eet_data_get_unknown(Eet_Free_Context     *context,
                   str = (char **)(((char *)data));
                   if (*str)
                     {
-                       if ((ed == NULL) || (edd->func.str_direct_alloc == NULL))
+                       if ((!ed) || (!edd->func.str_direct_alloc))
                          {
                             *str = edd->func.str_alloc(*str);
                             _eet_freelist_str_add(context, *str);
index 7e86d08..2c7f24c 100644 (file)
@@ -46,8 +46,10 @@ eet_dictionary_free(Eet_Dictionary *ed)
 static int
 _eet_dictionary_lookup(Eet_Dictionary *ed,
                        const char     *string,
+                      int             len,
                        int             hash)
 {
+   Eina_Bool found = EINA_FALSE;
    int prev = -1;
    int current;
 
@@ -55,19 +57,28 @@ _eet_dictionary_lookup(Eet_Dictionary *ed,
 
    while (current != -1)
      {
-        if (ed->all[current].str)
-           if (strcmp(ed->all[current].str, string) >= 0)
-              break;
-
-        if (ed->all[current].mmap)
-           if (strcmp(ed->all[current].mmap, string) >= 0)
-              break;
+       if (ed->all[current].len == len)
+         {
+            if (ed->all[current].str)
+              if (strcmp(ed->all[current].str, string) == 0)
+                {
+                   found = EINA_TRUE;
+                   break;
+                }
+
+            if (ed->all[current].mmap)
+              if (strcmp(ed->all[current].mmap, string) == 0)
+                {
+                   found = EINA_TRUE;
+                   break;
+                }
+         }
 
         prev = current;
         current = ed->all[current].next;
      }
 
-   if (current == -1)
+   if (current == -1 && found)
       return prev;
 
    return current;
@@ -87,19 +98,19 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
       return -1;
 
    hash = _eet_hash_gen(string, 8);
+   len = strlen(string) + 1;
 
-   idx = _eet_dictionary_lookup(ed, string, hash);
+   idx = _eet_dictionary_lookup(ed, string, len, hash);
 
    if (idx != -1)
      {
         if (ed->all[idx].str)
-           if (strcmp(ed->all[idx].str, string) == 0)
-              return idx;
+         if (strcmp(ed->all[idx].str, string) == 0)
+           return idx;
 
         if (ed->all[idx].mmap)
-           if (strcmp(ed->all[idx].mmap, string) == 0)
-              return idx;
-
+         if (strcmp(ed->all[idx].mmap, string) == 0)
+           return idx;
      }
 
    if (ed->total == ed->count)
@@ -110,16 +121,15 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
         total = ed->total + 8;
 
         new = realloc(ed->all, sizeof (Eet_String) * total);
-        if (new == NULL)
+        if (!new)
            return -1;
 
         ed->all = new;
         ed->total = total;
      }
 
-   len = strlen(string) + 1;
    str = strdup(string);
-   if (str == NULL)
+   if (!str)
       return -1;
 
    current = ed->all + ed->count;
@@ -201,7 +211,7 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed,
      {
 #ifdef _WIN32
         /* Windows file system could change the mmaped file when replacing a file. So we need to copy all string in memory to avoid bugs. */
-        if (ed->all[idx].str == NULL)
+        if (!ed->all[idx].str)
           {
              ed->all[idx].str = strdup(ed->all[idx].mmap);
              ed->all[idx].mmap = NULL;
@@ -397,7 +407,7 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
 {
    int i;
 
-   if ((ed == NULL) || (string == NULL))
+   if ((!ed) || (!string))
       return 0;
 
    if ((ed->start <= string) && (string < ed->end))
index 9c52dfd..077d18b 100644 (file)
@@ -55,8 +55,9 @@ struct jpeg_membuf_src
 {
    struct jpeg_source_mgr pub;
 
-   const unsigned char   *buf;
-   size_t                 len;
+   const unsigned char    *buf;
+   size_t                  len;
+   struct jpeg_membuf_src *self;
 };
 
 static void
@@ -91,7 +92,9 @@ _eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
 static void
 _eet_jpeg_membuf_src_term(j_decompress_ptr cinfo)
 {
-   free(cinfo->src);
+   struct jpeg_membuf_src *src = ((struct jpeg_membuf_src *)cinfo->src)->self;
+   
+   free(src);
    cinfo->src = NULL;
 } /* _eet_jpeg_membuf_src_term */
 
@@ -102,10 +105,12 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo,
 {
    struct jpeg_membuf_src *src;
 
-   src = malloc(sizeof(*src));
+   src = calloc(1, sizeof(*src));
    if (!src)
       return -1;
 
+   src->self = src;
+   
    cinfo->src = &src->pub;
    src->buf = buf;
    src->len = len;
@@ -130,6 +135,7 @@ struct jpeg_membuf_dst
    unsigned char              *buf;
    size_t                      len;
    int                         failed;
+   struct jpeg_membuf_dst     *self;
 };
 
 static void
@@ -146,7 +152,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
    unsigned char *buf;
 
    if (dst->len >= 0x40000000 ||
-       (buf = realloc(dst->buf, dst->len * 2)) == NULL)
+       !(buf = realloc(dst->buf, dst->len * 2)))
      {
         dst->failed = 1;
         dst->pub.next_output_byte = dst->buf;
@@ -166,7 +172,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
 static void
 _eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
 {
-   struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
+   struct jpeg_membuf_dst *dst = ((struct jpeg_membuf_dst *)cinfo->dest)->self;
 
    if (dst->failed)
      {
@@ -191,7 +197,7 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
 {
    struct jpeg_membuf_dst *dst;
 
-   dst = malloc(sizeof(*dst));
+   dst = calloc(1, sizeof(*dst));
    if (!dst)
       return -1;
 
@@ -202,6 +208,7 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
         return -1;
      }
 
+   dst->self = dst;
    dst->len = 32768;
 
    cinfo->dest = &dst->pub;
@@ -1279,7 +1286,7 @@ eet_data_image_encode_cipher(const void  *data,
 
         /* eet_data_image_lossless_compressed_convert will refuse to compress something
            if the result is bigger than the entry. */
-        if (comp <= 0 || d == NULL)
+        if (comp <= 0 || !d)
            d = eet_data_image_lossless_convert(&size, data, w, h, alpha);
      }
    else
@@ -1563,7 +1570,8 @@ _eet_data_image_decode_inside(const void   *data,
                   Bytef *dtmp;
                   uLongf dlen = src_w * src_h * 4;
 
-                  /* FIXME: This could create a huge alloc. So compressed data and tile could not always work. */
+                  /* FIXME: This could create a huge alloc. So compressed 
+                   data and tile could not always work. */
                   dtmp = malloc(dlen);
                   if (!dtmp)
                      return 0;
index c1ca7fa..d4b0ec1 100644 (file)
@@ -715,7 +715,7 @@ eet_init(void)
         return --eet_init_count;
      }
 
-   _eet_log_dom_global = eina_log_domain_register("Eet", EET_DEFAULT_LOG_COLOR);
+   _eet_log_dom_global = eina_log_domain_register("eet", EET_DEFAULT_LOG_COLOR);
    if (_eet_log_dom_global < 0)
      {
         EINA_LOG_ERR("Eet Can not create a general log domain.");
@@ -748,12 +748,12 @@ eet_init(void)
               "BIG FAT WARNING: I AM UNABLE TO REQUEST SECMEM, Cryptographic operation are at risk !");
      }
 
-#ifdef EFL_HAVE_POSIX_THREADS
+# ifdef EFL_HAVE_POSIX_THREADS
    if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
       WRN(
          "YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
 
-#endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
    if (gnutls_global_init())
       goto shutdown_eet;
 
@@ -765,7 +765,9 @@ eet_init(void)
 
    return eet_init_count;
 
+#ifdef HAVE_GNUTLS
 shutdown_eet:
+#endif   
    eet_node_shutdown();
 unregister_log_domain:
    eina_log_domain_unregister(_eet_log_dom_global);
@@ -915,11 +917,11 @@ eet_internal_read2(Eet_File *ef)
    bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE *
       num_dictionary_entries;
 
-   /* we cant have <= 0 values here - invalid */
+   /* we can't have <= 0 values here - invalid */
    if (eet_test_close((num_directory_entries <= 0), ef))
       return NULL;
 
-   /* we cant have more bytes directory and bytes in dictionaries than the size of the file */
+   /* we can't have more bytes directory and bytes in dictionaries than the size of the file */
    if (eet_test_close((bytes_directory_entries + bytes_dictionary_entries) >
                       ef->data_size, ef))
       return NULL;
@@ -958,9 +960,14 @@ eet_internal_read2(Eet_File *ef)
 
         /* out directory block is inconsistent - we have oveerun our */
         /* dynamic block buffer before we finished scanning dir entries */
-        efn = malloc (sizeof(Eet_File_Node));
+        efn = malloc(sizeof(Eet_File_Node));
         if (eet_test_close(!efn, ef))
-           return NULL;
+          {
+             if (efn) free(efn); /* yes i know - we only get here if 
+                                  * efn is null/0 -> trying to shut up
+                                  * warning tools like cppcheck */
+             return NULL;
+          }
 
         /* get entrie header */
         GET_INT(efn->offset,    data, idx);
@@ -1117,7 +1124,7 @@ eet_internal_read2(Eet_File *ef)
                                           &ef->signature_length,
                                           &ef->x509_length);
 
-        if (eet_test_close(ef->x509_der == NULL, ef))
+        if (eet_test_close(!ef->x509_der, ef))
            return NULL;
 
 #else /* ifdef HAVE_SIGNATURE */
@@ -1162,7 +1169,7 @@ eet_internal_read1(Eet_File *ef)
    EXTRACT_INT(num_entries,  ef->data, idx);
    EXTRACT_INT(byte_entries, ef->data, idx);
 
-   /* we cant have <= 0 values here - invalid */
+   /* we can't have <= 0 values here - invalid */
    if (eet_test_close((num_entries <= 0) || (byte_entries <= 0), ef))
       return NULL;
 
@@ -1220,7 +1227,12 @@ eet_internal_read1(Eet_File *ef)
         /* allocate all the ram needed for this stored node accounting */
         efn = malloc (sizeof(Eet_File_Node));
         if (eet_test_close(!efn, ef))
-           return NULL;
+          {
+             if (efn) free(efn); /* yes i know - we only get here if 
+                                  * efn is null/0 -> trying to shut up
+                                  * warning tools like cppcheck */
+             return NULL;
+          }
 
         /* get entrie header */
         EXTRACT_INT(efn->offset,      p, indexn);
@@ -1264,7 +1276,7 @@ eet_internal_read1(Eet_File *ef)
         if (efn->free_name)
           {
              efn->name = malloc(sizeof(char) * name_size + 1);
-             if (eet_test_close(efn->name == NULL, ef))
+             if (eet_test_close(!efn->name, ef))
                {
                   free(efn);
                   return NULL;
@@ -1279,7 +1291,7 @@ eet_internal_read1(Eet_File *ef)
                 efn->name);
           }
         else
-           /* The only really usefull peace of code for efn->name (no backward compatibility) */
+           /* The only really useful peace of code for efn->name (no backward compatibility) */
            efn->name = (char *)((unsigned char *)(p + HEADER_SIZE));
 
         /* get hash bucket it should go in */
@@ -1318,7 +1330,7 @@ eet_internal_read(Eet_File *ef)
 {
    const int *data = (const int *)ef->data;
 
-   if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
+   if (eet_test_close((ef->data == (void *)-1) || (!ef->data), ef))
       return NULL;
 
    if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef))
@@ -1454,7 +1466,7 @@ eet_memopen_read(const void *data,
 {
    Eet_File *ef;
 
-   if (data == NULL || size == 0)
+   if (!data || size == 0)
       return NULL;
 
    ef = malloc (sizeof (Eet_File));
@@ -1552,7 +1564,7 @@ eet_open(const char   *file,
           }
 
 open_error:
-        if (fp == NULL && mode == EET_FILE_MODE_READ)
+        if (!fp && mode == EET_FILE_MODE_READ)
            goto on_error;
      }
    else
@@ -1579,7 +1591,7 @@ open_error:
    if (ef)
      {
         /* reference it up and return it */
-        if (fp != NULL)
+        if (fp)
            fclose(fp);
 
         ef->references++;
@@ -1613,10 +1625,10 @@ open_error:
    ef->sha1_length = 0;
 
    ef->ed = (mode == EET_FILE_MODE_WRITE)
-      || (ef->readfp == NULL && mode == EET_FILE_MODE_READ_WRITE) ?
+      || (!ef->readfp && mode == EET_FILE_MODE_READ_WRITE) ?
       eet_dictionary_add() : NULL;
 
-   if (ef->readfp == NULL &&
+   if (!ef->readfp &&
        (mode == EET_FILE_MODE_READ_WRITE || mode == EET_FILE_MODE_WRITE))
       goto empty_file;
 
@@ -1783,7 +1795,7 @@ eet_read_cipher(Eet_File   *ef,
      {
         void *data_deciphered = NULL;
         unsigned int data_deciphered_sz = 0;
-        /* if we alreayd have the data in ram... copy that */
+        /* if we already have the data in ram... copy that */
 
         if (efn->data)
            memcpy(data, efn->data, efn->size);
@@ -1936,7 +1948,7 @@ eet_read_direct(Eet_File   *ef,
    if (!efn)
       goto on_error;
 
-   if (efn->offset < 0 && efn->data == NULL)
+   if (efn->offset < 0 && !efn->data)
       goto on_error;
 
    /* get size (uncompressed, if compressed at all) */
@@ -2261,7 +2273,7 @@ eet_write_cipher(Eet_File   *ef,
         unsigned int data_ciphered_sz = 0;
         const void *tmp;
 
-        tmp = data2 ? data2 : data;
+        tmp = comp ? data2 : data;
         if (!eet_cipher(tmp, data_size, cipher_key, strlen(cipher_key),
                         &data_ciphered, &data_ciphered_sz))
           {
@@ -2281,8 +2293,8 @@ eet_write_cipher(Eet_File   *ef,
           }
      }
    else
-   if (!comp)
-      memcpy(data2, data, size);
+     if (!comp)
+       memcpy(data2, data, size);
 
    /* Does this node already exist? */
    for (efn = ef->header->directory->nodes[hash]; efn; efn = efn->next)
@@ -2385,7 +2397,7 @@ eet_delete(Eet_File   *ef,
              if (efn->data)
                 free(efn->data);
 
-             if (pefn == NULL)
+             if (!pefn)
                 ef->header->directory->nodes[hash] = efn->next;
              else
                 pefn->next = efn->next;
index fd4f07a..db1c58c 100644 (file)
@@ -606,7 +606,7 @@ eet_node_dump(Eet_Node *n,
               dumpfunc(dumpdata, "\";\n");
            }
 
-         for (it = n->values; it != NULL; it = it->next)
+         for (it = n->values; it; it = it->next)
             eet_node_dump(it, dumplevel + 2, dumpfunc, dumpdata);
 
          eet_node_dump_group_end(dumplevel, dumpfunc, dumpdata);
@@ -653,7 +653,7 @@ eet_node_walk(void          *parent,
       case EET_G_UNKNOWN:
          me = cb->struct_alloc(root->name, user_data);
 
-         for (it = root->values; it != NULL; it = it->next)
+         for (it = root->values; it; it = it->next)
             eet_node_walk(me, it->name, it, cb, user_data);
 
          break;
@@ -663,7 +663,7 @@ eet_node_walk(void          *parent,
          me = cb->array(root->type == EET_G_VAR_ARRAY ? EINA_TRUE : EINA_FALSE,
                         root->name, root->count, user_data);
 
-         for (i = 0, it = root->values; it != NULL; it = it->next)
+         for (i = 0, it = root->values; it; it = it->next)
             cb->insert(me, i++, eet_node_walk(NULL,
                                               NULL,
                                               it,
@@ -675,7 +675,7 @@ eet_node_walk(void          *parent,
       case EET_G_LIST:
          me = cb->list(root->name, user_data);
 
-         for (it = root->values; it != NULL; it = it->next)
+         for (it = root->values; it; it = it->next)
             cb->append(me, eet_node_walk(NULL,
                                          NULL,
                                          it,
index 9c4d5f0..af96a91 100644 (file)
@@ -2738,7 +2738,7 @@ main(void)
 
    s = eet_suite();
    sr = srunner_create(s);
-   srunner_run_all(sr, CK_NORMAL);
+   srunner_run_all(sr, CK_ENV);
    failed_count = srunner_ntests_failed(sr);
    srunner_free(sr);