[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[TSVN] [Patch] Very minor clean-up

From: Norbert Unterberg <nepo_at_gmx.net>
Date: 2005-05-11 22:14:27 CEST

Attached is a minor cleanup patch (no functional change) for TSVNCache:

Use correct function signature for the thread functions, so that the
type casts when calling the CreateThread() are no longer required.

Norbert

Index: src/TSVNCache/TSVNCache.cpp
===================================================================
--- src/TSVNCache/TSVNCache.cpp (revision 3318)
+++ src/TSVNCache/TSVNCache.cpp (working copy)
@@ -33,10 +33,10 @@
 
 CCrashReport crasher("crashreports@tortoisesvn.tigris.org", "Crash Report for TSVNCache : " STRPRODUCTVER);// crash
 
-VOID InstanceThread(LPVOID);
-VOID PipeThread(LPVOID);
-VOID CommandWaitThread(LPVOID);
-VOID CommandThread(LPVOID);
+DWORD WINAPI InstanceThread(LPVOID);
+DWORD WINAPI PipeThread(LPVOID);
+DWORD WINAPI CommandWaitThread(LPVOID);
+DWORD WINAPI CommandThread(LPVOID);
 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
 bool bRun = true;
 NOTIFYICONDATA niData;
@@ -199,7 +199,7 @@
         hPipeThread = CreateThread(
                 NULL, // no security attribute
                 0, // default stack size
- (LPTHREAD_START_ROUTINE) PipeThread,
+ PipeThread,
                 (LPVOID) &bRun, // thread parameter
                 0, // not suspended
                 &dwThreadId); // returns thread ID
@@ -217,7 +217,7 @@
         hCommandWaitThread = CreateThread(
                 NULL, // no security attribute
                 0, // default stack size
- (LPTHREAD_START_ROUTINE) CommandWaitThread,
+ CommandWaitThread,
                 (LPVOID) &bRun, // thread parameter
                 0, // not suspended
                 &dwThreadId); // returns thread ID
@@ -335,7 +335,7 @@
         CSVNStatusCache::Instance().GetStatusForPath(path, pRequest->flags).BuildCacheResponse(*pReply, *pResponseLength);
 }
 
-VOID PipeThread(LPVOID lpvParam)
+DWORD WINAPI PipeThread(LPVOID lpvParam)
 {
         ATLTRACE("PipeThread started\n");
         bool * bRun = (bool *)lpvParam;
@@ -380,7 +380,7 @@
                         hInstanceThread = CreateThread(
                                 NULL, // no security attribute
                                 0, // default stack size
- (LPTHREAD_START_ROUTINE) InstanceThread,
+ InstanceThread,
                                 (LPVOID) hPipe, // thread parameter
                                 0, // not suspended
                                 &dwThreadId); // returns thread ID
@@ -395,7 +395,7 @@
                                 // otherwise the thread is dead, but the app is still running, refusing new instances
                                 // but no pipe will be available anymore.
                                 PostMessage(hWnd, WM_CLOSE, 0, 0);
- return;
+ return 1;
                         }
                         else CloseHandle(hInstanceThread);
                 }
@@ -409,9 +409,10 @@
                 }
         }
         ATLTRACE("Pipe thread exited\n");
+ return 0;
 }
 
-VOID CommandWaitThread(LPVOID lpvParam)
+DWORD WINAPI CommandWaitThread(LPVOID lpvParam)
 {
         ATLTRACE("CommandWaitThread started\n");
         bool * bRun = (bool *)lpvParam;
@@ -456,7 +457,7 @@
                         hCommandThread = CreateThread(
                                 NULL, // no security attribute
                                 0, // default stack size
- (LPTHREAD_START_ROUTINE) CommandThread,
+ CommandThread,
                                 (LPVOID) hPipe, // thread parameter
                                 0, // not suspended
                                 &dwThreadId); // returns thread ID
@@ -471,7 +472,7 @@
                                 // otherwise the thread is dead, but the app is still running, refusing new instances
                                 // but no pipe will be available anymore.
                                 PostMessage(hWnd, WM_CLOSE, 0, 0);
- return;
+ return 1;
                         }
                         else CloseHandle(hCommandThread);
                 }
@@ -485,9 +486,10 @@
                 }
         }
         ATLTRACE("CommandWait thread exited\n");
+ return 0;
 }
 
-VOID InstanceThread(LPVOID lpvParam)
+DWORD WINAPI InstanceThread(LPVOID lpvParam)
 {
         ATLTRACE("InstanceThread started\n");
         TSVNCacheResponse response;
@@ -515,7 +517,7 @@
                         DisconnectNamedPipe(hPipe);
                         CloseHandle(hPipe);
                         ATLTRACE("Instance thread exited\n");
- return;
+ return 1;
                 }
 
                 DWORD responseLength;
@@ -534,7 +536,7 @@
                         DisconnectNamedPipe(hPipe);
                         CloseHandle(hPipe);
                         ATLTRACE("Instance thread exited\n");
- return;
+ return 1;
                 }
         }
 
@@ -546,9 +548,10 @@
         DisconnectNamedPipe(hPipe);
         CloseHandle(hPipe);
         ATLTRACE("Instance thread exited\n");
+ return 0;
 }
 
-VOID CommandThread(LPVOID lpvParam)
+DWORD WINAPI CommandThread(LPVOID lpvParam)
 {
         ATLTRACE("CommandThread started\n");
         DWORD cbBytesRead;
@@ -575,7 +578,7 @@
                         DisconnectNamedPipe(hPipe);
                         CloseHandle(hPipe);
                         ATLTRACE("Command thread exited\n");
- return;
+ return 1;
                 }
                 
                 switch (command.command)
@@ -585,7 +588,7 @@
                                 DisconnectNamedPipe(hPipe);
                                 CloseHandle(hPipe);
                                 ATLTRACE("Command thread exited\n");
- return;
+ return 0;
                         case TSVNCACHECOMMAND_CRAWL:
                                 CTSVNPath changedpath;
                                 changedpath.SetFromWin(CString(command.path), true);
@@ -604,4 +607,5 @@
         DisconnectNamedPipe(hPipe);
         CloseHandle(hPipe);
         ATLTRACE("Command thread exited\n");
+ return 0;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu May 12 00:14:01 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.