Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
change version, allow BOM in config
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryRawas committed Nov 1, 2012
1 parent b56be08 commit 6887a08
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ msvs/RedisCli/Debug/
msvs/RedisCli/Release/
msvs/hiredis/Debug/
msvs/hiredis/Release/
msvs/x64/
msvs/RedisBenchmark/x64/
msvs/RedisCheckAof/x64/
msvs/RedisCheckDump/x64/
msvs/RedisCli/x64/
msvs/hiredis/x64/
msvs/ipch
msvs/RedisServer.opensdf

7 changes: 7 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ void loadServerConfig(char *filename) {
}
}

if (fread(buf, 1, 3, fp) == 3) {
/* if BOM for UTF-8 skip over it, else seek to 0 */
if (buf[0] != (char)0xEF || buf[1] != (char)0xBB || buf[2] != (char)0xBF) {
fseek(fp, 0, SEEK_SET);
}
}

while(fgets(buf,REDIS_CONFIGLINE_MAX+1,fp) != NULL) {
sds *argv;
int argc, j;
Expand Down
8 changes: 4 additions & 4 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ int rdbSaveObject(FILE *fp, robj *o) {

ar = (cowListArray *)o->ptr;
cowUnlock();
if ((n = rdbSaveLen(fp,ar->numele)) == -1) return -1;
if ((n = rdbSaveLen(fp,(uint32_t)ar->numele)) == -1) return -1;
nwritten += n;

roListRewind(NULL, ar, &li);
Expand Down Expand Up @@ -337,7 +337,7 @@ int rdbSaveObject(FILE *fp, robj *o) {

ar = (cowDictArray *)o->ptr;
di = roDictGetIterator(NULL, ar);
if ((n = rdbSaveLen(fp,ar->numele)) == -1) return -1;
if ((n = rdbSaveLen(fp,(uint32_t)ar->numele)) == -1) return -1;
nwritten += n;

while((de = roDictNext(di)) != NULL) {
Expand Down Expand Up @@ -389,7 +389,7 @@ int rdbSaveObject(FILE *fp, robj *o) {

ar = (cowDictZArray *)o->ptr;
di = roZDictGetIterator(NULL, ar);
if ((n = rdbSaveLen(fp,ar->numele)) == -1) return -1;
if ((n = rdbSaveLen(fp,(uint32_t)ar->numele)) == -1) return -1;
nwritten += n;

while((de = roZDictNext(di)) != NULL) {
Expand Down Expand Up @@ -445,7 +445,7 @@ int rdbSaveObject(FILE *fp, robj *o) {

ar = (cowDictArray *)o->ptr;
di = roDictGetIterator(NULL, ar);
if ((n = rdbSaveLen(fp,ar->numele)) == -1) return -1;
if ((n = rdbSaveLen(fp,(uint32_t)ar->numele)) == -1) return -1;
nwritten += n;

while((de = roDictNext(di)) != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define REDIS_VERSION "2.4.11"
#define REDIS_VERSION "2.4.11-pre1"

0 comments on commit 6887a08

Please sign in to comment.