Commit c10cc4f3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

TableStorage: fix warning

parent 30eb507b
...@@ -113,7 +113,7 @@ TableStorage::~TableStorage() ...@@ -113,7 +113,7 @@ TableStorage::~TableStorage()
int TableStorage::AddRow(char* key, char* value) int TableStorage::AddRow(char* key, char* value)
{ {
TableStorageElem *tbl = (TableStorageElem*)malloc(sizeof(TableStorageElem)+inf_size); TableStorageElem *tbl = (TableStorageElem*)malloc(sizeof(TableStorageElem)+inf_size);
int i,k,j,st; int i,k,j;
if(file!=NULL) if(file!=NULL)
{ {
if(head==-1) if(head==-1)
...@@ -151,14 +151,19 @@ int TableStorage::AddRow(char* key, char* value) ...@@ -151,14 +151,19 @@ int TableStorage::AddRow(char* key, char* value)
fseek(file,seekpos+j*(sizeof(TableStorageElem)+inf_size),0); fseek(file,seekpos+j*(sizeof(TableStorageElem)+inf_size),0);
if(j==head) if(j==head)
{ {
if((tbl->status==2)||(tbl->status==3)) st=2; if((tbl->status==2)||(tbl->status==3))
else st=4; tbl->status=2;
else
tbl->status=4;
if(j==0) if(j==0)
if(st==2) st=4; {
else st=2; if(tbl->status==2)
tbl->status=4;
else
tbl->status=2;
}
tbl->status=st;
strcpy(tbl->key,key); strcpy(tbl->key,key);
for(k=0;k<inf_size;k++) for(k=0;k<inf_size;k++)
*((char*)(tbl)+sizeof(TableStorageElem)+k)=*(value+k); *((char*)(tbl)+sizeof(TableStorageElem)+k)=*(value+k);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment