ReDirList().run(2, argv);
}
int secOfFileTime(ReFileTime_t data){
+#if defined __linux__
return data.tv_sec;
+#elif defined __WIN32__
+ return (int) ReDirStatus_t::filetimeToTime(&data);
+#endif
}
void testCopyFile(){
#if defined __linux__
checkEqu(expected.count(), current.count());
ReByteBuffer line;
ReStringList cols;
- for (int ix = 0; ix < current.count(); ix++){
+ for (size_t ix = 0; ix < current.count(); ix++){
line.setLength(0).append(current.strOf(ix), -1);
cols.split(expected.strOf(ix), '*');
checkT(line.startsWith(cols.strOf(0)));
max2 = random.nextInt(20);
while(text.length() > 0){
int part = random.nextInt(32, 32 + 1 + max2);
- if (part > text.length())
+ if (part > (int) text.length())
part = text.length();
md5.update((uint8_t*) text.str(), part);
text.remove(0, part);
#if defined __linux__\r
bool found = strcmp(entry.node(), name.str()) == 0;\r
#elif defined __WIN32__\r
- bool found = stricmp(entry.node(), name.str()) == 0;\r
+ bool found = _stricmp(entry.node(), name.str()) == 0;\r
#endif\r
if (found && m_filter.match(entry)){\r
processFile(&entry);\r
#if defined __linux__\r
return time.tv_sec >= time1980;\r
#elif defined __WIN32__\r
+ static ReFileTime_t time2 = { 0, 0 };\r
+ if (time2.dwHighDateTime == 0 && time2.dwLowDateTime == 0)\r
+ ReDirStatus_t::timeToFiletime(time1980, time2);\r
+ return time2 > time;\r
#endif\r
}\r
static void addRelativeTime(ReFileTime_t& absTime, const ReFileTime_t& relTime){\r
}\r
absTime.tv_sec += relTime.tv_sec;\r
#elif defined __WIN32__\r
+ uint64_t absValue = ((uint64_t) absTime.dwHighDateTime << 32) | absTime.dwLowDateTime;\r
+ uint64_t relValue = ((uint64_t) relTime.dwHighDateTime << 32) | relTime.dwLowDateTime;\r
+ absValue += relValue;\r
+ absTime.dwHighDateTime = (uint32_t) (absValue >> 32); \r
+ absTime.dwLowDateTime = (uint32_t) absValue; \r
#endif\r
-\r
}\r
/**\r
* Processes one file.\r
HANDLE handle = CreateFile(filename, FILE_WRITE_ATTRIBUTES,\r
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,\r
FILE_ATTRIBUTE_NORMAL, NULL);\r
- if (handle == UNDEF_HANDLE)\r
+ if (handle == INVALID_HANDLE_VALUE)\r
rc = GetLastError();\r
else {\r
- if (SetFileTime(handle, (LPFILETIME) NULL,(LPFILETIME) NULL,&thefiletime) != 0)\r
+ if (! SetFileTime(handle, (LPFILETIME) NULL, &accessed, &modified))\r
rc = GetLastError();\r
CloseHandle(handle);\r
}\r
*/
inline bool operator >(const ReFileTime_t& time1, const ReFileTime_t& time2){
#if defined __linux__
- return time1.tv_sec > time1.tv_sec || time1.tv_sec == time2.tv_sec && time1.tv_nsec > time2.tv_nsec;
+ return time1.tv_sec > time2.tv_sec || time1.tv_sec == time2.tv_sec && time1.tv_nsec > time2.tv_nsec;
#else
+ return time1.dwHighDateTime > time2.dwHighDateTime
+ || time1.dwHighDateTime == time2.dwHighDateTime
+ && time1.dwLowDateTime > time2.dwLowDateTime;
#endif
}
#include "os/ReTraverser.hpp"