Fix pointer cast incompatible with 64 bit architectures 66/19266/2
authorIlya Palachev <i.palachev@samsung.com>
Wed, 9 Apr 2014 13:40:03 +0000 (17:40 +0400)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 14 Apr 2014 11:40:06 +0000 (20:40 +0900)
commitda09767c8c3c7aecdc8bcc1b8a165e6ecf0a3075
tree98651bc73341a796b641ad8007e32a7a746612f2
parentae100b8c664be9546c038a1f6814cce9ae91ef5f
Fix pointer cast incompatible with 64 bit architectures

Tizen toolchain team in Samsung company is planning to build Tizen
for new arm 64 bit architecture - Aarch64. But package
"org.tizen.data-provider-slave" cannot be built for this architecture
because of the following build error:

error: cast from pointer to integer of different size

The reason that there is cast from type (int*) to type (int) in the
current implementation of function util_get_current_module. This cast
is correct for 32-bit architectures, since on them both (int*) and
(int) have the same size - 32 bits. But on 64-bit architectures
(int*) has size 64 bit and (int) has size 32 bit, and cast from one
to another can provide incorrect results.

This problem can be fixed just by simple replacement of (int)
variables with (size_t) variables, since it does not change the logic
of code and provide additional compatibility with 64-bit
architectures. This fix does not affect other functions, since only
types of local variables are changed.

The patch has been checked for build compatibility under armv7l, i586
and aarch64 architectures and build results are available at
https://build.tizen.org/package/show?package=org.tizen.data-provider-slave&project=devel%3Aarm_toolchain%3AMobile%3AMain

Change-Id: I21c47349f7d41f5b10a33f3772775cc208a43f75
Signed-off-by: Ilya Palachev <i.palachev@samsung.com>
src/util.c