diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-07-18 09:15:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-07-18 09:15:40 +0000 |
commit | 56e9268870a84f33d924dd680c25ab12044e5dbc (patch) | |
tree | 9f6e19e0d1550455e61a4fb892d8b847e54d8ae2 /src/util/disk.c | |
parent | a2da7361158f976bbc67e50ff3ae32e03ad113cc (diff) | |
download | gnunet-56e9268870a84f33d924dd680c25ab12044e5dbc.tar.gz gnunet-56e9268870a84f33d924dd680c25ab12044e5dbc.zip |
-minor code cleanup
Diffstat (limited to 'src/util/disk.c')
-rw-r--r-- | src/util/disk.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index 941546a5d..24a33d497 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -801,7 +801,7 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result, | |||
801 | #ifdef MINGW | 801 | #ifdef MINGW |
802 | DWORD bytesRead; | 802 | DWORD bytesRead; |
803 | 803 | ||
804 | if (h->type != GNUNET_PIPE) | 804 | if (h->type != GNUNET_DISK_HANLDE_TYPE_PIPE) |
805 | { | 805 | { |
806 | if (!ReadFile (h->h, result, len, &bytesRead, NULL)) | 806 | if (!ReadFile (h->h, result, len, &bytesRead, NULL)) |
807 | { | 807 | { |
@@ -854,7 +854,7 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h, | |||
854 | #ifdef MINGW | 854 | #ifdef MINGW |
855 | DWORD bytesRead; | 855 | DWORD bytesRead; |
856 | 856 | ||
857 | if (h->type != GNUNET_PIPE) | 857 | if (h->type != GNUNET_DISK_HANLDE_TYPE_PIPE) |
858 | { | 858 | { |
859 | if (!ReadFile (h->h, result, len, &bytesRead, NULL)) | 859 | if (!ReadFile (h->h, result, len, &bytesRead, NULL)) |
860 | { | 860 | { |
@@ -944,7 +944,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle * h, | |||
944 | #ifdef MINGW | 944 | #ifdef MINGW |
945 | DWORD bytesWritten; | 945 | DWORD bytesWritten; |
946 | 946 | ||
947 | if (h->type != GNUNET_PIPE) | 947 | if (h->type != GNUNET_DISK_HANLDE_TYPE_PIPE) |
948 | { | 948 | { |
949 | if (!WriteFile (h->h, buffer, n, &bytesWritten, NULL)) | 949 | if (!WriteFile (h->h, buffer, n, &bytesWritten, NULL)) |
950 | { | 950 | { |
@@ -1731,7 +1731,7 @@ GNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | |||
1731 | ret = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle)); | 1731 | ret = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle)); |
1732 | #ifdef MINGW | 1732 | #ifdef MINGW |
1733 | ret->h = h; | 1733 | ret->h = h; |
1734 | ret->type = GNUNET_DISK_FILE; | 1734 | ret->type = GNUNET_DISK_HANLDE_TYPE_FILE; |
1735 | #else | 1735 | #else |
1736 | ret->fd = fd; | 1736 | ret->fd = fd; |
1737 | #endif | 1737 | #endif |
@@ -1798,14 +1798,14 @@ GNUNET_DISK_get_handle_from_native (FILE *fd) | |||
1798 | 1798 | ||
1799 | #if MINGW | 1799 | #if MINGW |
1800 | osfh = _get_osfhandle (fno); | 1800 | osfh = _get_osfhandle (fno); |
1801 | if (osfh == INVALID_HANDLE_VALUE) | 1801 | if (INVALID_HANDLE_VALUE == (HANDLE) osfh) |
1802 | return NULL; | 1802 | return NULL; |
1803 | #endif | 1803 | #endif |
1804 | 1804 | ||
1805 | fh = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle)); | 1805 | fh = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle)); |
1806 | 1806 | ||
1807 | #if MINGW | 1807 | #if MINGW |
1808 | fh->h = osfh; | 1808 | fh->h = (HANDLE) osfh; |
1809 | /* Assume it to be a pipe. TODO: use some kind of detection | 1809 | /* Assume it to be a pipe. TODO: use some kind of detection |
1810 | * function to figure out handle type. | 1810 | * function to figure out handle type. |
1811 | * Note that we can't make it overlapped if it isn't already. | 1811 | * Note that we can't make it overlapped if it isn't already. |
@@ -1815,7 +1815,7 @@ GNUNET_DISK_get_handle_from_native (FILE *fd) | |||
1815 | * otherwise we're screwed, as selecting on non-overlapped handle | 1815 | * otherwise we're screwed, as selecting on non-overlapped handle |
1816 | * will block. | 1816 | * will block. |
1817 | */ | 1817 | */ |
1818 | fh->type = GNUNET_PIPE; | 1818 | fh->type = GNUNET_DISK_HANLDE_TYPE_PIPE; |
1819 | fh->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | 1819 | fh->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); |
1820 | fh->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | 1820 | fh->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); |
1821 | fh->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | 1821 | fh->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); |
@@ -2274,8 +2274,8 @@ GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int i | |||
2274 | CloseHandle (p->fd[1]->h); | 2274 | CloseHandle (p->fd[1]->h); |
2275 | p->fd[1]->h = tmp_handle; | 2275 | p->fd[1]->h = tmp_handle; |
2276 | 2276 | ||
2277 | p->fd[0]->type = GNUNET_PIPE; | 2277 | p->fd[0]->type = GNUNET_DISK_HANLDE_TYPE_PIPE; |
2278 | p->fd[1]->type = GNUNET_PIPE; | 2278 | p->fd[1]->type = GNUNET_DISK_HANLDE_TYPE_PIPE; |
2279 | 2279 | ||
2280 | p->fd[0]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | 2280 | p->fd[0]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); |
2281 | p->fd[0]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | 2281 | p->fd[0]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); |
@@ -2387,7 +2387,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) | |||
2387 | 2387 | ||
2388 | if (p->fd[0]->h != INVALID_HANDLE_VALUE) | 2388 | if (p->fd[0]->h != INVALID_HANDLE_VALUE) |
2389 | { | 2389 | { |
2390 | p->fd[0]->type = GNUNET_PIPE; | 2390 | p->fd[0]->type = GNUNET_DISK_HANLDE_TYPE_PIPE; |
2391 | p->fd[0]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | 2391 | p->fd[0]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); |
2392 | p->fd[0]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | 2392 | p->fd[0]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); |
2393 | p->fd[0]->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | 2393 | p->fd[0]->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); |
@@ -2396,7 +2396,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) | |||
2396 | 2396 | ||
2397 | if (p->fd[1]->h != INVALID_HANDLE_VALUE) | 2397 | if (p->fd[1]->h != INVALID_HANDLE_VALUE) |
2398 | { | 2398 | { |
2399 | p->fd[1]->type = GNUNET_PIPE; | 2399 | p->fd[1]->type = GNUNET_DISK_HANLDE_TYPE_PIPE; |
2400 | p->fd[1]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | 2400 | p->fd[1]->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); |
2401 | p->fd[1]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | 2401 | p->fd[1]->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); |
2402 | p->fd[1]->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | 2402 | p->fd[1]->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); |