Browse Source

Merge pull request #5872 from akien-mga/pr-libraries-update

Update embedded libraries: rg_etc1 1.04, zlib 1.2.8, RtAudio 4.1.2
Rémi Verschelde 9 years ago
parent
commit
1eefff283a

+ 1 - 1
drivers/builtin_zlib/zlib/compress.c

@@ -29,7 +29,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
     z_stream stream;
     z_stream stream;
     int err;
     int err;
 
 
-    stream.next_in = (Bytef*)source;
+    stream.next_in = (z_const Bytef *)source;
     stream.avail_in = (uInt)sourceLen;
     stream.avail_in = (uInt)sourceLen;
 #ifdef MAXSEG_64K
 #ifdef MAXSEG_64K
     /* Check for source > 64K on 16-bit machine: */
     /* Check for source > 64K on 16-bit machine: */

+ 7 - 5
drivers/builtin_zlib/zlib/deflate.c

@@ -1,5 +1,5 @@
 /* deflate.c -- compress data using the deflation algorithm
 /* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
+ * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
  */
 
 
@@ -52,7 +52,7 @@
 #include "deflate.h"
 #include "deflate.h"
 
 
 const char deflate_copyright[] =
 const char deflate_copyright[] =
-   " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler ";
+   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
 /*
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
   in the documentation of your product. If for some reason you cannot
@@ -305,7 +305,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
         s->pending_buf == Z_NULL) {
         s->pending_buf == Z_NULL) {
         s->status = FINISH_STATE;
         s->status = FINISH_STATE;
-        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+        strm->msg = ERR_MSG(Z_MEM_ERROR);
         deflateEnd (strm);
         deflateEnd (strm);
         return Z_MEM_ERROR;
         return Z_MEM_ERROR;
     }
     }
@@ -329,7 +329,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
     uInt str, n;
     uInt str, n;
     int wrap;
     int wrap;
     unsigned avail;
     unsigned avail;
-    unsigned char *next;
+    z_const unsigned char *next;
 
 
     if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
     if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
         return Z_STREAM_ERROR;
         return Z_STREAM_ERROR;
@@ -359,7 +359,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
     avail = strm->avail_in;
     avail = strm->avail_in;
     next = strm->next_in;
     next = strm->next_in;
     strm->avail_in = dictLength;
     strm->avail_in = dictLength;
-    strm->next_in = (Bytef *)dictionary;
+    strm->next_in = (z_const Bytef *)dictionary;
     fill_window(s);
     fill_window(s);
     while (s->lookahead >= MIN_MATCH) {
     while (s->lookahead >= MIN_MATCH) {
         str = s->strstart;
         str = s->strstart;
@@ -513,6 +513,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
         strm->total_in != 0) {
         strm->total_in != 0) {
         /* Flush the last buffer: */
         /* Flush the last buffer: */
         err = deflate(strm, Z_BLOCK);
         err = deflate(strm, Z_BLOCK);
+        if (err == Z_BUF_ERROR && s->pending == 0)
+            err = Z_OK;
     }
     }
     if (s->level != level) {
     if (s->level != level) {
         s->level = level;
         s->level = level;

+ 1 - 1
drivers/builtin_zlib/zlib/deflate.h

@@ -104,7 +104,7 @@ typedef struct internal_state {
     int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
     int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
     gz_headerp  gzhead;  /* gzip header information to write */
     gz_headerp  gzhead;  /* gzip header information to write */
     uInt   gzindex;      /* where in extra, name, or comment */
     uInt   gzindex;      /* where in extra, name, or comment */
-    Byte  method;        /* STORED (for zip only) or DEFLATED */
+    Byte  method;        /* can only be DEFLATED */
     int   last_flush;    /* value of flush param for previous deflate call */
     int   last_flush;    /* value of flush param for previous deflate call */
 
 
                 /* used by deflate.c: */
                 /* used by deflate.c: */

+ 1 - 1
drivers/builtin_zlib/zlib/infback.c

@@ -255,7 +255,7 @@ out_func out;
 void FAR *out_desc;
 void FAR *out_desc;
 {
 {
     struct inflate_state FAR *state;
     struct inflate_state FAR *state;
-    unsigned char FAR *next;    /* next input */
+    z_const unsigned char FAR *next;    /* next input */
     unsigned char FAR *put;     /* next output */
     unsigned char FAR *put;     /* next output */
     unsigned have, left;        /* available input and output */
     unsigned have, left;        /* available input and output */
     unsigned long hold;         /* bit buffer */
     unsigned long hold;         /* bit buffer */

+ 3 - 3
drivers/builtin_zlib/zlib/inffast.c

@@ -1,5 +1,5 @@
 /* inffast.c -- fast decoding
 /* inffast.c -- fast decoding
- * Copyright (C) 1995-2008, 2010 Mark Adler
+ * Copyright (C) 1995-2008, 2010, 2013 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
  */
 
 
@@ -69,8 +69,8 @@ z_streamp strm;
 unsigned start;         /* inflate()'s starting value for strm->avail_out */
 unsigned start;         /* inflate()'s starting value for strm->avail_out */
 {
 {
     struct inflate_state FAR *state;
     struct inflate_state FAR *state;
-    unsigned char FAR *in;      /* local strm->next_in */
-    unsigned char FAR *last;    /* while in < last, enough input available */
+    z_const unsigned char FAR *in;      /* local strm->next_in */
+    z_const unsigned char FAR *last;    /* have enough input while in < last */
     unsigned char FAR *out;     /* local strm->next_out */
     unsigned char FAR *out;     /* local strm->next_out */
     unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
     unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
     unsigned char FAR *end;     /* while out < end, enough space available */
     unsigned char FAR *end;     /* while out < end, enough space available */

+ 40 - 24
drivers/builtin_zlib/zlib/inflate.c

@@ -93,11 +93,12 @@
 
 
 /* function prototypes */
 /* function prototypes */
 local void fixedtables OF((struct inflate_state FAR *state));
 local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, unsigned out));
+local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
+                           unsigned copy));
 #ifdef BUILDFIXED
 #ifdef BUILDFIXED
    void makefixed OF((void));
    void makefixed OF((void));
 #endif
 #endif
-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
+local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
                               unsigned len));
                               unsigned len));
 
 
 int ZEXPORT inflateResetKeep(strm)
 int ZEXPORT inflateResetKeep(strm)
@@ -375,12 +376,13 @@ void makefixed()
    output will fall in the output data, making match copies simpler and faster.
    output will fall in the output data, making match copies simpler and faster.
    The advantage may be dependent on the size of the processor's data caches.
    The advantage may be dependent on the size of the processor's data caches.
  */
  */
-local int updatewindow(strm, out)
+local int updatewindow(strm, end, copy)
 z_streamp strm;
 z_streamp strm;
-unsigned out;
+const Bytef *end;
+unsigned copy;
 {
 {
     struct inflate_state FAR *state;
     struct inflate_state FAR *state;
-    unsigned copy, dist;
+    unsigned dist;
 
 
     state = (struct inflate_state FAR *)strm->state;
     state = (struct inflate_state FAR *)strm->state;
 
 
@@ -400,19 +402,18 @@ unsigned out;
     }
     }
 
 
     /* copy state->wsize or less output bytes into the circular window */
     /* copy state->wsize or less output bytes into the circular window */
-    copy = out - strm->avail_out;
     if (copy >= state->wsize) {
     if (copy >= state->wsize) {
-        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
+        zmemcpy(state->window, end - state->wsize, state->wsize);
         state->wnext = 0;
         state->wnext = 0;
         state->whave = state->wsize;
         state->whave = state->wsize;
     }
     }
     else {
     else {
         dist = state->wsize - state->wnext;
         dist = state->wsize - state->wnext;
         if (dist > copy) dist = copy;
         if (dist > copy) dist = copy;
-        zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
+        zmemcpy(state->window + state->wnext, end - copy, dist);
         copy -= dist;
         copy -= dist;
         if (copy) {
         if (copy) {
-            zmemcpy(state->window, strm->next_out - copy, copy);
+            zmemcpy(state->window, end - copy, copy);
             state->wnext = copy;
             state->wnext = copy;
             state->whave = state->wsize;
             state->whave = state->wsize;
         }
         }
@@ -606,7 +607,7 @@ z_streamp strm;
 int flush;
 int flush;
 {
 {
     struct inflate_state FAR *state;
     struct inflate_state FAR *state;
-    unsigned char FAR *next;    /* next input */
+    z_const unsigned char FAR *next;    /* next input */
     unsigned char FAR *put;     /* next output */
     unsigned char FAR *put;     /* next output */
     unsigned have, left;        /* available input and output */
     unsigned have, left;        /* available input and output */
     unsigned long hold;         /* bit buffer */
     unsigned long hold;         /* bit buffer */
@@ -920,7 +921,7 @@ int flush;
             while (state->have < 19)
             while (state->have < 19)
                 state->lens[order[state->have++]] = 0;
                 state->lens[order[state->have++]] = 0;
             state->next = state->codes;
             state->next = state->codes;
-            state->lencode = (code const FAR *)(state->next);
+            state->lencode = (const code FAR *)(state->next);
             state->lenbits = 7;
             state->lenbits = 7;
             ret = inflate_table(CODES, state->lens, 19, &(state->next),
             ret = inflate_table(CODES, state->lens, 19, &(state->next),
                                 &(state->lenbits), state->work);
                                 &(state->lenbits), state->work);
@@ -994,7 +995,7 @@ int flush;
                values here (9 and 6) without reading the comments in inftrees.h
                values here (9 and 6) without reading the comments in inftrees.h
                concerning the ENOUGH constants, which depend on those values */
                concerning the ENOUGH constants, which depend on those values */
             state->next = state->codes;
             state->next = state->codes;
-            state->lencode = (code const FAR *)(state->next);
+            state->lencode = (const code FAR *)(state->next);
             state->lenbits = 9;
             state->lenbits = 9;
             ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
             ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
                                 &(state->lenbits), state->work);
                                 &(state->lenbits), state->work);
@@ -1003,7 +1004,7 @@ int flush;
                 state->mode = BAD;
                 state->mode = BAD;
                 break;
                 break;
             }
             }
