Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,6 +1,6 @@ -AC_INIT(ObjFW, 0.8-dev, js@webkeks.org) +AC_INIT(ObjFW, 0.8, js@webkeks.org) BUILDSYS_INIT AS_IF([test configure.ac -nt configure], [ AC_MSG_ERROR([configure.ac is newer than configure! Run ./autogen.sh!]) ]) @@ -516,11 +516,11 @@ AC_MSG_ERROR(No asprintf and no snprintf returning required space!) AC_CHECK_FUNCS([arc4random random], break) AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl") -AC_CHECK_HEADERS(dlfcn.h) +AC_CHECK_HEADERS_ONCE(dlfcn.h) case "$host_os" in netbsd*) dnl dladdr exists on NetBSD, but it is completely broken. dnl When using it with code that uses __thread, it freezes the dnl process so that it has to be killed using SIGKILL. @@ -593,11 +593,11 @@ AC_ARG_ENABLE(compiler-tls, AS_HELP_STRING([--disable-compiler-tls], [disable compiler thread local storage])) AS_IF([test x"$enable_compiler_tls" != x"no"], [ - AC_CHECK_HEADERS(threads.h, [ + AC_CHECK_HEADER(threads.h, [ AC_DEFINE(OF_HAVE_THREADS_H, 1, [Whether we have threads.h]) ]) AC_MSG_CHECKING(whether _Thread_local works) @@ -765,15 +765,15 @@ AC_CHECK_HEADER(sys/socket.h, [ AC_DEFINE(OF_HAVE_SYS_SOCKET_H, 1, [Whether we have sys/socket.h]) ]) - AC_CHECK_HEADERS(netinet/in.h, [ + AC_CHECK_HEADER(netinet/in.h, [ AC_DEFINE(OF_HAVE_NETINET_IN_H, 1, [Whether we have netinet/in.h]) ]) - AC_CHECK_HEADERS(netinet/tcp.h, [ + AC_CHECK_HEADER(netinet/tcp.h, [ AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1, [Whether we have netinet/tcp.h]) ]) AC_CHECK_HEADERS([arpa/inet.h netdb.h]) @@ -962,11 +962,11 @@ AS_IF([test x"$have_processes" = x"yes"], [ AC_SUBST(OFPROCESS_M, "OFProcess.m") AC_DEFINE(OF_HAVE_PROCESSES, 1, [Whether we have processes]) ]) -AC_CHECK_HEADERS(sys/ioctl.h) +AC_CHECK_HEADERS_ONCE([sys/ioctl.h sys/termios.h]) AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_CHECK_HEADER(Foundation/NSObject.h, [ AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m") AC_SUBST(BRIDGE, "bridge") Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -239,19 +239,17 @@ OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF); if (src_ == NULL) return; - if (flags_ & OF_BLOCK_BYREF_CALLER) - return; - switch (flags) { case OF_BLOCK_FIELD_IS_BLOCK: *(of_block_literal_t**)dst_ = _Block_copy(src_); break; case OF_BLOCK_FIELD_IS_OBJECT: - *(id*)dst_ = [(id)src_ retain]; + if (!(flags_ & OF_BLOCK_BYREF_CALLER)) + *(id*)dst_ = [(id)src_ retain]; break; case OF_BLOCK_FIELD_IS_BYREF:; of_block_byref_t *src = (of_block_byref_t*)src_; of_block_byref_t **dst = (of_block_byref_t**)dst_; @@ -266,11 +264,11 @@ if (src->forwarding == src) (*dst)->forwarding = *dst; memcpy(*dst, src, src->size); - if (src->size >= sizeof(of_block_byref_t)) + if (src->flags & OF_BLOCK_HAS_COPY_DISPOSE) src->byref_keep(*dst, src); } else *dst = src; (*dst)->flags++; @@ -285,25 +283,23 @@ OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF); if (obj_ == NULL) return; - if (flags_ & OF_BLOCK_BYREF_CALLER) - return; - switch (flags) { case OF_BLOCK_FIELD_IS_BLOCK: _Block_release(obj_); break; case OF_BLOCK_FIELD_IS_OBJECT: - [(id)obj_ release]; + if (!(flags_ & OF_BLOCK_BYREF_CALLER)) + [(id)obj_ release]; break; case OF_BLOCK_FIELD_IS_BYREF:; of_block_byref_t *obj = (of_block_byref_t*)obj_; if ((--obj->flags & OF_BLOCK_REFCOUNT_MASK) == 0) { - if (obj->size >= sizeof(of_block_byref_t)) + if (obj->flags & OF_BLOCK_HAS_COPY_DISPOSE) obj->byref_dispose(obj); free(obj); } break; Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -151,32 +151,42 @@ + (void)changeCurrentDirectoryPath: (OFString*)path; /*! * @brief Returns the size of the specified file. * + * @param path The path to the file whose path should be returned + * * @return The size of the specified file */ + (of_offset_t)sizeOfFileAtPath: (OFString*)path; /*! - * @brief Returns the last access time of the specified file. + * @brief Returns the last access time of the specified item. + * + * @param path The path to the file whose last access time should be returned * - * @return The last access time of the specified file + * @return The last access time of the specified item */ + (OFDate*)accessTimeOfItemAtPath: (OFString*)path; /*! - * @brief Returns the last modification time of the specified file. + * @brief Returns the last modification time of the specified item. + * + * @param path The path to the file whose last modification time should be + * returned * - * @return The last modification time of the specified file + * @return The last modification time of the specified item */ + (OFDate*)modificationTimeOfItemAtPath: (OFString*)path; /*! - * @brief Returns the last status change time of the specified file. + * @brief Returns the last status change time of the specified item. + * + * @param path The path to the file whose last status change time should be + * returned * - * @return The last status change time of the specified file + * @return The last status change time of the specified item */ + (OFDate*)statusChangeTimeOfItemAtPath: (OFString*)path; #ifdef OF_HAVE_CHMOD /*! @@ -282,10 +292,11 @@ /*! * @brief Returns the destination of the symbolic link at the specified path. * * @param path The path to the symbolic link + * * @return The destination of the symbolic link at the specified path */ + (OFString*)destinationOfSymbolicLinkAtPath: (OFString*)path; #endif Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -117,14 +117,14 @@ #define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH #define DIR_MODE DEFAULT_MODE | S_IXUSR | S_IXGRP | S_IXOTH #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) -static of_mutex_t mutex; +static of_mutex_t chownMutex; #endif #if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) -static of_mutex_t mutex; +static of_mutex_t readdirMutex; #endif int of_stat(OFString *path, of_stat_t *buffer) { @@ -205,17 +205,17 @@ { if (self != [OFFile class]) return; #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) - if (!of_mutex_new(&mutex)) + if (!of_mutex_new(&chownMutex)) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif #if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) - if (!of_mutex_new(&mutex)) + if (!of_mutex_new(&readdirMutex)) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif #ifdef __wii__ @@ -397,11 +397,11 @@ if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) - if (!of_mutex_lock(&mutex)) + if (!of_mutex_lock(&readdirMutex)) @throw [OFLockFailedException exception]; # endif @try { for (;;) { @@ -446,11 +446,11 @@ objc_autoreleasePoolPop(pool); } } @finally { closedir(dir); # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) - if (!of_mutex_unlock(&mutex)) + if (!of_mutex_unlock(&readdirMutex)) @throw [OFUnlockFailedException exception]; # endif } #else void *pool = objc_autoreleasePoolPush(); @@ -608,11 +608,11 @@ @throw [OFInvalidArgumentException exception]; encoding = [OFSystemInfo native8BitEncoding]; # ifdef OF_HAVE_THREADS - if (!of_mutex_lock(&mutex)) + if (!of_mutex_lock(&chownMutex)) @throw [OFLockFailedException exception]; @try { # endif if (owner != nil) { @@ -642,11 +642,11 @@ gid = group_->gr_gid; } # ifdef OF_HAVE_THREADS } @finally { - if (!of_mutex_unlock(&mutex)) + if (!of_mutex_unlock(&chownMutex)) @throw [OFUnlockFailedException exception]; } # endif if (chown([path cStringWithEncoding: encoding], uid, gid) != 0) Index: utils/ofhttp/ProgressBar.m ================================================================== --- utils/ofhttp/ProgressBar.m +++ utils/ofhttp/ProgressBar.m @@ -15,13 +15,18 @@ */ #include "config.h" #include + +#include #ifdef HAVE_SYS_IOCTL_H # include +#endif +#ifdef HAVE_SYS_TERMIOS_H +# include #endif #import "OFDate.h" #import "OFStdIOStream.h" #import "OFTimer.h"