Chameleon

Chameleon Commit Details

Date:2014-10-20 21:35:48 (4 years 7 months ago)
Author:ErmaC
Commit:2415
Parents: 2414
Message:devprop_generate_string optimized by cparm
Changes:
M/trunk/i386/libsaio/device_inject.c
M/trunk/CHANGES

File differences

trunk/i386/libsaio/device_inject.c
251251
252252
253253
254
254255
255256
256
257
258
257259
258260
259261
......
261263
262264
263265
264
266
265267
266268
269
267270
268271
269272
270273
271
274
275
276
277
278
279
280
281
282
272283
273284
274285
275
286
287
276288
277289
278290
279291
280292
281293
294
282295
283296
284
297
298
299
300
285301
286302
287303
288304
289305
306
290307
291
292
308
309
310
311
312
313
293314
294315
295316
296317
318
297319
298320
299321
300
322
323
324
325
301326
327
302328
303329
304330
return 1;
}
// devprop_generate_string optimized by cparm
char *devprop_generate_string(DevPropString *string)
{
char *buffer = (char*)malloc(string->length * 2);
int len = string->length * 2;
char *buffer = (char*)malloc(len);
char *ptr = buffer;
if(!buffer)
return NULL;
}
sprintf(buffer, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2,
snprintf(buffer, len, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2,
dp_swap16(string->numentries), string->WHAT3);
buffer += 24;
len -= 24;
int i = 0, x = 0;
while(i < string->numentries)
{
sprintf(buffer, "%08x%04x%04x", dp_swap32(string->entries[i]->length),
if (!(i < DEV_PROP_DEVICE_MAX_ENTRIES)) {
break;
}
if(!len) {
break;
}
snprintf(buffer, len, "%08x%04x%04x", dp_swap32(string->entries[i]->length),
dp_swap16(string->entries[i]->numentries), string->entries[i]->WHAT2);
buffer += 16;
sprintf(buffer, "%02x%02x%04x%08x%08x", string->entries[i]->acpi_dev_path.type,
len -= 16;
snprintf(buffer, len, "%02x%02x%04x%08x%08x", string->entries[i]->acpi_dev_path.type,
string->entries[i]->acpi_dev_path.subtype,
dp_swap16(string->entries[i]->acpi_dev_path.length),
string->entries[i]->acpi_dev_path._HID,
dp_swap32(string->entries[i]->acpi_dev_path._UID));
buffer += 24;
len -= 24;
for(x = 0;x < string->entries[i]->num_pci_devpaths; x++)
{
sprintf(buffer, "%02x%02x%04x%02x%02x", string->entries[i]->pci_dev_path[x].type,
if(!len) {
break;
}
snprintf(buffer, len, "%02x%02x%04x%02x%02x", string->entries[i]->pci_dev_path[x].type,
string->entries[i]->pci_dev_path[x].subtype,
dp_swap16(string->entries[i]->pci_dev_path[x].length),
string->entries[i]->pci_dev_path[x].function,
string->entries[i]->pci_dev_path[x].device);
buffer += 12;
len -= 12;
}
sprintf(buffer, "%02x%02x%04x", string->entries[i]->path_end.type,
if(!len) {
break;
}
snprintf(buffer, len, "%02x%02x%04x", string->entries[i]->path_end.type,
string->entries[i]->path_end.subtype,
dp_swap16(string->entries[i]->path_end.length));
buffer += 8;
len -= 8;
uint8_t *dataptr = string->entries[i]->data;
for(x = 0; (uint32_t)x < (string->entries[i]->length) - (24 + (6 * string->entries[i]->num_pci_devpaths)) ; x++)
{
sprintf(buffer, "%02x", *dataptr++);
if(!len) {
break;
}
snprintf(buffer, len, "%02x", *dataptr++);
buffer += 2;
len -= 2;
}
i++;
}
trunk/CHANGES
1
12
23
34
- devprop_generate_string optimized by cparm
- Update CPUID and change conditional logic.
- Typo & ID names
- Make compile on gcc w/ errors enabled.

Archive Download the corresponding diff file

Revision: 2415