-            state->distcode = (code const FAR *)(state->next);
+            state->distcode = (const code FAR *)(state->next);
             state->distbits = 6;
             state->distbits = 6;
             ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
             ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
                             &(state->next), &(state->distbits), state->work);
                             &(state->next), &(state->distbits), state->work);
@@ -1230,7 +1231,7 @@ int flush;
     RESTORE();
     RESTORE();
     if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
     if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
             (state->mode < CHECK || flush != Z_FINISH)))
             (state->mode < CHECK || flush != Z_FINISH)))
-        if (updatewindow(strm, out)) {
+        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
             state->mode = MEM;
             state->mode = MEM;
             return Z_MEM_ERROR;
             return Z_MEM_ERROR;
         }
         }
@@ -1264,6 +1265,29 @@ z_streamp strm;
     return Z_OK;
     return Z_OK;
 }
 }
 
 
+int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
+z_streamp strm;
+Bytef *dictionary;
+uInt *dictLength;
+{
+    struct inflate_state FAR *state;
+
+    /* check state */
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+
+    /* copy dictionary */
+    if (state->whave && dictionary != Z_NULL) {
+        zmemcpy(dictionary, state->window + state->wnext,
+                state->whave - state->wnext);
+        zmemcpy(dictionary + state->whave - state->wnext,
+                state->window, state->wnext);
+    }
+    if (dictLength != Z_NULL)
+        *dictLength = state->whave;
+    return Z_OK;
+}
+
 int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
 int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
 z_streamp strm;
 z_streamp strm;
 const Bytef *dictionary;
 const Bytef *dictionary;
@@ -1271,8 +1295,6 @@ uInt dictLength;
 {
 {
     struct inflate_state FAR *state;
     struct inflate_state FAR *state;
     unsigned long dictid;
     unsigned long dictid;
-    unsigned char *next;
-    unsigned avail;
     int ret;
     int ret;
 
 
     /* check state */
     /* check state */
@@ -1291,13 +1313,7 @@ uInt dictLength;
 
 
     /* copy dictionary to window using updatewindow(), which will amend the
     /* copy dictionary to window using updatewindow(), which will amend the
        existing dictionary if appropriate */
        existing dictionary if appropriate */
-    next = strm->next_out;
-    avail = strm->avail_out;
-    strm->next_out = (Bytef *)dictionary + dictLength;
-    strm->avail_out = 0;
-    ret = updatewindow(strm, dictLength);
-    strm->avail_out = avail;
-    strm->next_out = next;
+    ret = updatewindow(strm, dictionary + dictLength, dictLength);
     if (ret) {
     if (ret) {
         state->mode = MEM;
         state->mode = MEM;
         return Z_MEM_ERROR;
         return Z_MEM_ERROR;
@@ -1337,7 +1353,7 @@ gz_headerp head;
  */
  */
 local unsigned syncsearch(have, buf, len)
 local unsigned syncsearch(have, buf, len)
 unsigned FAR *have;
 unsigned FAR *have;
-unsigned char FAR *buf;
+const unsigned char FAR *buf;
 unsigned len;
 unsigned len;
 {
 {
     unsigned got;
     unsigned got;

+ 7 - 7
drivers/builtin_zlib/zlib/inftrees.c

@@ -1,5 +1,5 @@
 /* inftrees.c -- generate Huffman trees for efficient decoding
 /* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2012 Mark Adler
+ * Copyright (C) 1995-2013 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
  */
 
 
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 #define MAXBITS 15
 
 
 const char inflate_copyright[] =
 const char inflate_copyright[] =
-   " inflate 1.2.7 Copyright 1995-2012 Mark Adler ";
+   " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
 /*
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -208,8 +208,8 @@ unsigned short FAR *work;
     mask = used - 1;            /* mask for comparing low */
     mask = used - 1;            /* mask for comparing low */
 
 
     /* check available table space */
     /* check available table space */
-    if ((type == LENS && used >= ENOUGH_LENS) ||
-        (type == DISTS && used >= ENOUGH_DISTS))
+    if ((type == LENS && used > ENOUGH_LENS) ||
+        (type == DISTS && used > ENOUGH_DISTS))
         return 1;
         return 1;
 
 
     /* process all codes and make table entries */
     /* process all codes and make table entries */
@@ -277,8 +277,8 @@ unsigned short FAR *work;
 
 
             /* check for enough space */
             /* check for enough space */
             used += 1U << curr;
             used += 1U << curr;
-            if ((type == LENS && used >= ENOUGH_LENS) ||
-                (type == DISTS && used >= ENOUGH_DISTS))
+            if ((type == LENS && used > ENOUGH_LENS) ||
+                (type == DISTS && used > ENOUGH_DISTS))
                 return 1;
                 return 1;
 
 
             /* point entry in root table to sub-table */
             /* point entry in root table to sub-table */

+ 8 - 6
drivers/builtin_zlib/zlib/trees.c

@@ -146,8 +146,8 @@ local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
 local int  build_bl_tree  OF((deflate_state *s));
 local int  build_bl_tree  OF((deflate_state *s));
 local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
 local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
                               int blcodes));
                               int blcodes));
-local void compress_block OF((deflate_state *s, ct_data *ltree,
-                              ct_data *dtree));
+local void compress_block OF((deflate_state *s, const ct_data *ltree,
+                              const ct_data *dtree));
 local int  detect_data_type OF((deflate_state *s));
 local int  detect_data_type OF((deflate_state *s));
 local unsigned bi_reverse OF((unsigned value, int length));
 local unsigned bi_reverse OF((unsigned value, int length));
 local void bi_windup      OF((deflate_state *s));
 local void bi_windup      OF((deflate_state *s));
@@ -972,7 +972,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
     } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
     } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
 #endif
 #endif
         send_bits(s, (STATIC_TREES<<1)+last, 3);
         send_bits(s, (STATIC_TREES<<1)+last, 3);
-        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+        compress_block(s, (const ct_data *)static_ltree,
+                       (const ct_data *)static_dtree);
 #ifdef DEBUG
 #ifdef DEBUG
         s->compressed_len += 3 + s->static_len;
         s->compressed_len += 3 + s->static_len;
 #endif
 #endif
@@ -980,7 +981,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
         send_bits(s, (DYN_TREES<<1)+last, 3);
         send_bits(s, (DYN_TREES<<1)+last, 3);
         send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
         send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
                        max_blindex+1);
                        max_blindex+1);
-        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+        compress_block(s, (const ct_data *)s->dyn_ltree,
+                       (const ct_data *)s->dyn_dtree);
 #ifdef DEBUG
 #ifdef DEBUG
         s->compressed_len += 3 + s->opt_len;
         s->compressed_len += 3 + s->opt_len;
 #endif
 #endif
@@ -1057,8 +1059,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
  */
  */
 local void compress_block(s, ltree, dtree)
 local void compress_block(s, ltree, dtree)
     deflate_state *s;
     deflate_state *s;
