Commit Graph

462 Commits

Author SHA1 Message Date
Jaeun Choi 3cd2801be7 eina: safety check for NULL pointer
data should not be NULL. it is used as the source of memcpy.

@fix
2015-03-19 16:15:20 +09:00
Cedric BAIL 9d29f80eb1 eina: provide a generic eina_binbuf_manage_new.
eina_binbuf_manage_new provide the functionnality of both eina_binbuf_manage_new_length
and eina_binbuf_manage_read_only_new_length. Those function get deprecated.
2015-03-17 09:58:20 +01:00
Mykyta Biliavskyi 37c58d4397 eina: extend eina_str_escape to escape more common case.
Summary: Added new symbols, that will be escaped. There are '\"', '\t' and '\n'.

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2130

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-13 09:33:28 +01:00
Michelle Legrand f6d870b4c1 eina: win32 release lock in case of error
Summary:
It's better to realese the lock before returning NULL. Otherwise the program
is waiting indefinitely then crashing on Windows ("program not responding").

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-12 07:43:58 +01:00
Michelle Legrand b36e2fc701 eina: add more access to created file.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-12 07:43:58 +01:00
Carsten Haitzler 009ec26460 eina + ecore - fix main loop thread id tracking on fork
if you fork and even if you do ecore_fork_reset() a thread calling
ecore_main_loop_thread_safe_call_async(0 for example eill end up
resetting the mainloop thread id to itself (a non mainlopo thread) via
calling eina_main_loop_is() since pid changed. there is little point
in doing this so remove the pid tracking from eina and ensure mainloop
thread id is updated in ecore's fork reset.

@fix
2015-02-26 19:47:51 +09:00
vivek 2ae90fd1ff eina_str: add null check condition in eina_memdup.
Summary:
Added null check in eina_memdup function in eina_str

Signed-off-by: vivek <vivek.ellur@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1997

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-20 11:42:13 +01:00
Vincent Torri 06fe2fad0e eina: remove useless eina_inline_lock_win32.x file. 2015-02-13 11:05:27 +01:00
Guilherme Lepsch 7a302f12d9 eina: Fix MacOS X build with clang 3.6.
Summary:
printf contains and erroneous format specifier and cast
missing LIBTOOLFLAGS for cocoa

Reviewers: felipealmeida, larryolj, naguirre

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1912

Signed-off-by: Nicolas Aguirre <aguirre.nicolas@gmail.com>
2015-02-12 07:55:33 +01:00
Nicolas Aguirre 3b52489368 eina: fix directory listing on windows when directory is empty.
Using of INVALID_HANDLE_VALUE and ERROR_NO_MORE_FILES to handle this properlly.

@fix
2015-02-11 17:03:39 +01:00
michelle legrand 9579624765 eina: fix Eina_Log to only try to free non deleted log.
@fix
2015-02-11 17:03:37 +01:00
Adrien Nader f71a78edcb eina: correctly handle and report Eina_File error on Windows.
@fix
2015-02-11 16:38:15 +01:00
Adrien Nader 9d1504dba1 eina: remove Eina_Counter and use provided Windows posix compatible implementation. 2015-02-11 16:38:15 +01:00
Adrien Nader 2cb0c1cadc eina: remove Windows specific thread implementation and rely on posix compliant library instead. 2015-02-11 16:38:10 +01:00
Tom Hacohen b5011fa867 Eina tmpstr: Fix tmpstr_strlen.
Weird. This is the code I had, I don't know how it got lost.

Good job to Daniel Kolesa for spotting this.
2015-02-10 09:53:29 +00:00
Tom Hacohen 8fbee3fac0 Eina tmpstr: remove usage of tmpstr_strlen(). 2015-02-09 14:02:40 +00:00
Tom Hacohen fb8dfe98cd Eina tmpstr: fix race condition.
We take a lock, search the list, and the release the lock before we
finish using the values of the list. While unlikely, the string could be
deleted in the meanwhile.
2015-02-09 13:55:13 +00:00
Tom Hacohen f7a6880d5b Eina tmpstr: deprecate tmpstr_strlen and add tmpstr_len.
Confusingly enough, strlen was actually returning strlen + 1 for
strings. The new functions behaves as expected.
2015-02-09 13:55:13 +00:00
pierre lamot 6fd31ab552 eina: fix semaphore initialisation
This patch fix the semaphore initialisation on posix plateform

there was a preconditon test which returned the semaphore
uninitialised when count_init was 1, this caused the semaphore to
be unusable on OSX plateform. Furthermore, it seems that we need to
unlink the semaphore before its initialisation on OSX as there seems
to have some kind of persistence of the semaphore accross execution.

warning, this patch change the signification of the parametter
count_init on linux plateform, this parametter is now consistent on
every plateform, with the meaning of setting the initial count value
of the semaphore.

This used to be on linux 1 -> the semaphore is shared and initialised
at 1 and 0 -> the semaphore is not initialised, thus, by side effect
not shared and initialised at 0.

This patch set on linux plateform the semaphore as systematically
shared

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 16:38:06 +01:00
vivek e1eff60c80 eina: Eina_Value - use eina_mempool_free to cleanup the memory
Summary:
The new value is allocated using Eina_Mempool, it should be freed using
eina_mempool, not using libc free.

@fix

Signed-off-by: vivek <vivek.ellur@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1940

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 15:37:15 +01:00
Daniel Hirt 7143bd7fb5 eina: fix valgrind invalid read of size in eina_file_path_sanitize.
Summary:
Apparently eina_tmpstr_strlen counts the null character as well. This
doesn't follow how strlen works, as the latter excludes it from the count.
This resulted in mistreatment of the string in _eina_file_escape, with
tmp_str paths that had "../".

This fix will do for now, but it is advised that we avoid using
eina_tmpstr_strlen, to prevent such confusions in the future.

Test Plan:
The following lines will throw a valgrind 'invalid read of size 1' error
prior this fix:
  char *path = "home/mydir/../myfile";
  Eina_Tmpstr *tmp_str = eina_tmpstr_add(path);
  char *ret_path = eina_file_path_sanitize(path);

@fix

Reviewers: cedric, stefan_schmidt

Subscribers: tasn, cedric

Differential Revision: https://phab.enlightenment.org/D1929

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-04 14:08:36 +01:00
Daniel Hirt 7cbf22212f Revert "eina: eina_file - fix "invalid read of size 1" in valgrind"
This reverts commit f52f562891.

This is reverted because it breaks eina_file_path_sanitize when using
  "/../" in paths, for example:
eina_file_path_sanitize("/home/../mydir/myfile")
  returns: "/mydir/myfili"

What invalid read size does this fix? Why was no test case specified?
Anyway, this change affects too much code to leave it in like this.
2015-02-02 14:41:37 +02:00
Romain Perier f52f562891 eina: eina_file - fix "invalid read of size 1" in valgrind
@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-01-30 10:49:58 +01:00
Nicolas Aguirre 0e671630f1 eina: use uintptr_t for Eina_Thread storage to be the same size for the different architectures.
This should not be an ABI regression on the platform where it work (Unix). It is on Windows,
but the API was unusable at all without this change, so this is a necessary breakage to
unbreak things.

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-01-30 10:49:55 +01:00
Carsten Haitzler 6bd34e2ae9 eina mmap safety handler - fix on systems without some sibgus types
this fixes 615456aae8 to compile on
systems without MCERR sigbus types.
2015-01-14 19:16:35 +09:00
Vasyl Vavrychuk b613404452 eina: fix eina_log with journald.
Summary:
Nothing was printed to journald before because sd_journal_send_with_location
expects file and line to be of the NAME=VALUE form.

Change-Id: I382b82b665558fddebae61b7d0a8d4de87638511
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>

Reviewers: kuri, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1865

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-01-13 16:18:24 +01:00
Carsten Haitzler 615456aae8 eina - mmap safety handler - fix to only handle sigbus's from io
@fix

this fixes the eina mmap safety handler to only  handle what comes
from actual i/o errors (not actual corrupt/hw memory faults or invalid
objects), and if it's not a sigbus eina mmap should handle then pass
it onto the previous handler before eina mmap took over.
2015-01-13 19:30:11 +09:00
Cedric BAIL 9a74e6aec4 eina: all Eina_Stringshare printf variant now return empty string as expected.
Previously Eina_Stringshare printf variant where returning NULL with ("%s", ""). This
is highly disturbing as you would have gotten "(null)", if you asked for ("s", NULL).
To clarify and make things logical, we now return "".
2015-01-08 12:36:27 +01:00
Amitesh Singh 32d52ff563 eina: fix memory leaks in eina_stringshare_printf/vprintf functions.
Summary: @Fix

Test Plan:
  CK_FORK=no valgrind --leak-check=full {UNIT_TEST_PROGRAM} "String Share"

Reviewers: cedric, seoz, Hermet, raster

Subscribers: cedric, seoz

Differential Revision: https://phab.enlightenment.org/D1857
2015-01-08 19:48:01 +09:00
Srivardhan Hebbar 1d25d6da79 eina: fix memory leak issue in Eina_Value.
Summary:
eina_inarray_free was not called. So calling it to fix the memory leak.

@fix

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1808

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-12-25 21:37:05 +01:00
Srivardhan Hebbar 701f7b0737 eina: add an example to demonstrate different eina insert and sort functions.
Summary:
While going through eina for understanding, wrote  a program to understand
he differences between different eina inarray functions. Thought, this might
be useful for others too, so adding the same.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1803

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-12-22 15:09:59 +01:00
Tom Hacohen 5c96fd457e Eina streq: remove redundant code in eina_streq. 2014-12-16 09:23:43 +00:00
Mike Blumenkrantz 10d8199b2f +eina_memdup
for those times when three lines of code should be one

@feature
2014-12-15 14:32:42 -05:00
Mike Blumenkrantz 5cda4c1eb5 eina_streq should immediately return true if both pointers are the same 2014-12-15 14:32:42 -05:00
kabeer khan 378157ba1e eina_thread: fix memory leak
Summary: Signed-off-by: kabeer khan <kabeer.khan@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1737
2014-12-08 09:21:03 +01:00
Tae-Hwan Kim 3b9f8b2648 eina: enhance doxygen in eina_counter.h
Summary:
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Fix indentation & Fix typeof

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1651

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-11-14 07:05:17 +01:00
Jean Guyomarc'h 5c91d7aa10 eina: fix calloc() parameters order in eina_share.
Summary: The first parameter must be the count of elements to be allocated.

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1660

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-11-14 06:49:59 +01:00
Jean-Philippe ANDRE d0bae13693 Eina lock: try to fix compilation for OSX
This is a quick fix.

It looks like OSX doesn't provide the same infra as linux for
cond_timedwait, but instead they provide directly a
relative time wait function. Since I don't have any build / test
environment for OSX, this is as far as I can go.

Arguably, OSX libc seems to use gettimeofday() for cond_timedwait,
so this should close T1701.

See the pthread cond implementation:
http://www.opensource.apple.com/source/Libc/Libc-167/pthreads.subproj/pthread_cond.c
2014-11-02 15:14:36 +09:00
Tae-Hwan Kim 339ae93f82 eina: enhance doxygen in eina_magic.h
Summary:
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof
Use @p instead of @a for the consistency

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1620

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-31 09:28:07 +01:00
Tae-Hwan Kim 2dad982410 eina: group eina_sched
Summary:
Schedule group is made for eina_sched_xxx.
It is grouped into Tools group.
Futher description is needed later.

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1623

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-31 09:26:49 +01:00
Tae-Hwan Kim 980cd1ee57 eina: enhance doxgen for Eina_Trash
Summary:
Move doxygen comments from .x file to .h file

Basic rules are below:
Arrange grouping
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof
Use @p instead of @a for the consistency

Reviewers: raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1624

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-31 09:25:51 +01:00
Tae-Hwan Kim ea9130c50b eina: enhance doxygen in eina_prefix.h
Summary:
Arrange grouping
 - Move Prefix group below Tools group
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof
Use @p instead of @a for the consistency

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1618

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-31 09:24:39 +01:00
Cedric BAIL 02bcdf056e eina: clear up eina_tmpstr length information
This @fix a potential wrong return value according to documentation and
improve consistency accross this API. This should fix T1775.
2014-10-31 02:40:08 +01:00
Jean-Philippe Andre 864394e793 Eina: Fix eina_condition_timedwait once again
Much confusion with this spaghetti code of #ifdefs and clocks.
So, we can't use CPU clocks for the timedwait, this doesn't make
sense (and it's explicit in the manpage, too).

But we can use CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW which are
much better than the wall clock (because of ntp updates, etc...)

The test case tests that the cond actually waited for as long as was
requested and for not too long either.

This is hopefully a final fix for T1701.
2014-10-30 20:21:41 +09:00
Jean-Philippe Andre 03cc403228 Eina file: Fix calls to getenv
There seems to be an intent to check that UID==EUID
before calling getenv to get the temp directory.
But that was lost in commits 61478af3a6 and
then in e105abc99e.
2014-10-30 18:23:49 +09:00
Tae-Hwan Kim 24ee38f3c1 eina: enhance doxygen in eina_file.h
Summary:
Arrange grouping
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof
Use @p instead of @a for the consistency

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1611

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-30 08:49:03 +01:00
Tae-Hwan Kim 4c9995f4ee eina: enhance doxygen in eina_mempool.h
Summary:
Arrange grouping
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof
Use @p instead of @a for the consistency

Reviewers: raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1612

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-30 08:47:36 +01:00
Tae-Hwan Kim 9a1ccdcdeb eina: enhance doxygen in eina_lock.h
Summary:
Arrange grouping
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Add @see more
Add links for EINA_TRUE, EINA_FALSE, etc.
Fix indentation & Fix typeof

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1598

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-29 22:40:09 +01:00
Tae-Hwan Kim a14fc0cc9e eina: enhance doxygen in eina_clist.h
Summary:
Arrange grouping
Add @brief for brief description
Add @details for detailed description
Add @note for noted description
Add [in] & [out] for parameters
Fix indentation & Fix typeof

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1601

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-29 22:38:11 +01:00
artem.popov 1fb06dc09b eina_unicode: fix memory allocation
Summary:
there is wrong memory allocation, Eina_Unicode has 4 bytes, allocation
is like for char
@fix

Reviewers: Hermet, seoz, raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1609

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-29 22:38:11 +01:00