[Gdal-dev] Please try this ECW 3.1-rc2 patch for linux/posix

Bill Binko bill at binko.net
Wed Jun 15 01:18:58 EDT 2005


Hi everyone.

I found what I think is a problem in the ECW libraries (version 3.1-rc2).  
Basically, they are not initializing a boolean attribute of a class to 
zero (FALSE).  This means that if you test with the debug version of the 
library, it works (GCC initializes it) and if you work with the optimized 
version, it doesn't.

So, I put together a patch that seems to fix the problem.  I'm attaching 
it to this message.

Please let me know if this helps, or if there are more occurrences of 
this.  I have posted this to the ERMapper forum, so hopefully, it will 
make it into the 3.1 release.

Bill
-------------- next part --------------
diff -U5 -r ecwrc2-orig/Source/C/NCSUtil/thread.c ecwrc2/Source/C/NCSUtil/thread.c
--- ecwrc2-orig/Source/C/NCSUtil/thread.c	2005-01-19 12:42:20.000000000 -0500
+++ ecwrc2/Source/C/NCSUtil/thread.c	2005-06-15 00:52:23.947514800 -0400
@@ -198,12 +198,14 @@
 		HANDLE hThread;

 #else /* _WIN32_WCE */

 		unsigned long hThread;

 #endif /* _WIN32_WCE */

 		NCSThreadInfo *pThreadInfo = (NCSThreadInfo*)NCSMalloc(sizeof(NCSThreadInfo), TRUE);

-

 		NCSMutexBegin(&mMutex);

+

+		pThreadInfo->bThreadRunning = FALSE;

+

 		pThreadInfo->tid = tidNextTID++;

 		NCSMutexEnd(&mMutex);

 

 		*pThread = pThreadInfo->tid;

 		pStartData->pThread = &(pThreadInfo->tid);//pThread;

@@ -269,10 +271,11 @@
 	MacThreadID hThread;

 	NCSThreadStartData *pStartData = NULL;

 	if( pThreadInfo ) {

 

 		NCSMutexBegin(&mMutex);

+		pThreadInfo->bThreadRunning = FALSE;

 		pThreadInfo->tid = tidNextTID++;

 		NCSMutexEnd(&mMutex);

 

 		*pThread = pThreadInfo->tid;

 

@@ -354,10 +357,11 @@
 	NCSThreadStartData *pStartData = NULL;

 

 	NCSThreadInfo *pThreadInfo = (NCSThreadInfo*)NCSMalloc(sizeof(NCSThreadInfo), TRUE);

 

 	NCSMutexBegin(&mMutex);

+	pThreadInfo->bThreadRunning = FALSE;

 	pThreadInfo->tid = tidNextTID++;

 	NCSMutexEnd(&mMutex);

 

 	*pThread = pThreadInfo->tid;

 

@@ -629,11 +633,11 @@
 		*/

 		NCSThreadInfo *pThreadInfo = (NCSThreadInfo*)NCSMalloc(sizeof(NCSThreadInfo), TRUE);

 

 		if(pThreadInfo) {

 			NCSMutexBegin(&mMutex);

-

+			pThreadInfo->bThreadRunning = FALSE;

 			pThreadInfo->tid = tidNextTID++;

 

 #ifdef WIN32

 #ifdef _WIN32_WCE

 			pThreadInfo->hThread = GetCurrentThread(); // FIXME - no DuplicateHandle()?



More information about the Gdal-dev mailing list