Add a bunch of APNs

Fork of C027_Support by Xinlei Cao

Revision:
74:208e3e32d263
Parent:
41:b94a1f410e71
Child:
75:ce6e12067d0c
--- a/Pipe.h	Thu May 15 08:25:45 2014 +0000
+++ b/Pipe.h	Thu May 15 22:20:42 2014 +0000
@@ -15,7 +15,7 @@
     */
     Pipe(int n, T* b = NULL)
     {
-        _a = b ? NULL : new T[n];
+        _a = b ? NULL : n ? new T[n] : NULL;
         _r = 0;
         _w = 0;
         _b = b ? b : _a;
@@ -98,7 +98,7 @@
             for (;;) // wait for space
             {
                 f = free();
-                if (f)  break;        // data avail
+                if (f > 0) break;     // data avail
                 if (!t) return n - c; // no more space and not blocking
             }
             // check free space