Minor fixes and refactors

This commit is contained in:
2025-08-28 22:01:36 +03:00
parent a690b3f285
commit a4c5ce98ce
4 changed files with 10 additions and 8 deletions

13
configure vendored
View File

@@ -113,10 +113,6 @@ cflags="-fPIC -I${source_path}include -I."
ldflags=""
ldlibs="-lm"
cflags="$cflags $extra_cflags"
ldflags="$ldflags $extra_ldflags"
ldlibs="$ldlibs $extra_ldlibs"
# Make sure that build directories exist
mkdir src src/Platform src/Math src/String 2> /dev/null
@@ -184,6 +180,11 @@ if [ "$enable_tests" = "yes" ]; then
done
fi
# Add extra flags
cflags="$cflags $extra_cflags"
ldflags="$ldflags $extra_ldflags"
ldlibs="$ldlibs $extra_ldlibs"
# Makefile generation
{
# Generate variables
@@ -285,8 +286,8 @@ fi
# Generate internal config.h
{
printf "#ifndef BH_SRC_CONFIG_H\n#define BH_SRC_CONFIG_H\n\n"
if [ "$use_clock_gettime" ]; then printf "#define BH_USE_CLOCK_GETTIME\n"; fi
if [ "$enable_lfs" ]; then printf "#define BH_ENABLE_LFS\n"; fi
if [ "$use_clock_gettime" = "yes" ]; then printf "#define BH_USE_CLOCK_GETTIME\n"; fi
if [ "$enable_lfs" = "yes" ]; then printf "#define BH_ENABLE_LFS\n"; fi
printf "\n#endif /* BH_SRC_CONFIG_H */\n"
} > Config.h

View File

@@ -47,7 +47,7 @@ struct BH_Bitmap
};
const static struct FormatInfo formats[] =
static const struct FormatInfo formats[] =
{
/* BH_BITMAP_INDEX1 */
{TYPE_INDEX1, 7, {0x0001}, {7, 6, 5, 4, 3, 2, 1, 0}, 0},

View File

@@ -76,6 +76,7 @@ static int bytesSeek(BH_Bytes *bytes,
switch (info->whence)
{
default:
case BH_IO_SEEK_SET:
offset = MAX(info->offset, 0);
offset = MIN(offset, (int64_t)bytes->size);

View File

@@ -9,7 +9,7 @@
static int convertToTimespec(struct timespec *ts,
uint32_t timeout)
uint32_t timeout)
{
#if (_POSIX_TIMERS > 0) || defined(BH_USE_CLOCK_GETTIME)
if (clock_gettime(CLOCK_REALTIME, ts))