While the functions didn't use the delta for i==0 accessing arrays at [0 - 1] can't be good.

CID 3197. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39974 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Fredrik Holmqvist
2010-12-28 11:23:40 +00:00
parent 2f32c12f37
commit 3c0241d8b5
+5 -4
View File
@@ -301,8 +301,8 @@ map_image(int fd, char const* path, image_t* image, bool fixed)
uint32 regionAddressSpecifier;
get_image_region_load_address(image, i,
loadAddress - image->regions[i - 1].vmstart, fixed,
loadAddress, regionAddressSpecifier);
i > 0 ? loadAddress - image->regions[i - 1].vmstart : loadAddress,
fixed, loadAddress, regionAddressSpecifier);
if (i == 0) {
reservedAddress = loadAddress;
addressSpecifier = regionAddressSpecifier;
@@ -333,8 +333,9 @@ map_image(int fd, char const* path, image_t* image, bool fixed)
snprintf(regionName, sizeof(regionName), "%s_seg%lu%s",
baseName, i, (image->regions[i].flags & RFLAG_RW) ? "rw" : "ro");
get_image_region_load_address(image, i, image->regions[i - 1].delta,
fixed, loadAddress, addressSpecifier);
get_image_region_load_address(image, i,
i > 0 ? image->regions[i - 1].delta : 0, fixed, loadAddress,
addressSpecifier);
// If the image position is arbitrary, we must let it point to the start
// of the reserved address range.