]> sjero.net Git - wget/blobdiff - src/mswindows.c
[svn] Cosmetic changes to GNU convention.
[wget] / src / mswindows.c
index 6d5e4717383802f494a470369ebd2f14462626d4..b4bb861984ee70c16faa83b000592dfc238cd6ae 100644 (file)
@@ -290,7 +290,8 @@ ws_startup (void)
    (The Borland utime function only works on Windows NT.)  */
 
 #ifdef HACK_BCC_UTIME_BUG
-int borland_utime(const char *path, const struct utimbuf *times)
+int
+borland_utime (const char *path, const struct utimbuf *times)
 {
   int fd;
   int res;
@@ -314,30 +315,32 @@ int borland_utime(const char *path, const struct utimbuf *times)
 #endif
 
 /*
- * Prevent Windows entering sleep/hibernation-mode while wget is doing a lengthy transfer.
- * Windows does by default not consider network activity in console-programs as activity !
- * Works on Win-98/ME/2K and up.
+ * Prevent Windows entering sleep/hibernation-mode while wget is doing
+ * a lengthy transfer.  Windows does by default not consider network
+ * activity in console-programs as activity !  Works on Win-98/ME/2K
+ * and up.
  */
-static
-DWORD set_sleep_mode (DWORD mode)
+static DWORD
+set_sleep_mode (DWORD mode)
 {
   HMODULE mod = LoadLibrary ("kernel32.dll");
-  DWORD (*_SetThreadExecutionState) (DWORD) = NULL;
+  DWORD (WINAPI *_SetThreadExecutionState) (DWORD) = NULL;
   DWORD rc = (DWORD)-1;
 
   if (mod)
-     (void*)_SetThreadExecutionState = GetProcAddress ((HINSTANCE)mod, "SetThreadExecutionState");
+     (void *)_SetThreadExecutionState
+       = GetProcAddress ((HINSTANCE)mod, "SetThreadExecutionState");
 
   if (_SetThreadExecutionState)
     {
       if (mode == 0)  /* first time */
-         mode = (ES_SYSTEM_REQUIRED | ES_CONTINUOUS);
+       mode = (ES_SYSTEM_REQUIRED | ES_CONTINUOUS);
       rc = (*_SetThreadExecutionState) (mode);
     }
   if (mod)
-     FreeLibrary (mod);
+    FreeLibrary (mod);
   DEBUGP (("set_sleep_mode(): mode 0x%08lX, rc 0x%08lX\n", mode, rc));
-  return (rc);
+  return rc;
 }
 \f
 /* run_with_timeout Windows implementation. */
@@ -376,7 +379,7 @@ thread_helper (void *arg)
 
   /* Return Winsock error to the caller, in case FUN ran Winsock
      code.  */
-  td->ws_error = WSAGetLastError();
+  td->ws_error = WSAGetLastError ();
   return 0; 
 }
 
@@ -413,16 +416,17 @@ run_with_timeout (double seconds, void (*fun) (void *), void *arg)
                             &thread_arg, 0, &thread_id); 
   if (!thread_hnd)
     {
-      DEBUGP (("CreateThread() failed; %s\n", strerror(GetLastError())));
+      DEBUGP (("CreateThread() failed; %s\n", strerror (GetLastError ())));
       goto blocking_fallback;
     }
 
-  if (WaitForSingleObject(thread_hnd, (DWORD)(1000*seconds)) == WAIT_OBJECT_0)
+  if (WaitForSingleObject (thread_hnd, (DWORD)(1000 * seconds))
+      == WAIT_OBJECT_0)
     {
       /* Propagate error state (which is per-thread) to this thread,
         so the caller can inspect it.  */
       WSASetLastError (thread_arg.ws_error);
-      DEBUGP (("Winsock error: %d\n", WSAGetLastError()));
+      DEBUGP (("Winsock error: %d\n", WSAGetLastError ()));
       rc = 0;
     }
   else