Chameleon

Chameleon Commit Details

Date:2010-03-09 21:09:08 (14 years 19 days ago)
Author:JrCs
Commit:126
Parents: 125
Message:Removed ascii_hex_to_int() using strtoul instead
Changes:
M/branches/JrCs/i386/libsaio/convert.c
M/branches/JrCs/i386/libsaio/convert.h
M/branches/JrCs/i386/libsaio/device_inject.c

File differences

branches/JrCs/i386/libsaio/device_inject.c
130130
131131
132132
133
133
134134
135135
136136
......
145145
146146
147147
148
148
149149
150150
151151
numpaths = 0;
break;
}
device->pci_dev_path[numpaths].device =ascii_hex_to_int(buff);
device->pci_dev_path[numpaths].device = strtoul(buff, NULL, 16);
x += 3; // 0x
curr = x;
numpaths = 0;
break;
}
device->pci_dev_path[numpaths].function = ascii_hex_to_int(buff); // TODO: find dev from char *path
device->pci_dev_path[numpaths].function = strtoul(buff, NULL, 16);
numpaths++;
}
branches/JrCs/i386/libsaio/convert.c
4848
4949
5050
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
7151
7252
7353
return convertHexStr2Binary(uuid_hex, &len);
}
/** XXX AsereBLN replace by strtoul */
uint32_t ascii_hex_to_int(char *buff)
{
uint32_tvalue = 0, i, digit;
for(i = 0; i < strlen(buff); i++)
{
if (buff[i] >= 48 && buff[i] <= 57) // '0' through '9'
digit = buff[i] - 48;
else if (buff[i] >= 65 && buff[i] <= 70) // 'A' through 'F'
digit = buff[i] - 55;
else if (buff[i] >= 97 && buff[i] <= 102) // 'a' through 'f'
digit = buff[i] - 87;
else
return value;
value = digit + 16 * value;
}
returnvalue;
}
void *convertHexStr2Binary(const char *hexStr, int *outLength)
{
int len;
branches/JrCs/i386/libsaio/convert.h
1616
1717
1818
19
2019
2120
2221
void getStringFromUUID(const uuid_t uuid, uuid_string_t out);
uuid_t* newUUIDFromString(const char *source);
void * convertHexStr2Binary(const char *hexStr, int *outLength);
uint32_t ascii_hex_to_int(char *buff);
static inline uint16_t dp_swap16(uint16_t toswap)
{

Archive Download the corresponding diff file

Revision: 126