瀏覽代碼

HPCC-17308 Fix problems with 64bit windows builds

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 8 年之前
父節點
當前提交
5efe4b702f
共有 5 個文件被更改,包括 12 次插入10 次删除
  1. 1 1
      system/jlib/jargv.cpp
  2. 5 3
      system/jlib/jdebug.cpp
  3. 3 3
      system/jlib/jexcept.cpp
  4. 2 2
      system/jlib/jlog.cpp
  5. 1 1
      system/jlib/jstring.hpp

+ 1 - 1
system/jlib/jargv.cpp

@@ -56,7 +56,7 @@ bool processArgvFilenamesFromFile(IFileArray & filenames, const char * filename)
     {
         if (fgets(buffer, sizeof(buffer), in))
         {
-            unsigned len = strlen(buffer);
+            size_t len = strlen(buffer);
             while (len && !isprint(buffer[len-1]))
                 len--;
             buffer[len] = 0;

+ 5 - 3
system/jlib/jdebug.cpp

@@ -287,6 +287,7 @@ cycle_t nanosec_to_cycle(__int64 ns)
     return (__int64)((double)ns / cycleToNanoScale);
 }
 
+#if !(defined(INLINE_GET_CYCLES_NOW) && defined(HAS_GOOD_CYCLE_COUNTER))
 cycle_t jlib_decl get_cycles_now()
 {
     if (useRDTSC)
@@ -295,6 +296,7 @@ cycle_t jlib_decl get_cycles_now()
     QueryPerformanceCounter(&temp);
     return temp.QuadPart;
 }
+#endif
 
 double getCycleToNanoScale()
 {
@@ -2785,7 +2787,7 @@ void getHardwareInfo(HardwareInfo &hdwInfo, const char *primDiskPath, const char
 
     MEMORYSTATUS memstatus;
     GlobalMemoryStatus(&memstatus);
-    hdwInfo.totalMemory = memstatus.dwTotalPhys / (1024*1024); // in MB
+    hdwInfo.totalMemory = (unsigned)(memstatus.dwTotalPhys / (1024*1024)); // in MB
 
     ULARGE_INTEGER diskAvailStruct;
     ULARGE_INTEGER diskTotalStruct;
@@ -2903,7 +2905,7 @@ public:
             }
         }
         else if (file&&fgets (ln, sizeof(ln), file)) {
-            unsigned i = strlen(ln);
+            size_t i = strlen(ln);
             while (i&&((ln[i-1]==10)||(ln[i-1]==13)))
                 i--;
             ln[i] = 0;
@@ -3221,7 +3223,7 @@ static int MemoryLeakReportHook(int nRptType,char *szMsg,int  *retVal)
             // this works  better in VS 2008 libraries (which fault in fopen)
             int handle = _open(_logFile, O_RDWR | O_CREAT, _S_IREAD | _S_IWRITE);
             _lseek(handle,0,SEEK_END);
-            _write(handle,szMsg,strlen(szMsg));
+            _write(handle,szMsg,(unsigned)strlen(szMsg));
             _close(handle);
 #else
             FILE *handle = fopen(_logFile, "a");

+ 3 - 3
system/jlib/jexcept.cpp

@@ -635,7 +635,7 @@ static BOOL GetLogicalAddress( PVOID addr, PTSTR szModule, DWORD len, DWORD& sec
     szModule[0] = 0;
     section = 0;
     offset = 0;
-    if ((unsigned)addr<0x10000)
+    if ((unsigned)(memsize_t)addr<0x10000)
         return FALSE;
     
     
@@ -644,7 +644,7 @@ static BOOL GetLogicalAddress( PVOID addr, PTSTR szModule, DWORD len, DWORD& sec
     if ( !VirtualQuery( addr, &mbi, sizeof(mbi) ) )
         return FALSE;
     
-    DWORD hMod = (DWORD)mbi.AllocationBase;
+    memsize_t hMod = (memsize_t)mbi.AllocationBase;
     
     if ( !GetModuleFileName( (HMODULE)hMod, szModule, len ) )
         return FALSE;
@@ -655,7 +655,7 @@ static BOOL GetLogicalAddress( PVOID addr, PTSTR szModule, DWORD len, DWORD& sec
     
     PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION( pNtHdr );
     
-    DWORD rva = (DWORD)addr - hMod; 
+    memsize_t rva = (memsize_t)addr - hMod;
     
     for (unsigned i = 0; i < pNtHdr->FileHeader.NumberOfSections; i++, pSection++ )
     {

+ 2 - 2
system/jlib/jlog.cpp

@@ -2342,8 +2342,8 @@ bool CSysLogEventLogger::win32Report(unsigned eventtype, unsigned category, unsi
             DWORD type = REG_EXPAND_SZ;
             if ((RegQueryValueEx(hk,"EventMessageFile",NULL, &type, NULL, &sizedata)!=0)||!sizedata) {
                 StringAttr str("%SystemRoot%\\System32\\JELOG.dll"); 
-                RegSetValueEx(hk,"EventMessageFile", 0, REG_EXPAND_SZ, (LPBYTE) str.get(), str.length() + 1);
-                RegSetValueEx(hk,"CategoryMessageFile", 0, REG_EXPAND_SZ, (LPBYTE) str.get(), str.length() + 1);
+                RegSetValueEx(hk,"EventMessageFile", 0, REG_EXPAND_SZ, (LPBYTE) str.get(), (DWORD)str.length() + 1);
+                RegSetValueEx(hk,"CategoryMessageFile", 0, REG_EXPAND_SZ, (LPBYTE) str.get(), (DWORD)str.length() + 1);
                 DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE | EVENTLOG_AUDIT_SUCCESS | EVENTLOG_AUDIT_FAILURE; 
                 RegSetValueEx(hk, "TypesSupported", 0, REG_DWORD,  (LPBYTE) &dwData,  sizeof(DWORD));
                 dwData = 16;

+ 1 - 1
system/jlib/jstring.hpp

@@ -300,7 +300,7 @@ public:
     virtual void set(const char *val) { attr.set(val); };
     virtual void clear() { attr.clear(); };
     virtual void setLen(const char *val, unsigned length) { attr.set(val, length); };
-    virtual unsigned length() const { return attr.length(); };
+    virtual unsigned length() const { return (unsigned)attr.length(); };
 
 private:
     StringAttr & attr;