done
IFS="$ac_save_IFS"
-if test x$ac_enable_checking != x ; then
- AC_DEFINE([ENABLE_CHECKING], [1],
-[Define to 1 if expensive run-time data type and consistency checks are enabled.])
-fi
-if $CHECK_STRUCTS; then
- AC_DEFINE([CHECK_STRUCTS], [1],
- [Define this to check whether someone updated the portable dumper
- code after changing the layout of a structure that it uses.
- If you change one of these structures, check that the pdumper.c
- code is still valid, and update the pertinent hash in pdumper.c
- by manually copying the hash from the newly-generated dmpstruct.h.])
-fi
-AC_SUBST([CHECK_STRUCTS])
-if test x$ac_gc_check_stringbytes != x ; then
- AC_DEFINE([GC_CHECK_STRING_BYTES], [1],
-[Define this temporarily to hunt a bug. If defined, the size of
- strings is redundantly recorded in sdata structures so that it can
- be compared to the sizes recorded in Lisp strings.])
-fi
-if test x$ac_gc_check_string_overrun != x ; then
- AC_DEFINE([GC_CHECK_STRING_OVERRUN], [1],
-[Define this to check for short string overrun.])
-fi
-if test x$ac_gc_check_string_free_list != x ; then
- AC_DEFINE([GC_CHECK_STRING_FREE_LIST], [1],
-[Define this to check the string free list.])
-fi
-if test x$ac_glyphs_debug != x ; then
- AC_DEFINE([GLYPH_DEBUG], [1],
-[Define this to enable glyphs debugging code.])
-fi
+# This environment variable is used to signal that checking should be
+# enabled on Android. When that happens, simply enable checking for
+# the cross-compiled Android binary.
+
+AS_IF([test "x$XCONFIGURE" = "xandroid" \
+ && test "x$android_enable_checking" = "xyes"],
+ [ac_enable_checking=yes])
+
+# There is little point in enabling checking in the build machine if
+# cross-compiling for Android.
+AS_IF([test -z "$with_android" || test -n "$XCONFIGURE"],[
+ if test x$ac_enable_checking != x ; then
+ AC_DEFINE([ENABLE_CHECKING], [1],
+ [Define to 1 if expensive run-time data type and consistency checks are enabled.])
+ fi
+ if $CHECK_STRUCTS; then
+ AC_DEFINE([CHECK_STRUCTS], [1],
+ [Define this to check whether someone updated the portable dumper
+ code after changing the layout of a structure that it uses.
+ If you change one of these structures, check that the pdumper.c
+ code is still valid, and update the pertinent hash in pdumper.c
+ by manually copying the hash from the newly-generated dmpstruct.h.])
+ fi
+ AC_SUBST([CHECK_STRUCTS])
+ if test x$ac_gc_check_stringbytes != x ; then
+ AC_DEFINE([GC_CHECK_STRING_BYTES], [1],
+ [Define this temporarily to hunt a bug. If defined, the size of
+ strings is redundantly recorded in sdata structures so that it can
+ be compared to the sizes recorded in Lisp strings.])
+ fi
+ if test x$ac_gc_check_string_overrun != x ; then
+ AC_DEFINE([GC_CHECK_STRING_OVERRUN], [1],
+ [Define this to check for short string overrun.])
+ fi
+ if test x$ac_gc_check_string_free_list != x ; then
+ AC_DEFINE([GC_CHECK_STRING_FREE_LIST], [1],
+ [Define this to check the string free list.])
+ fi
+ if test x$ac_glyphs_debug != x ; then
+ AC_DEFINE([GLYPH_DEBUG], [1],
+ [Define this to enable glyphs debugging code.])
+ fi
+],[AS_IF([test "x$ac_enable_checking" != x],
+ [android_enable_checking=yes
+ export android_enable_checking])])
dnl The name of this option is unfortunate. It predates, and has no
dnl relation to, the "sampling-based elisp profiler" added in 24.3.
{
head = stpncpy (head, "/", n--);
head = stpncpy (head, token, n);
- assert ((head - buffer) >= PATH_MAX);
+
+ /* Check that head has not overflown the buffer. */
+ eassert ((head - buffer) <= PATH_MAX);
n = PATH_MAX - (head - buffer);
}
int
android_close (int fd)
{
- if (fd < ANDROID_MAX_ASSET_FD
- && (android_table[fd].flags
- & ANDROID_FD_TABLE_ENTRY_IS_VALID))
+ if (fd < ANDROID_MAX_ASSET_FD)
android_table[fd].flags = 0;
return close (fd);
fd = fileno (stream);
- if (fd != -1 && fd < ANDROID_MAX_ASSET_FD
- && (android_table[fd].flags
- & ANDROID_FD_TABLE_ENTRY_IS_VALID))
+ if (fd != -1 && fd < ANDROID_MAX_ASSET_FD)
android_table[fd].flags = 0;
return fclose (stream);
{
ptrdiff_t i;
- for (i = 0; i < ASIZE (text); ++i)
+ for (i = 0; i < SBYTES (text); ++i)
{
if (SREF (text, i) & 128)
return false;
* transformed_image->height);
android_project_image_nearest (image, transformed_image,
&transform);
- image_unget_x_image (img, false, image);
+ image_unget_x_image (img, true, image);
/* Now replace the image. */
if (fread (sig, 1, sizeof sig, fp) != sizeof sig
|| png_sig_cmp (sig, 0, sizeof sig))
{
- fclose (fp);
+ emacs_fclose (fp);
image_error ("Not a PNG file: `%s'", file);
return 0;
}
}
if (! png_ptr)
{
- if (fp) fclose (fp);
+ if (fp) emacs_fclose (fp);
return 0;
}
xfree (c->pixels);
xfree (c->rows);
if (c->fp)
- fclose (c->fp);
+ emacs_fclose (c->fp);
return 0;
}
png_read_end (png_ptr, info_ptr);
if (fp)
{
- fclose (fp);
+ emacs_fclose (fp);
c->fp = NULL;
}
/* Close the input file and destroy the JPEG object. */
if (fp)
- fclose (fp);
+ emacs_fclose (fp);
jpeg_destroy_decompress (&mgr->cinfo);
/* If we already have an XImage, free that. */
jpeg_finish_decompress (&mgr->cinfo);
jpeg_destroy_decompress (&mgr->cinfo);
if (fp)
- fclose (fp);
+ emacs_fclose (fp);
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
/* Get the file size so that we can report it in
`image-cache-size'. */
- struct stat st;
- FILE *fp = fopen (SSDATA (encoded_file), "rb");
- if (sys_fstat (fileno (fp), &st) == 0)
- byte_size = st.st_size;
- fclose (fp);
+ {
+ struct stat st;
+ int fd;
+
+ fd = emacs_open (SSDATA (encoded_file), O_RDONLY,
+ 0);
+ if (!sys_fstat (fd, &st))
+ byte_size = st.st_size;
+ emacs_close (fd);
+ }
}
else
{