<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -177,7 +177,7 @@ int anetTcpNonBlockConnect(char *err, char *addr, int port)
 
 /* Like read(2) but make sure 'count' is read before to return
  * (unless error or EOF condition is encountered) */
-int anetRead(int fd, void *buf, int count)
+int anetRead(int fd, char *buf, int count)
 {
     int nread, totlen = 0;
     while(totlen != count) {
@@ -192,7 +192,7 @@ int anetRead(int fd, void *buf, int count)
 
 /* Like write(2) but make sure 'count' is read before to return
  * (unless error is encountered) */
-int anetWrite(int fd, void *buf, int count)
+int anetWrite(int fd, char *buf, int count)
 {
     int nwritten, totlen = 0;
     while(totlen != count) {</diff>
      <filename>anet.c</filename>
    </modified>
    <modified>
      <diff>@@ -37,11 +37,11 @@
 
 int anetTcpConnect(char *err, char *addr, int port);
 int anetTcpNonBlockConnect(char *err, char *addr, int port);
-int anetRead(int fd, void *buf, int count);
+int anetRead(int fd, char *buf, int count);
 int anetResolve(char *err, char *host, char *ipbuf);
 int anetTcpServer(char *err, int port, char *bindaddr);
 int anetAccept(char *err, int serversock, char *ip, int *port);
-int anetWrite(int fd, void *buf, int count);
+int anetWrite(int fd, char *buf, int count);
 int anetNonBlock(char *err, int fd);
 int anetTcpNoDelay(char *err, int fd);
 int anetTcpKeepAlive(char *err, int fd);</diff>
      <filename>anet.h</filename>
    </modified>
    <modified>
      <diff>@@ -95,7 +95,9 @@
  * 00|000000 =&gt; if the two MSB are 00 the len is the 6 bits of this byte
  * 01|000000 00000000 =&gt;  01, the len is 14 byes, 6 bits + 8 bits of next byte
  * 10|000000 [32 bit integer] =&gt; if it's 01, a full 32 bit len will follow
- * 11|000000 reserved for future uses
+ * 11|000000 this means: specially encoded object will follow. The six bits
+ *           number specify the kind of object that follows.
+ *           See the REDIS_RDB_ENC_* defines.
  *
  * Lenghts up to 63 are stored using a single byte, most DB keys, and may
  * values, will fit inside. */
@@ -105,6 +107,14 @@
 #define REDIS_RDB_64BITLEN 3
 #define REDIS_RDB_LENERR UINT_MAX
 
+/* When a length of a string object stored on disk has the first two bits
+ * set, the remaining two bits specify a special encoding for the object
+ * accordingly to the following defines: */
+#define REDIS_RDB_ENC_INT8 0        /* 8 bit signed integer */
+#define REDIS_RDB_ENC_INT16 1       /* 16 bit signed integer */
+#define REDIS_RDB_ENC_INT32 2       /* 32 bit signed integer */
+#define REDIS_RDB_ENC_FLZ 3         /* string compressed with FASTLZ */
+
 /* Client flags */
 #define REDIS_CLOSE 1       /* This client connection should be closed ASAP */
 #define REDIS_SLAVE 2       /* This client is a slave server */
@@ -620,7 +630,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
         used = dictGetHashTableUsed(server.dict[j]);
         if (!(loops % 5) &amp;&amp; used &gt; 0) {
             redisLog(REDIS_DEBUG,&quot;DB %d: %d keys in %d slots HT.&quot;,j,used,size);
-            // dictPrintStats(server.dict);
+            /* dictPrintStats(server.dict); */
         }
         if (size &amp;&amp; used &amp;&amp; size &gt; REDIS_HT_MINSLOTS &amp;&amp;
             (used*100/size &lt; REDIS_HT_MINFILL)) {
@@ -1027,7 +1037,7 @@ static void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask)
         if (c-&gt;flags &amp; REDIS_MASTER) {
             nwritten = objlen - c-&gt;sentlen;
         } else {
-            nwritten = write(fd, o-&gt;ptr+c-&gt;sentlen, objlen - c-&gt;sentlen);
+            nwritten = write(fd, ((char*)o-&gt;ptr)+c-&gt;sentlen, objlen - c-&gt;sentlen);
             if (nwritten &lt;= 0) break;
         }
         c-&gt;sentlen += nwritten;
@@ -1822,11 +1832,11 @@ static void setGenericCommand(redisClient *c, int nx) {
 }
 
 static void setCommand(redisClient *c) {
-    return setGenericCommand(c,0);
+    setGenericCommand(c,0);
 }
 
 static void setnxCommand(redisClient *c) {
-    return setGenericCommand(c,1);
+    setGenericCommand(c,1);
 }
 
 static void getCommand(redisClient *c) {
@@ -1907,21 +1917,21 @@ static void incrDecrCommand(redisClient *c, int incr) {
 }
 
 static void incrCommand(redisClient *c) {
-    return incrDecrCommand(c,1);
+    incrDecrCommand(c,1);
 }
 
 static void decrCommand(redisClient *c) {
-    return incrDecrCommand(c,-1);
+    incrDecrCommand(c,-1);
 }
 
 static void incrbyCommand(redisClient *c) {
     int incr = atoi(c-&gt;argv[2]-&gt;ptr);
-    return incrDecrCommand(c,incr);
+    incrDecrCommand(c,incr);
 }
 
 static void decrbyCommand(redisClient *c) {
     int incr = atoi(c-&gt;argv[2]-&gt;ptr);
-    return incrDecrCommand(c,-incr);
+    incrDecrCommand(c,-incr);
 }
 
 /* ========================= Type agnostic commands ========================= */
@@ -2439,8 +2449,9 @@ static void lremCommand(redisClient *c) {
             }
             ln = fromtail ? list-&gt;tail : list-&gt;head;
             while (ln) {
-                next = fromtail ? ln-&gt;prev : ln-&gt;next;
                 robj *ele = listNodeValue(ln);
+
+                next = fromtail ? ln-&gt;prev : ln-&gt;next;
                 if (sdscmp(ele-&gt;ptr,c-&gt;argv[3]-&gt;ptr) == 0) {
                     listDelNode(list,ln);
                     server.dirty++;
@@ -2696,7 +2707,7 @@ robj *lookupKeyByPattern(dict *dict, robj *pattern, robj *subst) {
     keyobj.ptr = ((char*)&amp;keyname)+(sizeof(long)*2);
 
     de = dictFind(dict,&amp;keyobj);
-    // printf(&quot;lookup '%s' =&gt; %p\n&quot;, keyname.buf,de);
+    /* printf(&quot;lookup '%s' =&gt; %p\n&quot;, keyname.buf,de); */
     if (!de) return NULL;
     return dictGetEntryVal(de);
 }
@@ -2986,7 +2997,7 @@ static int flushClientOutput(redisClient *c) {
     return REDIS_OK;
 }
 
-static int syncWrite(int fd, void *ptr, ssize_t size, int timeout) {
+static int syncWrite(int fd, char *ptr, ssize_t size, int timeout) {
     ssize_t nwritten, ret = size;
     time_t start = time(NULL);
 
@@ -3006,7 +3017,7 @@ static int syncWrite(int fd, void *ptr, ssize_t size, int timeout) {
     return ret;
 }
 
-static int syncRead(int fd, void *ptr, ssize_t size, int timeout) {
+static int syncRead(int fd, char *ptr, ssize_t size, int timeout) {
     ssize_t nread, totread = 0;
     time_t start = time(NULL);
 </diff>
      <filename>redis.c</filename>
    </modified>
    <modified>
      <diff>@@ -278,8 +278,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
     for (j = 0; j &lt; (len-(seplen-1)); j++) {
         /* make sure there is room for the next element and the final one */
         if (slots &lt; elements+2) {
+            sds *newtokens;
+
             slots *= 2;
-            sds *newtokens = zrealloc(tokens,sizeof(sds)*slots);
+            newtokens = zrealloc(tokens,sizeof(sds)*slots);
             if (newtokens == NULL) {
 #ifdef SDS_ABORT_ON_OOM
                 sdsOomAbort();</diff>
      <filename>sds.c</filename>
    </modified>
    <modified>
      <diff>@@ -38,7 +38,7 @@ void *zmalloc(size_t size) {
 
     *((size_t*)ptr) = size;
     used_memory += size+sizeof(size_t);
-    return ptr+sizeof(size_t);
+    return (char*)ptr+sizeof(size_t);
 }
 
 void *zrealloc(void *ptr, size_t size) {
@@ -47,7 +47,7 @@ void *zrealloc(void *ptr, size_t size) {
     void *newptr;
 
     if (ptr == NULL) return zmalloc(size);
-    realptr = ptr-sizeof(size_t);
+    realptr = (char*)ptr-sizeof(size_t);
     oldsize = *((size_t*)realptr);
     newptr = realloc(realptr,size+sizeof(size_t));
     if (!newptr) return NULL;
@@ -55,7 +55,7 @@ void *zrealloc(void *ptr, size_t size) {
     *((size_t*)newptr) = size;
     used_memory -= oldsize;
     used_memory += size;
-    return newptr+sizeof(size_t);
+    return (char*)newptr+sizeof(size_t);
 }
 
 void zfree(void *ptr) {
@@ -63,7 +63,7 @@ void zfree(void *ptr) {
     size_t oldsize;
 
     if (ptr == NULL) return;
-    realptr = ptr-sizeof(size_t);
+    realptr = (char*)ptr-sizeof(size_t);
     oldsize = *((size_t*)realptr);
     used_memory -= oldsize+sizeof(size_t);
     free(realptr);</diff>
      <filename>zmalloc.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>29fac6170a308c1ed765d4f7edee94985959225c</id>
    </parent>
  </parents>
  <author>
    <name>antirez</name>
    <email>antirez@gmail.com</email>
  </author>
  <url>http://github.com/antirez/redis/commit/a4d1ba9a73e459d68423c4da623f8cf1663c70ba</url>
  <id>a4d1ba9a73e459d68423c4da623f8cf1663c70ba</id>
  <committed-date>2009-03-27T12:48:32-07:00</committed-date>
  <authored-date>2009-03-27T12:48:32-07:00</authored-date>
  <message>ANSI-C compatibility changes</message>
  <tree>f4d174c3fb193fa445223f2295beca5d96e377b5</tree>
  <committer>
    <name>antirez</name>
    <email>antirez@gmail.com</email>
  </committer>
</commit>
