changeset 955:6b2f41844580

Cosmetic cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Feb 2015 01:03:18 +0200
parents 88cbea0ee9b5
children d4e411192238
files src/dmlib.c src/dmlib.h src/dmzlib.c
diffstat 3 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmlib.c	Thu Feb 26 19:06:32 2015 +0200
+++ b/src/dmlib.c	Fri Feb 27 01:03:18 2015 +0200
@@ -144,10 +144,12 @@
 }
 
 
-/* Error handling
+/*
+ * Error handling and messages
  */
 #define DM_SYSTEM_ERRORS 100000
 
+
 int dmGetErrno()
 {
     return DM_SYSTEM_ERRORS + errno;
--- a/src/dmlib.h	Thu Feb 26 19:06:32 2015 +0200
+++ b/src/dmlib.h	Fri Feb 27 01:03:18 2015 +0200
@@ -65,6 +65,7 @@
     DMERR_COMPRESSION,
 };
 
+
 // Directory/path separator stuff
 #define DM_DIR_SEPARATOR     '/'
 
@@ -382,17 +383,15 @@
 void       dmErrorVA(const char *fmt, va_list);
 void       dmError(const char *fmt, ...);
 
+int        dmGetErrno();
+const char *dmErrorStr(const int error);
+
 void *     dmMalloc(size_t);
 void *     dmMalloc0(size_t);
 void *     dmRealloc(void *, size_t);
 void *     dmCalloc(size_t, size_t);
 void       dmFree(void *);
 
-BOOL dmGetIntVal(const char *s, unsigned int *i);
-
-int         dmGetErrno();
-const char *dmErrorStr(int error);
-
 char *     dm_strdup(const char *);
 char *     dm_strndup(const char *, const size_t n);
 char *     dm_strdup_vprintf(const char *, va_list);
@@ -402,6 +401,9 @@
 char *     dm_strdup_fext(const char *filename, const char *fmt);
 char *     dm_strrcasecmp(char *str, const char *needle);
 
+BOOL       dmGetIntVal(const char *s, unsigned int *i);
+
+
 /* Mutexes
  */
 #ifdef DM_MUTEX_DEBUG
@@ -440,25 +442,25 @@
 
 /* Endianess swapping macros
  */
-#define DM_SWAP_16_LE_BE(value)    ((Uint16) (   \
+#define DM_SWAP_16_LE_BE(value) ((Uint16) ( \
     (Uint16) ((Uint16) (value) >> 8) |      \
     (Uint16) ((Uint16) (value) << 8)) )
 
 
-#define DM_SWAP_32_LE_BE(value) ((Uint32) (               \
+#define DM_SWAP_32_LE_BE(value) ((Uint32) (             \
     (((Uint32) (value) & (Uint32) 0x000000ffU) << 24) | \
     (((Uint32) (value) & (Uint32) 0x0000ff00U) <<  8) | \
     (((Uint32) (value) & (Uint32) 0x00ff0000U) >>  8) | \
     (((Uint32) (value) & (Uint32) 0xff000000U) >> 24)))
 
-#define DM_SWAP_64_LE_BE(value) ((Uint64) (                           \
-    (((Uint64) (value) & (Uint64) 0x00000000000000ffULL) << 56) |   \
-    (((Uint64) (value) & (Uint64) 0x000000000000ff00ULL) << 40) |   \
-    (((Uint64) (value) & (Uint64) 0x0000000000ff0000ULL) << 24) |   \
-    (((Uint64) (value) & (Uint64) 0x00000000ff000000ULL) <<  8) |   \
-    (((Uint64) (value) & (Uint64) 0x000000ff00000000ULL) >>  8) |   \
-    (((Uint64) (value) & (Uint64) 0x0000ff0000000000ULL) >> 24) |   \
-    (((Uint64) (value) & (Uint64) 0x00ff000000000000ULL) >> 40) |   \
+#define DM_SWAP_64_LE_BE(value) ((Uint64) (                       \
+    (((Uint64) (value) & (Uint64) 0x00000000000000ffULL) << 56) | \
+    (((Uint64) (value) & (Uint64) 0x000000000000ff00ULL) << 40) | \
+    (((Uint64) (value) & (Uint64) 0x0000000000ff0000ULL) << 24) | \
+    (((Uint64) (value) & (Uint64) 0x00000000ff000000ULL) <<  8) | \
+    (((Uint64) (value) & (Uint64) 0x000000ff00000000ULL) >>  8) | \
+    (((Uint64) (value) & (Uint64) 0x0000ff0000000000ULL) >> 24) | \
+    (((Uint64) (value) & (Uint64) 0x00ff000000000000ULL) >> 40) | \
     (((Uint64) (value) & (Uint64) 0xff00000000000000ULL) >> 56)))
 
 
--- a/src/dmzlib.c	Thu Feb 26 19:06:32 2015 +0200
+++ b/src/dmzlib.c	Fri Feb 27 01:03:18 2015 +0200
@@ -347,11 +347,13 @@
     if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19))
         return 0;
 
+
     n = 0;
     while (n < hlit + hdist)
     {
         int c = stbi__zhuffman_decode(a, &z_codelength);
         STBI_ASSERT(c >= 0 && c < 19);
+
         if (c < 16)
             lencodes[n++] = (Uint8) c;
         else