Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/odfs/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ static inline void *odfs_malloc(size_t size)
{
if (size == 0)
size = 1;
#ifdef __AROS__
return AllocVec((IPTR)size, MEMF_PUBLIC);
#else
if (sizeof(size_t) > sizeof(ULONG) && size > (size_t)(ULONG)-1)
return NULL;
#if ODFS_AMIGA_OS4
return AllocVecTags((ULONG)size, AVT_Type, MEMF_SHARED, TAG_END);
#else
return AllocVec((ULONG)size, MEMF_PUBLIC);
#endif
#endif
}

static inline void *odfs_calloc(size_t count, size_t size)
Expand All @@ -45,6 +51,11 @@ static inline void *odfs_calloc(size_t count, size_t size)
if (total == 0)
total = 1;

#ifdef __AROS__
return AllocVec((IPTR)total, MEMF_PUBLIC | MEMF_CLEAR);
#else
if (sizeof(size_t) > sizeof(ULONG) && total > (size_t)(ULONG)-1)
return NULL;
#if ODFS_AMIGA_OS4
return AllocVecTags((ULONG)total,
AVT_Type, MEMF_SHARED,
Expand All @@ -53,6 +64,7 @@ static inline void *odfs_calloc(size_t count, size_t size)
#else
return AllocVec((ULONG)total, MEMF_PUBLIC | MEMF_CLEAR);
#endif
#endif
}

static inline void odfs_free(void *ptr)
Expand Down
58 changes: 10 additions & 48 deletions include/odfs/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,23 @@

/*
* Build profiles:
* ODFS_PROFILE_FULL — all features enabled (default)
* ODFS_PROFILE_ROM — minimal ROM-capable subset
* default — all features enabled
* ODFS_PROFILE_ROM — minimal ROM-capable subset
*
* Set exactly one profile, or configure individual flags below.
* Configure individual flags below or override from command line
* (-DODFS_FEATURE_xxx=0).
*/

#if !defined(ODFS_PROFILE_FULL) && !defined(ODFS_PROFILE_ROM)
#define ODFS_PROFILE_FULL
#endif

/* ---------- backend feature flags ---------- */
/* All flags can be overridden from command line (-DODFS_FEATURE_xxx=0) */

#ifndef ODFS_FEATURE_ISO9660
#define ODFS_FEATURE_ISO9660 1
#endif
#ifndef ODFS_FEATURE_ROCK_RIDGE
#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_ROCK_RIDGE 1
#else
#define ODFS_FEATURE_ROCK_RIDGE 1
#endif
#define ODFS_FEATURE_ROCK_RIDGE 1
#endif
#ifndef ODFS_FEATURE_JOLIET
#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_JOLIET 1
#else
#define ODFS_FEATURE_JOLIET 1
#endif
#define ODFS_FEATURE_JOLIET 1
#endif
#ifndef ODFS_FEATURE_HIGH_SIERRA
#ifdef ODFS_PROFILE_ROM
Expand All @@ -47,11 +35,7 @@
#endif
#endif
#ifndef ODFS_FEATURE_MULTISESSION
#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_MULTISESSION 1
#else
#define ODFS_FEATURE_MULTISESSION 1
#endif
#define ODFS_FEATURE_MULTISESSION 1
#endif
#ifndef ODFS_FEATURE_UDF
#ifdef ODFS_PROFILE_ROM
Expand Down Expand Up @@ -90,9 +74,6 @@
#define ODFS_FEATURE_CACHE_RETAIN 1
#endif

#ifndef ODFS_FEATURE_CACHE_BLOCK
#define ODFS_FEATURE_CACHE_BLOCK 1
#endif
#ifndef ODFS_FEATURE_CACHE_META
#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_CACHE_META 0
Expand All @@ -112,23 +93,13 @@

/* ODFS_FEATURE_LOG can be overridden from command line (-DODFS_FEATURE_LOG=0) */
#ifndef ODFS_FEATURE_LOG
#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_LOG 1
#else
#define ODFS_FEATURE_LOG 1
#endif
#define ODFS_FEATURE_LOG 1
#endif

#ifdef ODFS_PROFILE_ROM
#define ODFS_FEATURE_LOG_SERIAL 1
#define ODFS_FEATURE_LOG_KPRINTF 0
#define ODFS_FEATURE_LOG_RINGBUF 0
#define ODFS_LOG_MAX_LEVEL ODFS_LOG_WARN
#define ODFS_LOG_MAX_LEVEL ODFS_LOG_WARN
#else
#define ODFS_FEATURE_LOG_SERIAL 1
#define ODFS_FEATURE_LOG_KPRINTF 1
#define ODFS_FEATURE_LOG_RINGBUF 1
#define ODFS_LOG_MAX_LEVEL ODFS_LOG_TRACE
#define ODFS_LOG_MAX_LEVEL ODFS_LOG_TRACE
#endif

/* ---------- charset feature flags ---------- */
Expand Down Expand Up @@ -166,13 +137,4 @@
#define ODFS_PLATFORM_AMIGA 0
#endif

/* host builds for testing */
#ifndef ODFS_PLATFORM_HOST
#if !ODFS_PLATFORM_AMIGA
#define ODFS_PLATFORM_HOST 1
#else
#define ODFS_PLATFORM_HOST 0
#endif
#endif

#endif /* ODFS_CONFIG_H */
3 changes: 1 addition & 2 deletions include/odfs/media.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ static inline void odfs_media_close(odfs_media_t *m)
{
if (!m || !m->ops || !m->ops->close)
return;
if (m->ops->close)
m->ops->close(m->ctx);
m->ops->close(m->ctx);
}

/* host-side: open an image file as media */
Expand Down
13 changes: 10 additions & 3 deletions include/odfs/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ static inline int odfs_strcasecmp(const char *a, const char *b)
unsigned char cb;

for (;;) {
ca = odfs_ascii_tolower((unsigned char)*a++);
cb = odfs_ascii_tolower((unsigned char)*b++);
if (ca != cb || ca == '\0')
ca = (unsigned char)*a++;
cb = (unsigned char)*b++;
if (ca == cb) {
if (ca == '\0')
return 0;
continue;
}
ca = odfs_ascii_tolower(ca);
cb = odfs_ascii_tolower(cb);
if (ca != cb)
return (int)ca - (int)cb;
}
}
Expand Down
Loading