comparison host/tools/ecostest/common/eCosTestUtils.cpp @ 2246:cf44f62361c7

* tools/configtool/standalone/wxwin/configtool.cpp: Workaround an exception handling issue with Cygwin 1.5.20. * tools/ecostest/common/eCosTestUtils.cpp, tools/ecostest/common/eCosTestUtils.h: Tweak function prototypes for GCC 3.4.4.
author jld
date Tue, 11 Jul 2006 09:56:14 +0000
parents 6736c52df507
children 24c0267fbb70
comparison
equal deleted inserted replaced
2245:42e30b66c3f8 2246:cf44f62361c7
1 //####COPYRIGHTBEGIN#### 1 //####COPYRIGHTBEGIN####
2 // 2 //
3 // ---------------------------------------------------------------------------- 3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. 4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 // Copyright (C) 2006 eCosCentric Limited
5 // 6 //
6 // This program is part of the eCos host tools. 7 // This program is part of the eCos host tools.
7 // 8 //
8 // This program is free software; you can redistribute it and/or modify it 9 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free 10 // under the terms of the GNU General Public License as published by the Free
55 } 56 }
56 return (0==pszTail)?pszFile:pszTail+1; 57 return (0==pszTail)?pszFile:pszTail+1;
57 } 58 }
58 59
59 // File iterator. Gets next file in directory, avoiding _T(".") and _T("..") 60 // File iterator. Gets next file in directory, avoiding _T(".") and _T("..")
60 bool CeCosTestUtils::NextFile (void *&pHandle,String &str) 61 bool CeCosTestUtils::NextFile (void *pHandle,String &str)
61 { 62 {
62 #ifdef _WIN32 63 #ifdef _WIN32
63 WIN32_FIND_DATA fd; 64 WIN32_FIND_DATA fd;
64 while(FindNextFile((HANDLE)pHandle,&fd)){ 65 while(FindNextFile((HANDLE)pHandle,&fd)){
65 LPCTSTR pszName=fd.cFileName; 66 LPCTSTR pszName=fd.cFileName;
75 } 76 }
76 return false; 77 return false;
77 } 78 }
78 79
79 // Start file iteration and return first file. 80 // Start file iteration and return first file.
80 bool CeCosTestUtils::StartSearch (void *&pHandle,String &str) 81 bool CeCosTestUtils::StartSearch (void *pHandle,String &str)
81 { 82 {
82 #ifdef _WIN32 83 #ifdef _WIN32
83 WIN32_FIND_DATA fd; 84 WIN32_FIND_DATA fd;
84 pHandle=(void *)FindFirstFile (_T("*.*"), &fd); 85 pHandle=(void *)FindFirstFile (_T("*.*"), &fd);
85 if(INVALID_HANDLE_VALUE==(HANDLE)pHandle){ 86 if(INVALID_HANDLE_VALUE==(HANDLE)pHandle){
86 ERROR(_T("Failed to open dir\n")); 87 ERROR(_T("Failed to open dir\n"));
87 return false; 88 return false;
88 } else if (fd.cFileName[0]=='.') { 89 } else if (fd.cFileName[0]=='.') {
89 return NextFile((HANDLE)pHandle,str); 90 return NextFile(pHandle,str);
90 } else { 91 } else {
91 str=String(fd.cFileName); 92 str=String(fd.cFileName);
92 return true; 93 return true;
93 } 94 }
94 #else // UNIX 95 #else // UNIX
100 return NextFile(pHandle,str); 101 return NextFile(pHandle,str);
101 #endif 102 #endif
102 } 103 }
103 104
104 // End file iteration 105 // End file iteration
105 void CeCosTestUtils::EndSearch (void *&pHandle) 106 void CeCosTestUtils::EndSearch (void *pHandle)
106 { 107 {
107 #ifdef _WIN32 108 #ifdef _WIN32
108 FindClose((HANDLE)pHandle); 109 FindClose((HANDLE)pHandle);
109 #else // UNIX 110 #else // UNIX
110 closedir((DIR *)pHandle); 111 closedir((DIR *)pHandle);