-    ct_data *ltree; /* literal tree */
-    ct_data *dtree; /* distance tree */
+    const ct_data *ltree; /* literal tree */
+    const ct_data *dtree; /* distance tree */
 {
 {
     unsigned dist;      /* distance of matched string */
     unsigned dist;      /* distance of matched string */
     int lc;             /* match length or unmatched char (if dist == 0) */
     int lc;             /* match length or unmatched char (if dist == 0) */

+ 1 - 1
drivers/builtin_zlib/zlib/uncompr.c

@@ -30,7 +30,7 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen)
     z_stream stream;
     z_stream stream;
     int err;
     int err;
 
 
-    stream.next_in = (Bytef*)source;
+    stream.next_in = (z_const Bytef *)source;
     stream.avail_in = (uInt)sourceLen;
     stream.avail_in = (uInt)sourceLen;
     /* Check for source > 64K on 16-bit machine: */
     /* Check for source > 64K on 16-bit machine: */
     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;

+ 21 - 18
drivers/builtin_zlib/zlib/zconf.h

@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2012 Jean-loup Gailly.
+ * Copyright (C) 1995-2013 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
  */
 
 
@@ -14,10 +14,10 @@
  * Even better than compiling with -DZ_PREFIX would be to use configure to set
  * Even better than compiling with -DZ_PREFIX would be to use configure to set
  * this permanently in zconf.h using "./configure --zprefix".
  * this permanently in zconf.h using "./configure --zprefix".
  */
  */
- 
+
 #define Z_PREFIX
 #define Z_PREFIX
 #define Z_SOLO
 #define Z_SOLO
- 
+
 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
 #  define Z_PREFIX_SET
 #  define Z_PREFIX_SET
 
 
@@ -25,6 +25,7 @@
 #  define _dist_code            z__dist_code
 #  define _dist_code            z__dist_code
 #  define _length_code          z__length_code
 #  define _length_code          z__length_code
 #  define _tr_align             z__tr_align
 #  define _tr_align             z__tr_align
+#  define _tr_flush_bits        z__tr_flush_bits
 #  define _tr_flush_block       z__tr_flush_block
 #  define _tr_flush_block       z__tr_flush_block
 #  define _tr_init              z__tr_init
 #  define _tr_init              z__tr_init
 #  define _tr_stored_block      z__tr_stored_block
 #  define _tr_stored_block      z__tr_stored_block
@@ -81,6 +82,7 @@
 #      define gzopen_w              z_gzopen_w
 #      define gzopen_w              z_gzopen_w
 #    endif
 #    endif
 #    define gzprintf              z_gzprintf
 #    define gzprintf              z_gzprintf
+#    define gzvprintf             z_gzvprintf
 #    define gzputc                z_gzputc
 #    define gzputc                z_gzputc
 #    define gzputs                z_gzputs
 #    define gzputs                z_gzputs
 #    define gzread                z_gzread
 #    define gzread                z_gzread
@@ -107,6 +109,7 @@
 #  define inflateReset          z_inflateReset
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
 #  define inflateReset2         z_inflateReset2
 #  define inflateSetDictionary  z_inflateSetDictionary
 #  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
 #  define inflateUndermine      z_inflateUndermine
@@ -392,20 +395,14 @@ typedef uLong FAR uLongf;
    typedef Byte       *voidp;
    typedef Byte       *voidp;
 #endif
 #endif
 
 
-/* ./configure may #define Z_U4 here */
-
 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
 #  include <limits.h>
 #  include <limits.h>
 #  if (UINT_MAX == 0xffffffffUL)
 #  if (UINT_MAX == 0xffffffffUL)
 #    define Z_U4 unsigned
 #    define Z_U4 unsigned
-#  else
-#    if (ULONG_MAX == 0xffffffffUL)
-#      define Z_U4 unsigned long
-#    else
-#      if (USHRT_MAX == 0xffffffffUL)
-#        define Z_U4 unsigned short
-#      endif
-#    endif
+#  elif (ULONG_MAX == 0xffffffffUL)
+#    define Z_U4 unsigned long
+#  elif (USHRT_MAX == 0xffffffffUL)
+#    define Z_U4 unsigned short
 #  endif
 #  endif
 #endif
 #endif
 
 
@@ -429,10 +426,16 @@ typedef uLong FAR uLongf;
 #  endif
 #  endif
 #endif
 #endif
 
 
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+#    include <stdarg.h>         /* for va_list */
+#  endif
+#endif
+
 #ifdef _WIN32
 #ifdef _WIN32
-# ifndef Z_SOLO
-#  include <stddef.h>           /* for wchar_t */
-# endif
+#  ifndef Z_SOLO
+#    include <stddef.h>         /* for wchar_t */
+#  endif
 #endif
 #endif
 
 
 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
@@ -441,7 +444,7 @@ typedef uLong FAR uLongf;
  * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  * equivalently requesting no 64-bit operations
  * equivalently requesting no 64-bit operations
  */
  */
-#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
+#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
 #  undef _LARGEFILE64_SOURCE
 #  undef _LARGEFILE64_SOURCE
 #endif
 #endif
 
 
@@ -449,7 +452,7 @@ typedef uLong FAR uLongf;
 #  define Z_HAVE_UNISTD_H
 #  define Z_HAVE_UNISTD_H
 #endif
 #endif
 #ifndef Z_SOLO
 #ifndef Z_SOLO
-#  if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE)
+#  if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
 #    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
 #    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
 #    ifdef VMS
 #    ifdef VMS
 #      include <unixio.h>       /* for off_t */
 #      include <unixio.h>       /* for off_t */

+ 0 - 332
drivers/builtin_zlib/zlib/zconf.in.h

@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-#  define deflateInit_          z_deflateInit_
-#  define deflate               z_deflate
-#  define deflateEnd            z_deflateEnd
-#  define inflateInit_          z_inflateInit_
-#  define inflate               z_inflate
-#  define inflateEnd            z_inflateEnd
-#  define deflateInit2_         z_deflateInit2_
-#  define deflateSetDictionary  z_deflateSetDictionary
-#  define deflateCopy           z_deflateCopy
-#  define deflateReset          z_deflateReset
-#  define deflateParams         z_deflateParams
-#  define deflateBound          z_deflateBound
-#  define deflatePrime          z_deflatePrime
-#  define inflateInit2_         z_inflateInit2_
-#  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateSync           z_inflateSync
-#  define inflateSyncPoint      z_inflateSyncPoint
-#  define inflateCopy           z_inflateCopy
-#  define inflateReset          z_inflateReset
-#  define inflateBack           z_inflateBack
-#  define inflateBackEnd        z_inflateBackEnd
-#  define compress              z_compress
-#  define compress2             z_compress2
-#  define compressBound         z_compressBound
-#  define uncompress            z_uncompress
-#  define adler32               z_adler32
-#  define crc32                 z_crc32
-#  define get_crc_table         z_get_crc_table
-#  define zError                z_zError
-
-#  define alloc_func            z_alloc_func
-#  define free_func             z_free_func
-#  define in_func               z_in_func
-#  define out_func              z_out_func
-#  define Byte                  z_Byte
-#  define uInt                  z_uInt
-#  define uLong                 z_uLong
-#  define Bytef                 z_Bytef
-#  define charf                 z_charf
-#  define intf                  z_intf
-#  define uIntf                 z_uIntf
-#  define uLongf                z_uLongf
-#  define voidpf                z_voidpf
-#  define voidp                 z_voidp
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-#  define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-#  define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-#  define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-#  ifndef WIN32
-#    define WIN32
-#  endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-#    ifndef SYS16BIT
-#      define SYS16BIT
-#    endif
-#  endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-#  define MAXSEG_64K
-#endif
-#ifdef MSDOS
-#  define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-#  ifndef STDC
-#    define STDC
-#  endif
-#  if __STDC_VERSION__ >= 199901L
-#    ifndef STDC99
-#      define STDC99
-#    endif
-#  endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-#  define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
-#  define STDC
-#endif
-
-#ifndef STDC
-#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-#    define const       /* note: need a more gentle solution here */
-#  endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-#  ifdef MAXSEG_64K
-#    define MAX_MEM_LEVEL 8
-#  else
-#    define MAX_MEM_LEVEL 9
-#  endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-#  define MAX_WBITS   15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
-            (1 << (windowBits+2)) +  (1 << (memLevel+9))
- that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
-     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
-   The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
-                        /* Type declarations */
-
-#ifndef OF /* function prototypes */
-#  ifdef STDC
-#    define OF(args)  args
-#  else
-#    define OF(args)  ()
-#  endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-#  if defined(M_I86SM) || defined(M_I86MM)
-     /* MSC small or medium model */
-#    define SMALL_MEDIUM
-#    ifdef _MSC_VER
-#      define FAR _far
-#    else
-#      define FAR far
-#    endif
-#  endif
-#  if (defined(__SMALL__) || defined(__MEDIUM__))
-     /* Turbo C small or medium model */
-#    define SMALL_MEDIUM
-#    ifdef __BORLANDC__
-#      define FAR _far
-#    else
-#      define FAR far
-#    endif
-#  endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
-   /* If building or using zlib as a DLL, define ZLIB_DLL.
-    * This is not mandatory, but it offers a little performance increase.
-    */
-#  ifdef ZLIB_DLL
-#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-#      ifdef ZLIB_INTERNAL
-#        define ZEXTERN extern __declspec(dllexport)
-#      else
-#        define ZEXTERN extern __declspec(dllimport)
-#      endif
-#    endif
-#  endif  /* ZLIB_DLL */
-   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
-    * define ZLIB_WINAPI.
-    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
-    */
-#  ifdef ZLIB_WINAPI
-#    ifdef FAR
-#      undef FAR
-#    endif
-#    include <windows.h>
-     /* No need for _export, use ZLIB.DEF instead. */
-     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-#    define ZEXPORT WINAPI
-#    ifdef WIN32
-#      define ZEXPORTVA WINAPIV
-#    else
-#      define ZEXPORTVA FAR CDECL
-#    endif
-#  endif
-#endif
-
-#if defined (__BEOS__)
-#  ifdef ZLIB_DLL
-#    ifdef ZLIB_INTERNAL
-#      define ZEXPORT   __declspec(dllexport)
-#      define ZEXPORTVA __declspec(dllexport)
-#    else
-#      define ZEXPORT   __declspec(dllimport)
-#      define ZEXPORTVA __declspec(dllimport)
-#    endif
-#  endif
-#endif
-
-#ifndef ZEXTERN
-#  define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-#  define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-#  define ZEXPORTVA
-#endif
-
-#ifndef FAR
-#  define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char  Byte;  /* 8 bits */
-#endif
-typedef unsigned int   uInt;  /* 16 bits or more */
-typedef unsigned long  uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
-   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-#  define Bytef Byte FAR
-#else
-   typedef Byte  FAR Bytef;
-#endif
-typedef char  FAR charf;
-typedef int   FAR intf;
-typedef uInt  FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
-   typedef void const *voidpc;
-   typedef void FAR   *voidpf;
-   typedef void       *voidp;
-#else
-   typedef Byte const *voidpc;
-   typedef Byte FAR   *voidpf;
-   typedef Byte       *voidp;
-#endif
-
-#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
-#  include <sys/types.h> /* for off_t */
-#  include <unistd.h>    /* for SEEK_* and off_t */
-#  ifdef VMS
-#    include <unixio.h>   /* for off_t */
-#  endif
-#  define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-#  define SEEK_SET        0       /* Seek from beginning of file.  */
-#  define SEEK_CUR        1       /* Seek from current position.  */
-#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-#  define z_off_t long
-#endif
-
-#if defined(__OS400__)
-#  define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-#  define NO_vsnprintf
-#  ifdef FAR
-#    undef FAR
-#  endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-#   pragma map(deflateInit_,"DEIN")
-#   pragma map(deflateInit2_,"DEIN2")
-#   pragma map(deflateEnd,"DEEND")
-#   pragma map(deflateBound,"DEBND")
-#   pragma map(inflateInit_,"ININ")
-#   pragma map(inflateInit2_,"ININ2")
-#   pragma map(inflateEnd,"INEND")
-#   pragma map(inflateSync,"INSY")
-#   pragma map(inflateSetDictionary,"INSEDI")
-#   pragma map(compressBound,"CMBND")
-#   pragma map(inflate_table,"INTABL")
-#   pragma map(inflate_fast,"INFA")
-#   pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */

+ 36 - 12
drivers/builtin_zlib/zlib/zlib.h

@@ -1,7 +1,7 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.7, May 2nd, 2012
+  version 1.2.8, April 28th, 2013
 
 
-  Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
+  Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -37,11 +37,11 @@
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
-#define ZLIB_VERSION "1.2.7"
-#define ZLIB_VERNUM 0x1270
+#define ZLIB_VERSION "1.2.8"
+#define ZLIB_VERNUM 0x1280
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
 #define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 7
+#define ZLIB_VER_REVISION 8
 #define ZLIB_VER_SUBREVISION 0
 #define ZLIB_VER_SUBREVISION 0
 
 
 /*
 /*
@@ -839,6 +839,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
    inflate().
    inflate().
 */
 */
 
 
+ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
+                                             Bytef *dictionary,
+                                             uInt  *dictLength));
+/*
+     Returns the sliding dictionary being maintained by inflate.  dictLength is
+   set to the number of bytes in the dictionary, and that many bytes are copied
+   to dictionary.  dictionary must have enough space, where 32768 bytes is
+   always enough.  If inflateGetDictionary() is called with dictionary equal to
+   Z_NULL, then only the dictionary length is returned, and nothing is copied.
+   Similary, if dictLength is Z_NULL, then it is not set.
+
+     inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
+   stream state is inconsistent.
+*/
+
 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 /*
 /*
      Skips invalid compressed data until a possible full flush point (see above
      Skips invalid compressed data until a possible full flush point (see above
@@ -846,7 +861,7 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
    available input is skipped.  No output is provided.
    available input is skipped.  No output is provided.
 
 
      inflateSync searches for a 00 00 FF FF pattern in the compressed data.
      inflateSync searches for a 00 00 FF FF pattern in the compressed data.
-   All full flush points have this pattern, but not all occurences of this
+   All full flush points have this pattern, but not all occurrences of this
    pattern are full flush points.
    pattern are full flush points.
 
 
      inflateSync returns Z_OK if a possible full flush point has been found,
      inflateSync returns Z_OK if a possible full flush point has been found,
@@ -1007,7 +1022,8 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
    the version of the header file.
    the version of the header file.
 */
 */
 
 
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef unsigned (*in_func) OF((void FAR *,
+                                z_const unsigned char FAR * FAR *));
 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
 
 
 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
