Portability: use g_ascii_strtoll instead of strtoll, atoll and atof.

Set minimal version of GLib up to 2.12 because of g_ascii_strtoll.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-12-07 14:32:46 +04:00
parent e574972d58
commit 17cadc50ec
6 changed files with 9 additions and 18 deletions

View File

@ -226,7 +226,6 @@ dnl Check for functions
dnl ############################################################################
AC_CHECK_FUNCS([\
atoll \
isascii \
statfs sysconf \
tcgetattr tcsetattr \

View File

@ -1148,7 +1148,7 @@ load_file_position (const vfs_path_t * filename_vpath, long *line, long *column,
{
size_t i;
*offset = strtoll (pos_tokens[2], NULL, 10);
*offset = (off_t) g_ascii_strtoll (pos_tokens[2], NULL, 10);
for (i = 0; i < MAX_SAVED_BOOKMARKS && pos_tokens[3 + i] != NULL; i++)
{

View File

@ -778,11 +778,7 @@ vfs_parse_ls_lga (const char *p, struct stat * s, char **filename, char **linkna
if (!is_num (idx2))
goto error;
#ifdef HAVE_ATOLL
s->st_size = (off_t) atoll (columns[idx2]);
#else
s->st_size = (off_t) atof (columns[idx2]);
#endif
s->st_size = (off_t) g_ascii_strtoll (columns[idx2], NULL, 10);
#ifdef HAVE_STRUCT_STAT_ST_RDEV
s->st_rdev = 0;
#endif

View File

@ -8,12 +8,12 @@ AC_DEFUN([AC_G_MODULE_SUPPORTED], [
g_module_supported=""
found_gmodule=no
PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.8], [found_gmodule=yes], [:])
PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.12], [found_gmodule=yes], [:])
if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-no-export-2.0"
else
dnl try fallback to the generic gmodule
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.8], [found_gmodule=yes], [:])
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.12], [found_gmodule=yes], [:])
if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-2.0"
fi
@ -80,9 +80,9 @@ AC_DEFUN([AC_CHECK_GLIB], [
AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
glib_found=no
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12], [glib_found=yes], [:])
if test x"$glib_found" = xno; then
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.12)])
fi
])

View File

@ -778,11 +778,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
break;
}
case 'S':
#ifdef HAVE_ATOLL
ST.st_size = (off_t) atoll (buffer + 1);
#else
ST.st_size = (off_t) atof (buffer + 1);
#endif
ST.st_size = (off_t) g_ascii_strtoll (buffer + 1, NULL, 10);
break;
case 'P':
{
@ -1016,7 +1012,7 @@ fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
#if SIZEOF_OFF_T == SIZEOF_LONG
fish->total = (off_t) strtol (reply_str, NULL, 10);
#else
fish->total = (off_t) strtoll (reply_str, NULL, 10);
fish->total = (off_t) g_ascii_strtoll (reply_str, NULL, 10);
#endif
if (errno != 0)
ERRNOR (E_REMOTE, 0);

View File

@ -225,7 +225,7 @@ mcview_dialog_goto (mcview_t * view, off_t * offset)
off_t addr;
char *error;
addr = strtoll (exp, &error, base);
addr = (off_t) g_ascii_strtoll (exp, &error, base);
if ((*error == '\0') && (addr >= 0))
{
switch (current_goto_type)