#define NULL ((void *) 0)
#endif
-#define round_long(x) (((x) + 3) & -4)
-#define next_prop(x) ((DeviceTreeNodeProperty *) (((int)x) + sizeof(DeviceTreeNodeProperty) + round_long(x->length)))
+#define round_long(x) (((x) + 3UL) & ~(3UL))
+#define next_prop(x) ((DeviceTreeNodeProperty *) (((uintptr_t)x) + sizeof(DeviceTreeNodeProperty) + round_long(x->length)))
/* Entry*/
typedef DeviceTreeNode *RealDTEntry;
int find_entry(const char *propName, const char *propValue, DTEntry *entryH)
{
- DeviceTreeNode *nodeP = (DeviceTreeNode *) startingP;
+ DeviceTreeNode *nodeP = (DeviceTreeNode *) (void *) startingP;
unsigned int k;
if (nodeP->nProperties == 0) return(kError); // End of the list of nodes
// Search current entry
for (k = 0; k < nodeP->nProperties; ++k) {
- DeviceTreeNodeProperty *propP = (DeviceTreeNodeProperty *) startingP;
+ DeviceTreeNodeProperty *propP = (DeviceTreeNodeProperty *) (void *) startingP;
startingP += sizeof (*propP) + ((propP->length + 3) & -4);
prop = (DeviceTreeNodeProperty *) (entry + 1);
for (k = 0; k < entry->nProperties; k++) {
if (strcmp(prop->name, propertyName) == 0) {
- *propertyValue = (void *) (((int)prop)
+ *propertyValue = (void *) (((uintptr_t)prop)
+ sizeof(DeviceTreeNodeProperty));
*propertySize = prop->length;
return kSuccess;