mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 03:47:05 -05:00
Faster load of the content file.
This commit is contained in:
parent
132ccef591
commit
7f400289b8
4 changed files with 35 additions and 27 deletions
2
HISTORY
2
HISTORY
|
|
@ -3,7 +3,7 @@ SnapRAID HISTORY
|
||||||
|
|
||||||
1.5 2011/6
|
1.5 2011/6
|
||||||
==========
|
==========
|
||||||
* In the configuration file extra space are ignored.
|
* Ignores extra spaces in the configuration file.
|
||||||
* Changed the output of check/fix to allow a more easily postprocessing
|
* Changed the output of check/fix to allow a more easily postprocessing
|
||||||
with other tools like awk and sort.
|
with other tools like awk and sort.
|
||||||
* Added the hidden option -G/--gui to enable the output of progress
|
* Added the hidden option -G/--gui to enable the output of progress
|
||||||
|
|
|
||||||
2
TODO
2
TODO
|
|
@ -3,7 +3,7 @@ SnapRAID TODO
|
||||||
|
|
||||||
This is a list of possible TODO items for SnapRAID. The order is not relevant.
|
This is a list of possible TODO items for SnapRAID. The order is not relevant.
|
||||||
|
|
||||||
* If a file cannot be synched, for example because it was changing, of it
|
* If a file cannot be synched, for example because it was changing, or it
|
||||||
the file name cannot be supported, it's better to do not stop the sync process.
|
the file name cannot be supported, it's better to do not stop the sync process.
|
||||||
The sync process should stop only if the error could be caused by a disk
|
The sync process should stop only if the error could be caused by a disk
|
||||||
corruption.
|
corruption.
|
||||||
|
|
|
||||||
2
state.c
2
state.c
|
|
@ -311,7 +311,7 @@ void state_read(struct snapraid_state* state)
|
||||||
|
|
||||||
tag = s;
|
tag = s;
|
||||||
s = strtoken(s);
|
s = strtoken(s);
|
||||||
|
|
||||||
if (strcmp(tag, "blk") == 0 || strcmp(tag, "inv") == 0) {
|
if (strcmp(tag, "blk") == 0 || strcmp(tag, "inv") == 0) {
|
||||||
char* pos;
|
char* pos;
|
||||||
char* hash;
|
char* hash;
|
||||||
|
|
|
||||||
56
util.c
56
util.c
|
|
@ -125,40 +125,48 @@ void strenchex(char* str, const void* void_data, unsigned data_len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned strdecset[256] =
|
||||||
|
{
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
||||||
|
};
|
||||||
|
|
||||||
char* strdechex(void* void_data, unsigned data_len, char* str)
|
char* strdechex(void* void_data, unsigned data_len, char* str)
|
||||||
{
|
{
|
||||||
unsigned char* data = void_data;
|
unsigned char* data = void_data;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for(i=0;i<data_len;++i) {
|
for(i=0;i<data_len;++i) {
|
||||||
char c0;
|
unsigned b0;
|
||||||
char c1;
|
unsigned b1;
|
||||||
unsigned char b0;
|
unsigned b;
|
||||||
unsigned char b1;
|
|
||||||
|
|
||||||
c0 = *str;
|
b0 = strdecset[(unsigned char)str[0]];
|
||||||
if (c0 >= '0' && c0 <= '9')
|
b1 = strdecset[(unsigned char)str[1]];
|
||||||
b0 = c0 - '0';
|
|
||||||
else if (c0 >= 'a' && c0 <= 'f')
|
b = (b0 << 4) | b1;
|
||||||
b0 = c0 - 'a' + 10;
|
|
||||||
else if (c0 >= 'A' && c0 <= 'F')
|
if (b > 0xFF)
|
||||||
b0 = c0 - 'A' + 10;
|
|
||||||
else
|
|
||||||
return str;
|
return str;
|
||||||
++str;
|
|
||||||
|
|
||||||
c1 = *str;
|
data[0] = b;
|
||||||
if (c1 >= '0' && c1 <= '9')
|
|
||||||
b1 = c1 - '0';
|
|
||||||
else if (c1 >= 'a' && c1 <= 'f')
|
|
||||||
b1 = c1 - 'a' + 10;
|
|
||||||
else if (c1 >= 'A' && c1 <= 'F')
|
|
||||||
b1 = c1 - 'A' + 10;
|
|
||||||
else
|
|
||||||
return str;
|
|
||||||
++str;
|
|
||||||
|
|
||||||
data[i] = (b0 << 4) | b1;
|
data += 1;
|
||||||
|
str += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue