Ticket #419 (new wishlist)

Opened 8 years ago

replace calls to _itoa() in libsrc/earlybird/geotools.c

Reported by: baker Owned by: somebody
Priority: minor Milestone: All Platforms
Component: ALL modules Version: 7.7
Keywords: itoa Cc:

Description

I am running into errors -static linking (on Linux) anything that picks up geotools.o in lib/libepick.a. I get multiply defined symbol _itoa, due to the definition of _itoa.o in libc.a. Commenting out the definition of _itoa() in libsrc/earlybird/geotools.c cures the problem for -static linking, but I get an undefined reference to _itoa when I revert back to linking with shared libraries.

Clearly there is something messed up with libc.so and libc.a.

However, itoa()/_itoa() is not standard C, so earlybird should really be using something standard instead.

There are only a couple places where _itoa() is called. All but one use either base 10 or base 16, and can be replaced with calls to spritf() using %d and %x. The one remaining call uses base 36. That could be hand written to do the conversion, since it is a special case.

There are a couple other modules that use itoa(). None of them are compiled on Linux (perhaps because there is no itoa() on Linux?). It looks like all of them could be rewritten to replace itoa() with sprintf() using %d.

Note: See TracTickets for help on using tickets.