@@ -1015,11 +1031,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
                                     out_func out, void FAR *out_desc));
                                     out_func out, void FAR *out_desc));
 /*
 /*
      inflateBack() does a raw inflate with a single call using a call-back
      inflateBack() does a raw inflate with a single call using a call-back
-   interface for input and output.  This is more efficient than inflate() for
-   file i/o applications in that it avoids copying between the output and the
-   sliding window by simply making the window itself the output buffer.  This
-   function trusts the application to not change the output buffer passed by
-   the output function, at least until inflateBack() returns.
+   interface for input and output.  This is potentially more efficient than
+   inflate() for file i/o applications, in that it avoids copying between the
+   output and the sliding window by simply making the window itself the output
+   buffer.  inflate() can be faster on modern CPUs when used with large
+   buffers.  inflateBack() trusts the application to not change the output
+   buffer passed by the output function, at least until inflateBack() returns.
 
 
      inflateBackInit() must be called first to allocate the internal state
      inflateBackInit() must be called first to allocate the internal state
    and to initialize the state with the user-provided window buffer.
    and to initialize the state with the user-provided window buffer.
@@ -1736,6 +1753,13 @@ ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
 ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
 ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
                                             const char *mode));
                                             const char *mode));
 #endif
 #endif
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+ZEXTERN int            ZEXPORTVA gzvprintf Z_ARG((gzFile file,
+                                                  const char *format,
+                                                  va_list va));
+#  endif
+#endif
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }

+ 1 - 1
drivers/builtin_zlib/zlib/zutil.c

@@ -14,7 +14,7 @@
 struct internal_state      {int dummy;}; /* for buggy compilers */
 struct internal_state      {int dummy;}; /* for buggy compilers */
 #endif
 #endif
 
 
