* Patch for configtool
@ 2011-10-12 11:00 Martin Laabs
2011-10-16 18:46 ` Sergei Gavrikov
0 siblings, 1 reply; 2+ messages in thread
From: Martin Laabs @ 2011-10-12 11:00 UTC (permalink / raw)
To: eCos Developer List
[-- Attachment #1: Type: text/plain, Size: 254 bytes --]
Hello,
as I wrote some days before I found a bug in the configtool. I attached a
patch file that fix the long message issue and make the whole source
compatible to x64 systems. Therefore I replaced the pointer to int casts.
Best regards,
Martin L.
[-- Attachment #2: configtool.patch --]
[-- Type: text/plain, Size: 13660 bytes --]
? patch_file
? tools/configtool/standalone/unix/typescript
? tools/configtool/standalone/wxwin/ct-build-debug
Index: tools/Utils/common/Collections.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/Collections.cpp,v
retrieving revision 1.4
diff -u -r1.4 Collections.cpp
--- tools/Utils/common/Collections.cpp 29 Jan 2009 17:47:49 -0000 1.4
+++ tools/Utils/common/Collections.cpp 12 Oct 2011 10:54:59 -0000
@@ -47,9 +47,12 @@
void String::vFormat(LPCTSTR pszFormat, va_list marker)
{
+va_list tmp; //tempoary store marker to call vsntprintf more than one time
+
for(int nLength=100;nLength;) {
+va_copy(tmp,marker);
TCHAR *buf=new TCHAR[1+nLength];
- int n=_vsntprintf(buf, nLength, pszFormat, marker );
+ int n=_vsntprintf(buf, nLength, pszFormat, tmp);
if(-1==n){
nLength*=2; // NT behavior
} else if (n<nLength){
Index: tools/Utils/common/eCosSerial.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/eCosSerial.cpp,v
retrieving revision 1.3
diff -u -r1.3 eCosSerial.cpp
--- tools/Utils/common/eCosSerial.cpp 29 Jan 2009 17:47:49 -0000 1.3
+++ tools/Utils/common/eCosSerial.cpp 12 Oct 2011 10:54:59 -0000
@@ -340,7 +340,7 @@
bool CeCosSerial::Close()
{
- bool rc=m_pHandle && (-1!=close((int)m_pHandle));
+ bool rc=m_pHandle && (-1!=close((intptr_t)m_pHandle));
m_pHandle=0;
return rc;
}
@@ -427,7 +427,7 @@
TRACE(_T("Changing configuration...\n"));
// Get current settings.
- if (tcgetattr((int) m_pHandle, &buf)) {
+ if (tcgetattr((intptr_t) m_pHandle, &buf)) {
fprintf(stderr, _T("Error: tcgetattr\n"));
return false;
}
@@ -494,7 +494,7 @@
}
// Set the new settings
- if (tcsetattr((int) m_pHandle, TCSADRAIN, &buf)) {
+ if (tcsetattr((intptr_t) m_pHandle, TCSADRAIN, &buf)) {
fprintf(stderr, _T("Error: tcsetattr\n"));
return false;
}
@@ -503,7 +503,7 @@
// error if _all_ settings fail. If just a few settings are not
// supported, the call returns true while the hardware is set to a
// combination of old and new settings.
- if (tcgetattr((int) m_pHandle, &buf_verify)) {
+ if (tcgetattr((intptr_t) m_pHandle, &buf_verify)) {
fprintf(stderr, _T("Error: tcgetattr\n"));
return false;
}
@@ -522,7 +522,7 @@
bool CeCosSerial::Flush (void)
{
- return 0==tcflush((int) m_pHandle, TCIOFLUSH);
+ return 0==tcflush((intptr_t) m_pHandle, TCIOFLUSH);
}
bool CeCosSerial::Read (void *pBuf,unsigned int nSize,unsigned int &nRead)
@@ -530,7 +530,7 @@
if (!m_bBlockingReads) {
nRead = 0;
- int n = read((int)m_pHandle, pBuf, nSize);
+ int n = read((intptr_t)m_pHandle, pBuf, nSize);
if (-1 == n) {
if (EAGAIN == errno)
return true;
@@ -558,7 +558,7 @@
fd_set rfds;
FD_ZERO(&rfds);
- FD_SET((int)m_pHandle, &rfds);
+ FD_SET((intptr_t)m_pHandle, &rfds);
// Start with total timeout.
struct timeval tv;
@@ -568,10 +568,10 @@
unsigned char* pData = (unsigned char*) pBuf;
nRead = 0;
while (nSize) {
- switch(select((int)m_pHandle + 1, &rfds, NULL, NULL, &tv)) {
+ switch(select((intptr_t)m_pHandle + 1, &rfds, NULL, NULL, &tv)) {
case 1:
{
- int n = read((int)m_pHandle, pData, nSize);
+ int n = read((intptr_t)m_pHandle, pData, nSize);
if (-1 == n && EAGAIN != errno) {
ERROR(_T("Read failed: %d\n"), errno);
return false; // FAILED
@@ -608,7 +608,7 @@
bool CeCosSerial::Write(void *pBuf,unsigned int nSize,unsigned int &nWritten)
{
bool rc;
- int n=write((int)m_pHandle,pBuf,nSize);
+ int n=write((intptr_t)m_pHandle,pBuf,nSize);
if(-1==n){
nWritten=0;
if (errno == EAGAIN)
Index: tools/Utils/common/eCosSocket.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/eCosSocket.cpp,v
retrieving revision 1.3
diff -u -r1.3 eCosSocket.cpp
--- tools/Utils/common/eCosSocket.cpp 29 Jan 2009 17:47:49 -0000 1.3
+++ tools/Utils/common/eCosSocket.cpp 12 Oct 2011 10:54:59 -0000
@@ -96,7 +96,7 @@
m_nSock(-1),
m_nClient(0)
{
- VTRACE(_T("Create socket instance %08x\n"),(unsigned int)this);
+ VTRACE(_T("Create socket instance %08x\n"),(uintptr_t)this);
}
CeCosSocket::CeCosSocket (int sock /*result of previous call of Listen*/, bool *pbStop):
@@ -104,7 +104,7 @@
m_nSock(-1),
m_nClient(0)
{
- VTRACE(_T("Create socket instance %08x\n"),(unsigned int)this);
+ VTRACE(_T("Create socket instance %08x\n"),(uintptr_t)this);
Accept(sock,pbStop);
}
@@ -113,7 +113,7 @@
m_nSock(-1),
m_nClient(0)
{
- VTRACE(_T("Create socket instance %08x\n"),(unsigned int)this);
+ VTRACE(_T("Create socket instance %08x\n"),(uintptr_t)this);
Connect(pszHostPort,dTimeout);
}
@@ -312,7 +312,7 @@
CeCosSocket::~CeCosSocket()
{
Close();
- VTRACE(_T("Delete socket instance %08x\n"),(unsigned int)this);
+ VTRACE(_T("Delete socket instance %08x\n"),(uintptr_t)this);
}
bool CeCosSocket::CloseSocket(int &sock)
Index: tools/Utils/common/eCosStd.h
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/eCosStd.h,v
retrieving revision 1.9
diff -u -r1.9 eCosStd.h
--- tools/Utils/common/eCosStd.h 29 Jan 2009 17:47:49 -0000 1.9
+++ tools/Utils/common/eCosStd.h 12 Oct 2011 10:54:59 -0000
@@ -50,7 +50,7 @@
#include <signal.h>
#define cPathsep '/'
- #include <malloc.h> // malloc
+// #include <malloc.h> // malloc
#include <stdlib.h> // atoi
#include <errno.h>
#define WOULDBLOCK WSAEWOULDBLOCK
@@ -113,7 +113,7 @@
#include <signal.h>
#define cPathsep '/'
- #include <malloc.h> // malloc
+// #include <malloc.h> // malloc
#include <stdlib.h> // atoi
#include <errno.h>
#define WOULDBLOCK EWOULDBLOCK
@@ -146,7 +146,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <assert.h>
-#include <malloc.h>
+// #include <malloc.h>
#include <stdlib.h>
#include <time.h>
#include <stdarg.h> // vsnprintf
Index: tools/Utils/common/eCosThreadUtils.h
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/eCosThreadUtils.h,v
retrieving revision 1.3
diff -u -r1.3 eCosThreadUtils.h
--- tools/Utils/common/eCosThreadUtils.h 29 Jan 2009 17:47:49 -0000 1.3
+++ tools/Utils/common/eCosThreadUtils.h 12 Oct 2011 10:54:59 -0000
@@ -59,7 +59,7 @@
typedef DWORD THREAD_ID;
#else // UNIX
#ifndef NO_THREADS
- typedef int THREAD_ID;
+ typedef pthread* THREAD_ID;
#else
typedef pthread_t THREAD_ID;
#endif
Index: tools/Utils/common/eCosTrace.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/Utils/common/eCosTrace.cpp,v
retrieving revision 1.3
diff -u -r1.3 eCosTrace.cpp
--- tools/Utils/common/eCosTrace.cpp 29 Jan 2009 17:47:49 -0000 1.3
+++ tools/Utils/common/eCosTrace.cpp 12 Oct 2011 10:54:59 -0000
@@ -61,7 +61,7 @@
fclose(OutInfo.f);
}
if(nVerbosity>=TRACE_LEVEL_TRACE){
- _ftprintf(stderr,_T("Output -> %s (%08x)\n"),pszFilename,(unsigned int)f);
+ _ftprintf(stderr,_T("Output -> %s (%08x)\n"),pszFilename,(uintptr_t)f);
}
OutInfo.f=f;
OutInfo.strFilename=pszFilename;
@@ -113,7 +113,14 @@
String str;
str.vFormat(pszFormat,marker);
va_end (marker);
+const char *buf1, *buf2;
+//String::SFormat(_T("%s %s"));
+buf1=(LPCTSTR)Timestamp();
+buf2=((LPCTSTR)str);
+String::SFormat(_T("%s %s"),buf1,buf2);
+//String::SFormat(_T("%s %s"),(LPCTSTR)Timestamp(),(LPCTSTR)str);
+//b eCosTrace.cpp:118
Err(String::SFormat(_T("%s %s"),(LPCTSTR)Timestamp(),(LPCTSTR)str));
}
@@ -128,5 +135,6 @@
TCHAR c2=bInCriticalSection?_TCHAR('>'):_TCHAR(']');
return String::SFormat(_T("%c%3x %s %02d:%02d:%02d%c"),c1,CeCosThreadUtils::GetThreadId(),
arpszDow[now->tm_wday],now->tm_hour,now->tm_min,now->tm_sec,c2);
+// return _T("Blub");
}
Index: tools/configtool/standalone/wxwin/makefile.gnu
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/makefile.gnu,v
retrieving revision 1.14
diff -u -r1.14 makefile.gnu
--- tools/configtool/standalone/wxwin/makefile.gnu 25 Mar 2009 09:12:35 -0000 1.14
+++ tools/configtool/standalone/wxwin/makefile.gnu 12 Oct 2011 10:54:59 -0000
@@ -49,13 +49,14 @@
USEEXPERIMENTALCODE=1
EXTRACPPFLAGS=\
+ -I /usr/local/include/tcl8.6 \
-I$(TCLDIR)/include \
-I$(INSTALLDIR)/include \
-I$(ECOSSRCDIR)/tools/configtool/common/common \
-I$(ECOSSRCDIR)/tools/Utils/common \
-I$(ECOSSRCDIR)/tools/ecostest/common \
-DecUSE_EXPERIMENTAL_CODE=$(USEEXPERIMENTALCODE)
-EXTRALDFLAGS=-L$(TCLDIR)/lib -L$(INSTALLDIR)/lib -lcdl -lcyginfra -ltcl
+EXTRALDFLAGS=-L$(TCLDIR)/lib -L$(INSTALLDIR)/lib -lcdl -lcyginfra -ltcl86 -lcompat
ifneq (,$(findstring CYGWIN, $(shell uname)))
PROGRAM=configtool.exe
@@ -140,7 +141,7 @@
$(CC) -o $@ $(OBJECTS) $(EXTRAOBJECTS) $(EXTRALDFLAGS) $(LDFLAGS)
install: $(CTBUILDDIR)/$(PROGRAM)
- install -D -s $< $(INSTALLDIR)/bin/$(PROGRAM)
+ install -s $< $(INSTALLDIR)/bin/$(PROGRAM)
.cpp.o :
$(CC) $(CPPDEBUGOPTIONS) -c $(EXTRACPPFLAGS) $(CPPFLAGS) -o $@ $<
Index: tools/configtool/standalone/wxwin/packagesdlg.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/packagesdlg.cpp,v
retrieving revision 1.9
diff -u -r1.9 packagesdlg.cpp
--- tools/configtool/standalone/wxwin/packagesdlg.cpp 17 Nov 2009 09:16:06 -0000 1.9
+++ tools/configtool/standalone/wxwin/packagesdlg.cpp 12 Oct 2011 10:55:00 -0000
@@ -507,7 +507,7 @@
int itemIndex = -1;
if (toDelete > -1)
{
- itemIndex = (int) from -> GetClientData(toDelete);
+ itemIndex = (intptr_t) from -> GetClientData(toDelete);
from -> Delete(toDelete);
}
@@ -686,7 +686,7 @@
wxString str = versionChoice->GetString(versionChoice->GetSelection());
// itemIndex is the index into the list of item names. It gets stored with all the listbox items.
- int itemIndex = (int) pListBox->GetClientData((*selected)[nIndex]);
+ int itemIndex = (intptr_t) pListBox->GetClientData((*selected)[nIndex]);
m_currentVersions[(size_t)itemIndex] = str;
}
}
@@ -985,7 +985,7 @@
// retrieve the dialog item array index for use in
// comparing current version strings
- const int nVersionIndex = (int) pListBox->GetClientData ((*selections)[nIndex]);
+ const int nVersionIndex = (intptr_t) pListBox->GetClientData ((*selections)[nIndex]);
// retrieve the installed version array
Index: tools/configtool/standalone/wxwin/propertywin.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/propertywin.cpp,v
retrieving revision 1.4
diff -u -r1.4 propertywin.cpp
--- tools/configtool/standalone/wxwin/propertywin.cpp 16 Feb 2009 09:17:42 -0000 1.4
+++ tools/configtool/standalone/wxwin/propertywin.cpp 12 Oct 2011 10:55:00 -0000
@@ -271,7 +271,7 @@
void *p;
p = (void*) map.Delete(strName);
- p=(void *)((int)p+1);
+ p=(void *)((intptr_t)p+1);
map.Put(strName, (wxObject*) p);
std::vector<std::string>::const_iterator argv_i;
@@ -286,7 +286,7 @@
}
}
// the list control appears to display a maximum of 256 characters
- int nIndex=SetItem(strName, strPropertyArgs, GetItemCount(), (int)p);
+ int nIndex=SetItem(strName, strPropertyArgs, GetItemCount(), (intptr_t)p);
SetItemData(nIndex, (long) prop);
// display the exclamation icon if the property is in a conflicts list
Index: tools/ecostest/common/TestResource.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/ecostest/common/TestResource.cpp,v
retrieving revision 1.3
diff -u -r1.3 TestResource.cpp
--- tools/ecostest/common/TestResource.cpp 29 Jan 2009 17:47:50 -0000 1.3
+++ tools/ecostest/common/TestResource.cpp 12 Oct 2011 10:55:00 -0000
@@ -57,7 +57,7 @@
m_Target(target)
{
CeCosSocket::ParseHostPort(pszHostPort,m_strHost,m_nPort);
- VTRACE(_T("@@@ Created resource %08x %s\n"),(unsigned int)this,(LPCTSTR)Image());
+ VTRACE(_T("@@@ Created resource %08x %s\n"),(uintptr_t)this,(LPCTSTR)Image());
Chain();
}
Index: tools/ecostest/common/eCosTestDownloadFilter.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/ecostest/common/eCosTestDownloadFilter.cpp,v
retrieving revision 1.16
diff -u -r1.16 eCosTestDownloadFilter.cpp
--- tools/ecostest/common/eCosTestDownloadFilter.cpp 29 Jan 2009 17:47:50 -0000 1.16
+++ tools/ecostest/common/eCosTestDownloadFilter.cpp 12 Oct 2011 10:55:00 -0000
@@ -288,7 +288,7 @@
int resend = 1;
const unsigned char* write_ptr = (const unsigned char*) buf2.Data();
- int write_len = (int)p-(int)buf2.Data();
+ int write_len = (intptr_t)p-(intptr_t)buf2.Data();
while (resend)
{
unsigned int __written;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch for configtool
2011-10-12 11:00 Patch for configtool Martin Laabs
@ 2011-10-16 18:46 ` Sergei Gavrikov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Gavrikov @ 2011-10-16 18:46 UTC (permalink / raw)
To: Martin Laabs; +Cc: eCos Developer List
Martin Laabs wrote:
> Hello,
Hi Martin,
> as I wrote some days before I found a bug in the configtool. I attached a
> patch file that fix the long message issue and make the whole source
> compatible to x64 systems. Therefore I replaced the pointer to int casts.
Thank you for your contribution and testing. Could you, please, submit a
bug report to eCos Bugzilla system?
http://ecos.sourceware.org/problemreport.html
http://bugs.ecos.sourceware.org/enter_bug.cgi?product=eCos
Thank you,
Sergei
> Best regards,
> Martin L.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-16 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-12 11:00 Patch for configtool Martin Laabs
2011-10-16 18:46 ` Sergei Gavrikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).