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 3b6f3697f9
commit bcb8c376ef
6 changed files with 9 additions and 18 deletions

View File

@ -162,7 +162,6 @@ dnl Check availability of some functions
dnl dnl
AC_CHECK_FUNCS([\ AC_CHECK_FUNCS([\
atoll \
isascii \ isascii \
statfs sysconf \ statfs sysconf \
tcgetattr tcsetattr \ tcgetattr tcsetattr \

View File

@ -1145,7 +1145,7 @@ load_file_position (const vfs_path_t * filename_vpath, long *line, long *column,
{ {
size_t i; 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++) 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)) if (!is_num (idx2))
goto error; goto error;
#ifdef HAVE_ATOLL s->st_size = (off_t) g_ascii_strtoll (columns[idx2], NULL, 10);
s->st_size = (off_t) atoll (columns[idx2]);
#else
s->st_size = (off_t) atof (columns[idx2]);
#endif
#ifdef HAVE_STRUCT_STAT_ST_RDEV #ifdef HAVE_STRUCT_STAT_ST_RDEV
s->st_rdev = 0; s->st_rdev = 0;
#endif #endif

View File

@ -10,12 +10,12 @@ AC_DEFUN([AC_G_MODULE_SUPPORTED], [
textmode_x11_support="no" textmode_x11_support="no"
else else
found_gmodule=no 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 if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-no-export-2.0" g_module_supported="gmodule-no-export-2.0"
else else
dnl try fallback to the generic gmodule 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 if test x"$found_gmodule" = xyes; then
g_module_supported="gmodule-2.0" g_module_supported="gmodule-2.0"
fi fi
@ -89,9 +89,9 @@ AC_DEFUN([AC_CHECK_GLIB], [
AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@])) AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
glib_found=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 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 fi
]) ])

View File

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

View File

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