-const char * const z_errmsg[10] = {
+z_const char * const z_errmsg[10] = {
 "need dictionary",     /* Z_NEED_DICT       2  */
 "need dictionary",     /* Z_NEED_DICT       2  */
 "stream end",          /* Z_STREAM_END      1  */
 "stream end",          /* Z_STREAM_END      1  */
 "",                    /* Z_OK              0  */
 "",                    /* Z_OK              0  */

+ 5 - 4
drivers/builtin_zlib/zlib/zutil.h

@@ -1,5 +1,5 @@
 /* zutil.h -- internal interface and configuration of the compression library
 /* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2012 Jean-loup Gailly.
+ * Copyright (C) 1995-2013 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
  */
 
 
@@ -44,13 +44,13 @@ typedef unsigned short ush;
 typedef ush FAR ushf;
 typedef ush FAR ushf;
 typedef unsigned long  ulg;
 typedef unsigned long  ulg;
 
 
-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 /* (size given to avoid silly warnings with Visual C++) */
 /* (size given to avoid silly warnings with Visual C++) */
 
 
 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 
 
 #define ERR_RETURN(strm,err) \
 #define ERR_RETURN(strm,err) \
-  return (strm->msg = (char*)ERR_MSG(err), (err))
+  return (strm->msg = ERR_MSG(err), (err))
 /* To be used only when the state is known to be valid */
 /* To be used only when the state is known to be valid */
 
 
         /* common constants */
         /* common constants */
@@ -168,7 +168,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #endif
 #endif
 
 
 /* provide prototypes for these when building zlib without LFS */
 /* provide prototypes for these when building zlib without LFS */
-#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
+#if !defined(_WIN32) && \
+    (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
 #endif
 #endif

+ 10 - 18
drivers/etc1/rg_etc1.cpp

@@ -4,15 +4,19 @@
 // For more information Ericsson Texture Compression (ETC/ETC1), see:
 // For more information Ericsson Texture Compression (ETC/ETC1), see:
 // http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
 // http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
 //
 //
+// v1.04 - 5/15/14 - Fix signed vs. unsigned subtraction problem (noticed when compiled with gcc) in pack_etc1_block_init(). 
+//         This issue would cause an assert when this func. was called in debug. (Note this module was developed/testing with MSVC, 
+//         I still need to test it throughly when compiled with gcc.)
+//
 // v1.03 - 5/12/13 - Initial public release
 // v1.03 - 5/12/13 - Initial public release
 #include "rg_etc1.h"
 #include "rg_etc1.h"
 
 
 #include <stdlib.h>
 #include <stdlib.h>
-#include <string.h>
+#include <memory.h>
 #include <assert.h>
 #include <assert.h>
 //#include <stdio.h>
 //#include <stdio.h>
 #include <math.h>
 #include <math.h>
-#include <stdio.h>
+
 #pragma warning (disable: 4201) //  nonstandard extension used : nameless struct/union
 #pragma warning (disable: 4201) //  nonstandard extension used : nameless struct/union
 
 
 #if defined(_DEBUG) || defined(DEBUG)
 #if defined(_DEBUG) || defined(DEBUG)
@@ -23,16 +27,6 @@
 
 
 namespace rg_etc1
 namespace rg_etc1
 {
 {
-
-   inline long labs(long val) {
-        return val < 0 ? -val : val;
-   }
-
-   inline int intabs(int val) {
-
-       return val<0?-val:val;
-   }
-
    typedef unsigned char uint8;
    typedef unsigned char uint8;
    typedef unsigned short uint16;
    typedef unsigned short uint16;
    typedef unsigned int uint;
    typedef unsigned int uint;
@@ -372,7 +366,6 @@ namespace rg_etc1
    
    
    static uint8 g_quant5_tab[256+16];
    static uint8 g_quant5_tab[256+16];
 
 
-
    static const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] = 
    static const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] = 
    { 
    { 
       { -8,  -2,   2,   8 }, { -17,  -5,  5,  17 }, { -29,  -9,   9,  29 }, {  -42, -13, 13,  42 }, 
       { -8,  -2,   2,   8 }, { -17,  -5,  5,  17 }, { -29,  -9,   9,  29 }, {  -42, -13, 13,  42 }, 
@@ -437,7 +430,7 @@ namespace rg_etc1
       0x0428, 0x071C, 0x0735, 0x0E05, 0x0C17, 0xFFFF }, { 0x0520, 0x0A23, 0x0927, 0xFFFF }, { 0x0B11, 0x1209, 0x013B, 0x052F,
       0x0428, 0x071C, 0x0735, 0x0E05, 0x0C17, 0xFFFF }, { 0x0520, 0x0A23, 0x0927, 0xFFFF }, { 0x0B11, 0x1209, 0x013B, 0x052F,
       0xFFFF }, { 0x0616, 0x081E, 0x0D19, 0xFFFF }, { 0x0522, 0x0704, 0x0A0A, 0x0A31, 0x0D03, 0x0C15, 0x1007, 0x082B, 0x072D,
       0xFFFF }, { 0x0616, 0x081E, 0x0D19, 0xFFFF }, { 0x0522, 0x0704, 0x0A0A, 0x0A31, 0x0D03, 0x0C15, 0x1007, 0x082B, 0x072D,
       0x0F1D, 0xFFFF }, { 0x0C01, 0x0933, 0x0A25, 0x0637, 0x0E1B, 0xFFFF }, { 0x042A, 0x0B21, 0x0929, 0x180D, 0xFFFF }, {
       0x0F1D, 0xFFFF }, { 0x0C01, 0x0933, 0x0A25, 0x0637, 0x0E1B, 0xFFFF }, { 0x042A, 0x0B21, 0x0929, 0x180D, 0xFFFF }, {
-	      0x0530, 0x0614, 0x0336, 0x0908, 0x0439, 0x150B, 0x111F, 0xFFFF }, { 0x0600, 0x0524, 0x0806, 0x0238, 0x0C13, 0x0F05,
+      0x0530, 0x0614, 0x0336, 0x0908, 0x0439, 0x150B, 0x111F, 0xFFFF }, { 0x0600, 0x0524, 0x0806, 0x0238, 0x0C13, 0x0F05,
       0x0D17, 0xFFFF }, { 0x071A, 0x0B23, 0x0835, 0x0A27, 0xFFFF }, { 0x1309, 0x023B, 0x062F, 0xFFFF }, { 0x0612, 0x0434,
       0x0D17, 0xFFFF }, { 0x071A, 0x0B23, 0x0835, 0x0A27, 0xFFFF }, { 0x1309, 0x023B, 0x062F, 0xFFFF }, { 0x0612, 0x0434,
       0x013A, 0x0C11, 0x0E19, 0xFFFF }, { 0x0526, 0x0C0C, 0x032E, 0x0B31, 0x0E03, 0x0D15, 0x1107, 0x092B, 0xFFFF }, { 0x0D01,
       0x013A, 0x0C11, 0x0E19, 0xFFFF }, { 0x0526, 0x0C0C, 0x032E, 0x0B31, 0x0E03, 0x0D15, 0x1107, 0x092B, 0xFFFF }, { 0x0D01,
       0x0A33, 0x0B25, 0x0737, 0x0F1B, 0x082D, 0x101D, 0xFFFF }, { 0x0610, 0x0A29, 0x190D, 0xFFFF }, { 0x0718, 0x042C, 0x0C21,
       0x0A33, 0x0B25, 0x0737, 0x0F1B, 0x082D, 0x101D, 0xFFFF }, { 0x0610, 0x0A29, 0x190D, 0xFFFF }, { 0x0718, 0x042C, 0x0C21,
@@ -1810,7 +1803,7 @@ namespace rg_etc1
          {
          {
             if (block_inten[0] > m_pSorted_luma[n - 1])
             if (block_inten[0] > m_pSorted_luma[n - 1])
             {
             {
-           const uint min_error = intabs(block_inten[0] - m_pSorted_luma[n - 1]);
+               const uint min_error = labs(block_inten[0] - m_pSorted_luma[n - 1]);
                if (min_error >= trial_solution.m_error)
                if (min_error >= trial_solution.m_error)
                   continue;
                   continue;
             }
             }
@@ -1824,7 +1817,7 @@ namespace rg_etc1
          {
          {
             if (m_pSorted_luma[0] > block_inten[3])
             if (m_pSorted_luma[0] > block_inten[3])
             {
             {
-           const uint min_error = intabs(m_pSorted_luma[0] - block_inten[3]);
+               const uint min_error = labs(m_pSorted_luma[0] - block_inten[3]);
                if (min_error >= trial_solution.m_error)
                if (min_error >= trial_solution.m_error)
                   continue;
                   continue;
             }
             }
@@ -1917,7 +1910,6 @@ done:
                   {
                   {
                      int v = etc1_decode_value(diff, inten, selector, packed_c);
                      int v = etc1_decode_value(diff, inten, selector, packed_c);
                      uint err = labs(v - static_cast<int>(color));
                      uint err = labs(v - static_cast<int>(color));
-		     //printf("err: %d - %u = %u\n",v,color,err);
                      if (err < best_error)
                      if (err < best_error)
                      {
                      {
                         best_error = err;
                         best_error = err;
@@ -2370,7 +2362,7 @@ found_perfect_match:
       int dr = best_results[1].m_block_color_unscaled.r - best_results[0].m_block_color_unscaled.r;
       int dr = best_results[1].m_block_color_unscaled.r - best_results[0].m_block_color_unscaled.r;
       int dg = best_results[1].m_block_color_unscaled.g - best_results[0].m_block_color_unscaled.g;
       int dg = best_results[1].m_block_color_unscaled.g - best_results[0].m_block_color_unscaled.g;
       int db = best_results[1].m_block_color_unscaled.b - best_results[0].m_block_color_unscaled.b;
       int db = best_results[1].m_block_color_unscaled.b - best_results[0].m_block_color_unscaled.b;
-      RG_ETC1_ASSERT(best_use_color4 || ((rg_etc1::minimum(dr, dg, db) >= cETC1ColorDeltaMin) && (rg_etc1::maximum(dr, dg, db) <= cETC1ColorDeltaMax)));
+      RG_ETC1_ASSERT(best_use_color4 || (rg_etc1::minimum(dr, dg, db) >= cETC1ColorDeltaMin) && (rg_etc1::maximum(dr, dg, db) <= cETC1ColorDeltaMax));
            
            
       if (best_use_color4)
       if (best_use_color4)
       {
       {

+ 37 - 37
drivers/rtaudio/RtAudio.cpp

@@ -1,4 +1,5 @@
-#ifdef RTAUDIO_ENABLED
+#ifdef RTAUDIO_ENABLED // -GODOT-
+
 /************************************************************************/
 /************************************************************************/
 /*! \class RtAudio
 /*! \class RtAudio
     \brief Realtime audio i/o C++ classes.
     \brief Realtime audio i/o C++ classes.
@@ -11,7 +12,7 @@
     RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
     RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
 
 
     RtAudio: realtime audio i/o C++ classes
     RtAudio: realtime audio i/o C++ classes
-    Copyright (c) 2001-2014 Gary P. Scavone
+    Copyright (c) 2001-2016 Gary P. Scavone
 
 
     Permission is hereby granted, free of charge, to any person
     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated documentation files
     obtaining a copy of this software and associated documentation files
@@ -39,7 +40,7 @@
 */
 */
 /************************************************************************/
 /************************************************************************/
 
 
-// RtAudio: Version 4.1.1
+// RtAudio: Version 4.1.2
 
 
 #include "RtAudio.h"
 #include "RtAudio.h"
 #include <iostream>
 #include <iostream>
@@ -56,11 +57,7 @@ const unsigned int RtApi::SAMPLE_RATES[] = {
 };
 };
 
 
 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__)
 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__)
-#ifdef WINRT_ENABLED
-  #define MUTEX_INITIALIZE(A) InitializeCriticalSectionEx(A, 0, 0)
-#else
   #define MUTEX_INITIALIZE(A) InitializeCriticalSection(A)
   #define MUTEX_INITIALIZE(A) InitializeCriticalSection(A)
-#endif
   #define MUTEX_DESTROY(A)    DeleteCriticalSection(A)
   #define MUTEX_DESTROY(A)    DeleteCriticalSection(A)
   #define MUTEX_LOCK(A)       EnterCriticalSection(A)
   #define MUTEX_LOCK(A)       EnterCriticalSection(A)
   #define MUTEX_UNLOCK(A)     LeaveCriticalSection(A)
   #define MUTEX_UNLOCK(A)     LeaveCriticalSection(A)
@@ -139,7 +136,8 @@ void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis ) throw()
 
 
 void RtAudio :: openRtApi( RtAudio::Api api )
 void RtAudio :: openRtApi( RtAudio::Api api )
 {
 {
-  delete rtapi_;
+  if ( rtapi_ )
+    delete rtapi_;
   rtapi_ = 0;
   rtapi_ = 0;
 
 
 #if defined(__UNIX_JACK__)
 #if defined(__UNIX_JACK__)
@@ -215,7 +213,8 @@ RtAudio :: RtAudio( RtAudio::Api api )
 
 
 RtAudio :: ~RtAudio() throw()
 RtAudio :: ~RtAudio() throw()
 {
 {
-  delete rtapi_;
+  if ( rtapi_ )
+    delete rtapi_;
 }
 }
 
 
 void RtAudio :: openStream( RtAudio::StreamParameters *outputParameters,
 void RtAudio :: openStream( RtAudio::StreamParameters *outputParameters,
@@ -418,7 +417,7 @@ double RtApi :: getStreamTime( void )
   then = stream_.lastTickTimestamp;
   then = stream_.lastTickTimestamp;
   return stream_.streamTime +
   return stream_.streamTime +
     ((now.tv_sec + 0.000001 * now.tv_usec) -
     ((now.tv_sec + 0.000001 * now.tv_usec) -
-     (then.tv_sec + 0.000001 * then.tv_usec));     
+     (then.tv_sec + 0.000001 * then.tv_usec));
 #else
 #else
   return stream_.streamTime;
   return stream_.streamTime;
 #endif
 #endif
@@ -1832,7 +1831,7 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId,
           channelsLeft -= streamChannels;
           channelsLeft -= streamChannels;
         }
         }
       }
       }
-      
+
       if ( stream_.doConvertBuffer[1] ) { // convert from our internal "device" buffer
       if ( stream_.doConvertBuffer[1] ) { // convert from our internal "device" buffer
         convertBuffer( stream_.userBuffer[1],
         convertBuffer( stream_.userBuffer[1],
                        stream_.deviceBuffer,
                        stream_.deviceBuffer,
@@ -2719,7 +2718,7 @@ RtApiAsio :: RtApiAsio()
   // CoInitialize beforehand, but it must be for appartment threading
   // CoInitialize beforehand, but it must be for appartment threading
   // (in which case, CoInitilialize will return S_FALSE here).
   // (in which case, CoInitilialize will return S_FALSE here).
   coInitialized_ = false;
   coInitialized_ = false;
-  HRESULT hr = CoInitialize( NULL ); 
+  HRESULT hr = CoInitialize( NULL );
   if ( FAILED(hr) ) {
   if ( FAILED(hr) ) {
     errorText_ = "RtApiAsio::ASIO requires a single-threaded appartment. Call CoInitializeEx(0,COINIT_APARTMENTTHREADED)";
     errorText_ = "RtApiAsio::ASIO requires a single-threaded appartment. Call CoInitializeEx(0,COINIT_APARTMENTTHREADED)";
     error( RtAudioError::WARNING );
     error( RtAudioError::WARNING );
@@ -3170,7 +3169,7 @@ bool RtApiAsio :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
     errorText_ = errorStream_.str();
     errorText_ = errorStream_.str();
     goto error;
     goto error;
   }
   }
-  buffersAllocated = true;  
+  buffersAllocated = true;
   stream_.state = STREAM_STOPPED;
   stream_.state = STREAM_STOPPED;
 
 
   // Set flags for buffer conversion.
   // Set flags for buffer conversion.
@@ -3644,13 +3643,13 @@ static long asioMessages( long selector, long value, void* /*message*/, double*
 
 
 static const char* getAsioErrorString( ASIOError result )
 static const char* getAsioErrorString( ASIOError result )
 {
 {
-  struct Messages 
+  struct Messages
   {
   {
     ASIOError value;
     ASIOError value;
     const char*message;
     const char*message;
   };
   };
 
 
-  static const Messages m[] = 
+  static const Messages m[] =
     {
     {
       {   ASE_NotPresent,    "Hardware input or output is not present or available." },
       {   ASE_NotPresent,    "Hardware input or output is not present or available." },
       {   ASE_HWMalfunction,  "Hardware is malfunctioning." },
       {   ASE_HWMalfunction,  "Hardware is malfunctioning." },
@@ -5161,10 +5160,10 @@ void RtApiWasapi::wasapiThread()
     // if the callback buffer was pushed renderBuffer reset callbackPulled flag
     // if the callback buffer was pushed renderBuffer reset callbackPulled flag
     if ( callbackPushed ) {
     if ( callbackPushed ) {
       callbackPulled = false;
       callbackPulled = false;
+      // tick stream time
+      RtApi::tickStreamTime();
     }
     }
 
 
-    // tick stream time
-    RtApi::tickStreamTime();
   }
   }
 
 
 Exit:
 Exit:
@@ -5192,7 +5191,7 @@ Exit:
 #if defined(__WINDOWS_DS__) // Windows DirectSound API
 #if defined(__WINDOWS_DS__) // Windows DirectSound API
 
 
 // Modified by Robin Davies, October 2005
 // Modified by Robin Davies, October 2005
-// - Improvements to DirectX pointer chasing. 
+// - Improvements to DirectX pointer chasing.
 // - Bug fix for non-power-of-two Asio granularity used by Edirol PCR-A30.
 // - Bug fix for non-power-of-two Asio granularity used by Edirol PCR-A30.
 // - Auto-call CoInitialize for DSOUND and ASIO platforms.
 // - Auto-call CoInitialize for DSOUND and ASIO platforms.
 // Various revisions for RtAudio 4.0 by Gary Scavone, April 2007
 // Various revisions for RtAudio 4.0 by Gary Scavone, April 2007
@@ -5232,7 +5231,7 @@ struct DsHandle {
   void *id[2];
   void *id[2];
   void *buffer[2];
   void *buffer[2];
   bool xrun[2];
   bool xrun[2];
-  UINT bufferPointer[2];  
+  UINT bufferPointer[2];
   DWORD dsBufferSize[2];
   DWORD dsBufferSize[2];
   DWORD dsPointerLeadTime[2]; // the number of bytes ahead of the safe pointer to lead by.
   DWORD dsPointerLeadTime[2]; // the number of bytes ahead of the safe pointer to lead by.
   HANDLE condition;
   HANDLE condition;
@@ -6080,7 +6079,7 @@ void RtApiDs :: startStream()
   // Increase scheduler frequency on lesser windows (a side-effect of
   // Increase scheduler frequency on lesser windows (a side-effect of
   // increasing timer accuracy).  On greater windows (Win2K or later),
   // increasing timer accuracy).  On greater windows (Win2K or later),
   // this is already in effect.
   // this is already in effect.
-  timeBeginPeriod( 1 ); 
+  timeBeginPeriod( 1 );
 
 
   buffersRolling = false;
   buffersRolling = false;
   duplexPrerollBytes = 0;
   duplexPrerollBytes = 0;
@@ -6401,7 +6400,7 @@ void RtApiDs :: callbackEvent()
   }
   }
 
 
   if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
   if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
-    
+
     LPDIRECTSOUNDBUFFER dsBuffer = (LPDIRECTSOUNDBUFFER) handle->buffer[0];
     LPDIRECTSOUNDBUFFER dsBuffer = (LPDIRECTSOUNDBUFFER) handle->buffer[0];
 
 
     if ( handle->drainCounter > 1 ) { // write zeros to the output stream
     if ( handle->drainCounter > 1 ) { // write zeros to the output stream
@@ -6441,6 +6440,7 @@ void RtApiDs :: callbackEvent()
       if ( FAILED( result ) ) {
       if ( FAILED( result ) ) {
         errorStream_ << "RtApiDs::callbackEvent: error (" << getErrorString( result ) << ") getting current write position!";
         errorStream_ << "RtApiDs::callbackEvent: error (" << getErrorString( result ) << ") getting current write position!";
         errorText_ = errorStream_.str();
         errorText_ = errorStream_.str();
+        MUTEX_UNLOCK( &stream_.mutex );
         error( RtAudioError::SYSTEM_ERROR );
         error( RtAudioError::SYSTEM_ERROR );
         return;
         return;
       }
       }
@@ -6467,7 +6467,7 @@ void RtApiDs :: callbackEvent()
     }
     }
 
 
     if ( dsPointerBetween( nextWritePointer, safeWritePointer, currentWritePointer, dsBufferSize )
     if ( dsPointerBetween( nextWritePointer, safeWritePointer, currentWritePointer, dsBufferSize )
-         || dsPointerBetween( endWrite, safeWritePointer, currentWritePointer, dsBufferSize ) ) { 
+         || dsPointerBetween( endWrite, safeWritePointer, currentWritePointer, dsBufferSize ) ) {
       // We've strayed into the forbidden zone ... resync the read pointer.
       // We've strayed into the forbidden zone ... resync the read pointer.
       handle->xrun[0] = true;
       handle->xrun[0] = true;
       nextWritePointer = safeWritePointer + handle->dsPointerLeadTime[0] - bufferBytes;
       nextWritePointer = safeWritePointer + handle->dsPointerLeadTime[0] - bufferBytes;
@@ -6541,14 +6541,14 @@ void RtApiDs :: callbackEvent()
     if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
     if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
     DWORD endRead = nextReadPointer + bufferBytes;
     DWORD endRead = nextReadPointer + bufferBytes;
 
 
-    // Handling depends on whether we are INPUT or DUPLEX. 
+    // Handling depends on whether we are INPUT or DUPLEX.
     // If we're in INPUT mode then waiting is a good thing. If we're in DUPLEX mode,
     // If we're in INPUT mode then waiting is a good thing. If we're in DUPLEX mode,
     // then a wait here will drag the write pointers into the forbidden zone.
     // then a wait here will drag the write pointers into the forbidden zone.
-    // 
-    // In DUPLEX mode, rather than wait, we will back off the read pointer until 
-    // it's in a safe position. This causes dropouts, but it seems to be the only 
-    // practical way to sync up the read and write pointers reliably, given the 
-    // the very complex relationship between phase and increment of the read and write 
+    //
+    // In DUPLEX mode, rather than wait, we will back off the read pointer until
+    // it's in a safe position. This causes dropouts, but it seems to be the only
+    // practical way to sync up the read and write pointers reliably, given the
+    // the very complex relationship between phase and increment of the read and write
     // pointers.
     // pointers.
     //
     //
     // In order to minimize audible dropouts in DUPLEX mode, we will
     // In order to minimize audible dropouts in DUPLEX mode, we will
@@ -6599,7 +6599,7 @@ void RtApiDs :: callbackEvent()
           error( RtAudioError::SYSTEM_ERROR );
           error( RtAudioError::SYSTEM_ERROR );
           return;
           return;
         }
         }
-      
+
         if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
         if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
       }
       }
     }
     }
@@ -7809,7 +7809,7 @@ void RtApiAlsa :: stopStream()
   AlsaHandle *apiInfo = (AlsaHandle *) stream_.apiHandle;
   AlsaHandle *apiInfo = (AlsaHandle *) stream_.apiHandle;
   snd_pcm_t **handle = (snd_pcm_t **) apiInfo->handles;
   snd_pcm_t **handle = (snd_pcm_t **) apiInfo->handles;
   if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
   if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
-    if ( apiInfo->synchronized ) 
+    if ( apiInfo->synchronized )
       result = snd_pcm_drop( handle[0] );
       result = snd_pcm_drop( handle[0] );
     else
     else
       result = snd_pcm_drain( handle[0] );
       result = snd_pcm_drain( handle[0] );
@@ -8073,7 +8073,7 @@ static void *alsaCallbackHandler( void *ptr )
   bool *isRunning = &info->isRunning;
   bool *isRunning = &info->isRunning;
 
 
 #ifdef SCHED_RR // Undefined with some OSes (eg: NetBSD 1.6.x with GNU Pthread)
 #ifdef SCHED_RR // Undefined with some OSes (eg: NetBSD 1.6.x with GNU Pthread)
-  if ( &info->doRealtime ) {
+  if ( info->doRealtime ) {
     pthread_t tID = pthread_self();	 // ID of this thread
     pthread_t tID = pthread_self();	 // ID of this thread
     sched_param prio = { info->priority }; // scheduling priority of thread
     sched_param prio = { info->priority }; // scheduling priority of thread
     pthread_setschedparam( tID, SCHED_RR, &prio );
     pthread_setschedparam( tID, SCHED_RR, &prio );
@@ -8277,7 +8277,7 @@ void RtApiPulse::callbackEvent( void )
     else
     else
       bytes = stream_.nUserChannels[INPUT] * stream_.bufferSize *
       bytes = stream_.nUserChannels[INPUT] * stream_.bufferSize *
         formatBytes( stream_.userFormat );
         formatBytes( stream_.userFormat );
-            
+
     if ( pa_simple_read( pah->s_rec, pulse_in, bytes, &pa_error ) < 0 ) {
     if ( pa_simple_read( pah->s_rec, pulse_in, bytes, &pa_error ) < 0 ) {
       errorStream_ << "RtApiPulse::callbackEvent: audio read error, " <<
       errorStream_ << "RtApiPulse::callbackEvent: audio read error, " <<
         pa_strerror( pa_error ) << ".";
         pa_strerror( pa_error ) << ".";
@@ -8525,7 +8525,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
     }
     }
     break;
     break;
   case OUTPUT:
   case OUTPUT:
-    pah->s_play = pa_simple_new( NULL, "RtAudio", PA_STREAM_PLAYBACK, NULL, "Playback", &ss, NULL, NULL, &error );
+    pah->s_play = pa_simple_new( NULL, streamName.c_str(), PA_STREAM_PLAYBACK, NULL, "Playback", &ss, NULL, NULL, &error );
     if ( !pah->s_play ) {
     if ( !pah->s_play ) {
       errorText_ = "RtApiPulse::probeDeviceOpen: error connecting output to PulseAudio server.";
       errorText_ = "RtApiPulse::probeDeviceOpen: error connecting output to PulseAudio server.";
       goto error;
       goto error;
@@ -8553,7 +8553,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
 
 
   stream_.state = STREAM_STOPPED;
   stream_.state = STREAM_STOPPED;
   return true;
   return true;
- 
+
  error:
  error:
   if ( pah && stream_.callbackInfo.isRunning ) {
   if ( pah && stream_.callbackInfo.isRunning ) {
     pthread_cond_destroy( &pah->runnable_cv );
     pthread_cond_destroy( &pah->runnable_cv );
@@ -10145,8 +10145,8 @@ void RtApi :: convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info
 
 
 void RtApi :: byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format )
 void RtApi :: byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format )
 {
 {
-  register char val;
-  register char *ptr;
+  char val;
+  char *ptr;
 
 
   ptr = buffer;
   ptr = buffer;
   if ( format == RTAUDIO_SINT16 ) {
   if ( format == RTAUDIO_SINT16 ) {
@@ -10229,4 +10229,4 @@ void RtApi :: byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat
   //
   //
   // vim: et sts=2 sw=2
   // vim: et sts=2 sw=2
 
 
-#endif
+#endif // RTAUDIO_ENABLED -GODOT-

+ 26 - 32
drivers/rtaudio/RtAudio.h

@@ -1,26 +1,20 @@
+// -GODOT- Start
+
 #ifdef RTAUDIO_ENABLED
 #ifdef RTAUDIO_ENABLED
 
 
 #if defined(OSX_ENABLED)
 #if defined(OSX_ENABLED)
-
-#define __MACOSX_CORE__
-
+    #define __MACOSX_CORE__
 #elif defined(UNIX_ENABLED)
 #elif defined(UNIX_ENABLED)
-
-#define __LINUX_ALSA__
-
+    #define __LINUX_ALSA__
 #elif defined(WINDOWS_ENABLED)
 #elif defined(WINDOWS_ENABLED)
-
-#if defined(WINRT_ENABLED)
-
-#define __RTAUDIO_DUMMY__
-
-#else
-
-#define __WINDOWS_DS__
-
+    #if defined(WINRT_ENABLED)
+        #define __RTAUDIO_DUMMY__
+    #else
+        #define __WINDOWS_DS__
+    #endif
 #endif
 #endif
 
 
-#endif
+// -GODOT- End
 
 
 /************************************************************************/
 /************************************************************************/
 /*! \class RtAudio
 /*! \class RtAudio
@@ -34,7 +28,7 @@
     RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
     RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
 
 
     RtAudio: realtime audio i/o C++ classes
     RtAudio: realtime audio i/o C++ classes
-    Copyright (c) 2001-2014 Gary P. Scavone
+    Copyright (c) 2001-2016 Gary P. Scavone
 
 
     Permission is hereby granted, free of charge, to any person
     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated documentation files
     obtaining a copy of this software and associated documentation files
@@ -69,7 +63,7 @@
 #ifndef __RTAUDIO_H
 #ifndef __RTAUDIO_H
 #define __RTAUDIO_H
 #define __RTAUDIO_H
 
 
-#define RTAUDIO_VERSION "4.1.1"
+#define RTAUDIO_VERSION "4.1.2"
 
 
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
@@ -135,7 +129,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
     open the input and/or output stream device(s) for exclusive use.
     open the input and/or output stream device(s) for exclusive use.
     Note that this is not possible with all supported audio APIs.
     Note that this is not possible with all supported audio APIs.
 
 
-    If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt 
+    If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt
     to select realtime scheduling (round-robin) for the callback thread.
     to select realtime scheduling (round-robin) for the callback thread.
 
 
     If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
     If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
@@ -239,7 +233,7 @@ class RtAudioError : public std::exception
 
 
   //! The constructor.
   //! The constructor.
   RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
   RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
- 
+
   //! The destructor.
   //! The destructor.
   virtual ~RtAudioError( void ) throw() {}
   virtual ~RtAudioError( void ) throw() {}
 
 
@@ -365,7 +359,7 @@ class RtAudio
     open the input and/or output stream device(s) for exclusive use.
     open the input and/or output stream device(s) for exclusive use.
     Note that this is not possible with all supported audio APIs.
     Note that this is not possible with all supported audio APIs.
 
 
-    If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt 
+    If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt
     to select realtime scheduling (round-robin) for the callback thread.
     to select realtime scheduling (round-robin) for the callback thread.
     The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME
     The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME
     flag is set. It defines the thread's realtime priority.
     flag is set. It defines the thread's realtime priority.
@@ -434,7 +428,7 @@ class RtAudio
   /*!
   /*!
     This function performs a system query of available devices each time it
     This function performs a system query of available devices each time it
     is called, thus supporting devices connected \e after instantiation. If
     is called, thus supporting devices connected \e after instantiation. If
-    a system error occurs during processing, a warning will be issued. 
+    a system error occurs during processing, a warning will be issued.
   */
   */
   unsigned int getDeviceCount( void ) throw();
   unsigned int getDeviceCount( void ) throw();
 
 
@@ -501,7 +495,7 @@ class RtAudio
            from within the callback function.
            from within the callback function.
     \param options An optional pointer to a structure containing various
     \param options An optional pointer to a structure containing various
            global stream options, including a list of OR'ed RtAudioStreamFlags
            global stream options, including a list of OR'ed RtAudioStreamFlags
-           and a suggested number of stream buffers that can be used to 
+           and a suggested number of stream buffers that can be used to
            control stream latency.  More buffers typically result in more
            control stream latency.  More buffers typically result in more
            robust performance, though at a cost of greater latency.  If a
            robust performance, though at a cost of greater latency.  If a
            value of zero is specified, a system-specific median value is
            value of zero is specified, a system-specific median value is
@@ -806,7 +800,7 @@ protected:
     "warning" message is reported and FAILURE is returned. A
     "warning" message is reported and FAILURE is returned. A
     successful probe is indicated by a return value of SUCCESS.
     successful probe is indicated by a return value of SUCCESS.
   */
   */
-  virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                                 unsigned int firstChannel, unsigned int sampleRate,
                                 unsigned int firstChannel, unsigned int sampleRate,
                                 RtAudioFormat format, unsigned int *bufferSize,
                                 RtAudioFormat format, unsigned int *bufferSize,
                                 RtAudio::StreamOptions *options );
                                 RtAudio::StreamOptions *options );
@@ -898,7 +892,7 @@ public:
 
 
   private:
   private:
 
 
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -932,7 +926,7 @@ public:
 
 
   private:
   private:
 
 
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -968,7 +962,7 @@ public:
   std::vector<RtAudio::DeviceInfo> devices_;
   std::vector<RtAudio::DeviceInfo> devices_;
   void saveDeviceInfo( void );
   void saveDeviceInfo( void );
   bool coInitialized_;
   bool coInitialized_;
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -1007,7 +1001,7 @@ public:
   bool buffersRolling;
   bool buffersRolling;
   long duplexPrerollBytes;
   long duplexPrerollBytes;
   std::vector<struct DsDevice> dsDevices;
   std::vector<struct DsDevice> dsDevices;
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -1078,7 +1072,7 @@ public:
 
 
   std::vector<RtAudio::DeviceInfo> devices_;
   std::vector<RtAudio::DeviceInfo> devices_;
   void saveDeviceInfo( void );
   void saveDeviceInfo( void );
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -1142,7 +1136,7 @@ public:
 
 
   private:
   private:
 
 
-  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+  bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
                         unsigned int firstChannel, unsigned int sampleRate,
                         unsigned int firstChannel, unsigned int sampleRate,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudioFormat format, unsigned int *bufferSize,
                         RtAudio::StreamOptions *options );
                         RtAudio::StreamOptions *options );
@@ -1167,7 +1161,7 @@ public:
 
 
   private:
   private:
 
 
-  bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/, 
+  bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/,
                         unsigned int /*firstChannel*/, unsigned int /*sampleRate*/,
                         unsigned int /*firstChannel*/, unsigned int /*sampleRate*/,
                         RtAudioFormat /*format*/, unsigned int * /*bufferSize*/,
                         RtAudioFormat /*format*/, unsigned int * /*bufferSize*/,
                         RtAudio::StreamOptions * /*options*/ ) { return false; }
                         RtAudio::StreamOptions * /*options*/ ) { return false; }
@@ -1186,4 +1180,4 @@ public:
 //
 //
 // vim: et sts=2 sw=2
 // vim: et sts=2 sw=2
 
 
-#endif
+#endif // RTAUDIO_ENABLED -GODOT-

+ 0 - 60
drivers/rtaudio/RtError.h

@@ -1,60 +0,0 @@
-/************************************************************************/
-/*! \class RtError
-    \brief Exception handling class for RtAudio & RtMidi.
-
-    The RtError class is quite simple but it does allow errors to be
-    "caught" by RtError::Type. See the RtAudio and RtMidi
-    documentation to know which methods can throw an RtError.
-
-*/
-/************************************************************************/
-
-#ifndef RTERROR_H
-#define RTERROR_H
-
-#include <exception>
-#include <iostream>
-#include <string>
-
-class RtError : public std::exception
-{
- public:
-  //! Defined RtError types.
-  enum Type {
-    WARNING,           /*!< A non-critical error. */
-    DEBUG_WARNING,     /*!< A non-critical error which might be useful for debugging. */
-    UNSPECIFIED,       /*!< The default, unspecified error type. */
-    NO_DEVICES_FOUND,  /*!< No devices found on system. */
-    INVALID_DEVICE,    /*!< An invalid device ID was specified. */
-    MEMORY_ERROR,      /*!< An error occured during memory allocation. */
-    INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
-    INVALID_USE,       /*!< The function was called incorrectly. */
-    DRIVER_ERROR,      /*!< A system driver error occured. */
-    SYSTEM_ERROR,      /*!< A system error occured. */
-    THREAD_ERROR       /*!< A thread error occured. */
-  };
-
-  //! The constructor.
-  RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
- 
-  //! The destructor.
-  virtual ~RtError( void ) throw() {}
-
-  //! Prints thrown error message to stderr.
-  virtual void printMessage( void ) throw() { std::cerr << '\n' << message_ << "\n\n"; }
-
-  //! Returns the thrown error message type.
-  virtual const Type& getType(void) throw() { return type_; }
-
-  //! Returns the thrown error message string.
-  virtual const std::string& getMessage(void) throw() { return message_; }
-
-  //! Returns the thrown error message as a c-style string.
-  virtual const char* what( void ) const throw() { return message_.c_str(); }
-
- protected:
-  std::string message_;
-  Type type_;
-};
-
-#endif