summaryrefslogtreecommitdiff
path: root/rtemstoolkit/elftoolchain
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-03-18 16:44:19 +1100
committerChris Johns <chrisj@rtems.org>2015-03-18 17:02:40 +1100
commit36e663162fad54bc3a5631fc415aa39f7c8d1f17 (patch)
tree318bfe0c1a09c4c3d4be5e748e3381607416f23f /rtemstoolkit/elftoolchain
parentea749e542a1ed6f9f41415cc82870de5ce905f91 (diff)
rtemstoolkit: Remove warning on Windows.
Diffstat (limited to 'rtemstoolkit/elftoolchain')
-rw-r--r--rtemstoolkit/elftoolchain/libelf/mmap_win32.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/rtemstoolkit/elftoolchain/libelf/mmap_win32.c b/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
index f801fc6..689fe87 100644
--- a/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
+++ b/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
@@ -87,7 +87,7 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
*/
if (prot & PROT_EXEC)
return MAP_FAILED;
-
+
/*
* Map the protection.
*/
@@ -106,8 +106,8 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
flProtect = PAGE_READWRITE;
dwDesiredAccess = FILE_MAP_WRITE;
}
-
- fh = (HANDLE) _get_osfhandle (fd);
+
+ fh = (HANDLE) (intptr_t) _get_osfhandle (fd);
if (fh == (HANDLE) -1)
return MAP_FAILED;
@@ -133,9 +133,9 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
{
DWORD low;
DWORD high;
-
+
low = GetFileSize (fh, &high);
-
+
/*
* Low might just happen to have the value INVALID_FILE_SIZE; so we need to
* check the last error also.
@@ -147,7 +147,7 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
}
size = (((uint64_t) high) << 32) + low;
-
+
if (offset >= size)
{
free (map);
@@ -170,7 +170,7 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
size_lo = (DWORD)(size & 0xFFFFFFFF);
off_hi = (DWORD)(0);
off_lo = (DWORD)(offset & 0xFFFFFFFF);
-
+
/*
* For files, it would be sufficient to pass 0 as size. For anonymous maps,
* we have to pass the size explicitly.
@@ -186,7 +186,7 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
free (map);
return MAP_FAILED;
}
-
+
map->data = (char *) MapViewOfFileEx (map->map_handle,
dwDesiredAccess,
off_hi,
@@ -205,7 +205,7 @@ mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
*/
map->next = map_head;
map_head = map;
-
+
return map->data;
}