| diff -aruN sysfsutils-2.1.0/cmd/names.c sysfsutils-2.1.0.N/cmd/names.c |
| --- sysfsutils-2.1.0/cmd/names.c 2005-04-06 16:18:11.000000000 -0700 |
| +++ sysfsutils-2.1.0.N/cmd/names.c 2008-12-18 09:49:47.000000000 -0800 |
| @@ -115,17 +115,17 @@ |
| { |
| if (q[0] == 'C' && q[1] == ' ') |
| { |
| - if (strlen(q+2) < 3 || |
| + if (strlen((char *)q+2) < 3 || |
| q[4] != ' ' || |
| - sscanf(q+2, "%x", &id1) != 1) |
| + sscanf((char *)q+2, "%x", &id1) != 1) |
| goto parserr; |
| cat = NL_CLASS; |
| } |
| else |
| { |
| - if (strlen(q) < 5 || |
| + if (strlen((char *)q) < 5 || |
| q[4] != ' ' || |
| - sscanf(q, "%x", &id1) != 1) |
| + sscanf((char *)q, "%x", &id1) != 1) |
| goto parserr; |
| cat = NL_VENDOR; |
| } |
| @@ -138,7 +138,7 @@ |
| case NL_VENDOR: |
| case NL_DEVICE: |
| case NL_SUBSYSTEM: |
| - if (sscanf(q, "%x", &id2) != 1 || q[4] != ' ') |
| + if (sscanf((char *)q, "%x", &id2) != 1 || q[4] != ' ') |
| goto parserr; |
| q += 5; |
| cat = NL_DEVICE; |
| @@ -147,7 +147,7 @@ |
| case NL_CLASS: |
| case NL_SUBCLASS: |
| case NL_PROGIF: |
| - if (sscanf(q, "%x", &id2) != 1 || q[2] != ' ') |
| + if (sscanf((char *)q, "%x", &id2) != 1 || q[2] != ' ') |
| goto parserr; |
| q += 3; |
| cat = NL_SUBCLASS; |
| @@ -161,7 +161,7 @@ |
| { |
| case NL_DEVICE: |
| case NL_SUBSYSTEM: |
| - if (sscanf(q, "%x%x", &id3, &id4) != 2 || q[9] != ' ') |
| + if (sscanf((char *)q, "%x%x", &id3, &id4) != 2 || q[9] != ' ') |
| goto parserr; |
| q += 10; |
| cat = NL_SUBSYSTEM; |
| @@ -169,7 +169,7 @@ |
| case NL_CLASS: |
| case NL_SUBCLASS: |
| case NL_PROGIF: |
| - if (sscanf(q, "%x", &id3) != 1 || q[2] != ' ') |
| + if (sscanf((char *)q, "%x", &id3) != 1 || q[2] != ' ') |
| goto parserr; |
| q += 3; |
| cat = NL_PROGIF; |
| @@ -199,17 +199,17 @@ |
| int fd; |
| struct stat st; |
| |
| - fd = open(a->pci_id_file_name, O_RDONLY); |
| + fd = open((char *)a->pci_id_file_name, O_RDONLY); |
| if (fd < 0) |
| { |
| a->numeric_ids = 1; |
| return; |
| } |
| if (fstat(fd, &st) < 0) |
| - err_name_list(a, "stat"); |
| + err_name_list(a, (unsigned char *)"stat"); |
| a->nl_list = malloc(st.st_size + 1); |
| if (read(fd, a->nl_list, st.st_size) != st.st_size) |
| - err_name_list(a, "read"); |
| + err_name_list(a, (unsigned char *)"read"); |
| a->nl_list[st.st_size] = 0; |
| a->nl_hash = malloc(sizeof(struct nl_entry *) * HASH_SIZE); |
| bzero(a->nl_hash, sizeof(struct nl_entry *) * HASH_SIZE); |
| @@ -264,13 +264,13 @@ |
| if ((n = nl_lookup(a, num, NL_VENDOR, arg1, 0, 0, 0))) |
| return n->name; |
| else |
| - res = snprintf(buf, size, "%04x", arg1); |
| + res = snprintf((char *)buf, size, "%04x", arg1); |
| break; |
| case PCI_LOOKUP_DEVICE: |
| if ((n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) |
| return n->name; |
| else |
| - res = snprintf(buf, size, "%04x", arg2); |
| + res = snprintf((char *)buf, size, "%04x", arg2); |
| break; |
| case PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE: |
| if (!num) |
| @@ -279,20 +279,20 @@ |
| e = nl_lookup(a, 0, NL_VENDOR, arg1, 0, 0, 0); |
| e2 = nl_lookup(a, 0, NL_DEVICE, arg1, arg2, 0, 0); |
| if (!e) |
| - res = snprintf(buf, size, "Unknown device %04x:%04x", arg1, arg2); |
| + res = snprintf((char *)buf, size, "Unknown device %04x:%04x", arg1, arg2); |
| else if (!e2) |
| - res = snprintf(buf, size, "%s: Unknown device %04x", e->name, arg2); |
| + res = snprintf((char *)buf, size, "%s: Unknown device %04x", e->name, arg2); |
| else |
| - res = snprintf(buf, size, "%s %s", e->name, e2->name); |
| + res = snprintf((char *)buf, size, "%s %s", e->name, e2->name); |
| } |
| else |
| - res = snprintf(buf, size, "%04x:%04x", arg1, arg2); |
| + res = snprintf((char *)buf, size, "%04x:%04x", arg1, arg2); |
| break; |
| case PCI_LOOKUP_VENDOR | PCI_LOOKUP_SUBSYSTEM: |
| if ((n = nl_lookup(a, num, NL_VENDOR, arg3, 0, 0, 0))) |
| return n->name; |
| else |
| - res = snprintf(buf, size, "%04x", arg2); |
| + res = snprintf((char *)buf, size, "%04x", arg2); |
| break; |
| case PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: |
| if ((n = nl_lookup(a, num, NL_SUBSYSTEM, arg1, arg2, arg3, arg4))) |
| @@ -300,7 +300,7 @@ |
| else if (arg1 == arg3 && arg2 == arg4 && (n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) |
| return n->name; |
| else |
| - res = snprintf(buf, size, "%04x", arg4); |
| + res = snprintf((char *)buf, size, "%04x", arg4); |
| break; |
| case PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: |
| if (!num) |
| @@ -312,22 +312,22 @@ |
| /* Cheat for vendors blindly setting subsystem ID same as device ID */ |
| e2 = nl_lookup(a, 0, NL_DEVICE, arg1, arg2, 0, 0); |
| if (!e) |
| - res = snprintf(buf, size, "Unknown device %04x:%04x", arg3, arg4); |
| + res = snprintf((char *)buf, size, "Unknown device %04x:%04x", arg3, arg4); |
| else if (!e2) |
| - res = snprintf(buf, size, "%s: Unknown device %04x", e->name, arg4); |
| + res = snprintf((char *)buf, size, "%s: Unknown device %04x", e->name, arg4); |
| else |
| - res = snprintf(buf, size, "%s %s", e->name, e2->name); |
| + res = snprintf((char *)buf, size, "%s %s", e->name, e2->name); |
| } |
| else |
| - res = snprintf(buf, size, "%04x:%04x", arg3, arg4); |
| + res = snprintf((char *)buf, size, "%04x:%04x", arg3, arg4); |
| break; |
| case PCI_LOOKUP_CLASS: |
| if ((n = nl_lookup(a, num, NL_SUBCLASS, arg1 >> 8, arg1 & 0xff, 0, 0))) |
| return n->name; |
| else if ((n = nl_lookup(a, num, NL_CLASS, arg1, 0, 0, 0))) |
| - res = snprintf(buf, size, "%s [%04x]", n->name, arg1); |
| + res = snprintf((char *)buf, size, "%s [%04x]", n->name, arg1); |
| else |
| - res = snprintf(buf, size, "Class %04x", arg1); |
| + res = snprintf((char *)buf, size, "Class %04x", arg1); |
| break; |
| case PCI_LOOKUP_PROGIF: |
| if ((n = nl_lookup(a, num, NL_PROGIF, arg1 >> 8, arg1 & 0xff, arg2, 0))) |
| @@ -337,7 +337,7 @@ |
| /* IDE controllers have complex prog-if semantics */ |
| if (arg2 & 0x70) |
| return NULL; |
| - res = snprintf(buf, size, "%s%s%s%s%s", |
| + res = snprintf((char *)buf, size, "%s%s%s%s%s", |
| (arg2 & 0x80) ? "Master " : "", |
| (arg2 & 0x08) ? "SecP " : "", |
| (arg2 & 0x04) ? "SecO " : "", |
| @@ -349,10 +349,10 @@ |
| } |
| return NULL; |
| default: |
| - return "<pci_lookup_name: invalid request>"; |
| + return (unsigned char *)"<pci_lookup_name: invalid request>"; |
| } |
| if (res == size) |
| - return "<too-large>"; |
| + return (unsigned char *)"<too-large>"; |
| else |
| return buf; |
| } |
| diff -aruN sysfsutils-2.1.0/cmd/systool.c sysfsutils-2.1.0.N/cmd/systool.c |
| --- sysfsutils-2.1.0/cmd/systool.c 2005-11-25 06:06:05.000000000 -0800 |
| +++ sysfsutils-2.1.0.N/cmd/systool.c 2008-12-18 09:45:01.000000000 -0800 |
| @@ -268,11 +268,11 @@ |
| if (attr) { |
| if (!sysfs_read_attribute(attr)) { |
| vendor_id = get_pciconfig_word |
| - (PCI_VENDOR_ID, attr->value); |
| + (PCI_VENDOR_ID, (unsigned char *)attr->value); |
| device_id = get_pciconfig_word |
| - (PCI_DEVICE_ID, attr->value); |
| + (PCI_DEVICE_ID, (unsigned char *)attr->value); |
| fprintf(stdout, "%s\n", |
| - pci_lookup_name(pacc, buf, 128, |
| + pci_lookup_name(pacc, (unsigned char *)buf, 128, |
| PCI_LOOKUP_VENDOR | |
| PCI_LOOKUP_DEVICE, |
| vendor_id, device_id, 0, 0)); |
| @@ -748,7 +748,7 @@ |
| if ((!(strcmp(show_bus, "pci")))) { |
| pacc = (struct pci_access *) |
| calloc(1, sizeof(struct pci_access)); |
| - pacc->pci_id_file_name = pci_id_file; |
| + pacc->pci_id_file_name = (unsigned char *)pci_id_file; |
| pacc->numeric_ids = 0; |
| } |
| retval = show_sysfs_bus(show_bus); |