File suse.patch of Package guymager

Index: util.h
===================================================================
--- util.h	(revision 1063)
+++ util.h	(working copy)
@@ -32,14 +32,16 @@
 void *UtilMemAlloc (size_t Size, const char *pFile, int Line);
 void  UtilMemFree  (void *pMem , const char *pFile, int Line);
 
+#define UTIL_MEM_ALLOC(Size) UtilMemAlloc (Size, __FILE__, __LINE__)
+#define UTIL_MEM_FREE(pMem)  UtilMemFree  (pMem, __FILE__, __LINE__)
+
 int          UtilCalcDecimals (t_uint64 Value);
 bool         UtilIsZero       (unsigned char *pData, unsigned int DataLen);
 unsigned int UtilGetMaxZcompressedBufferSize (unsigned int UncompressedBufferSize);
 
-#define UTIL_MEM_ALLOC(Size) UtilMemAlloc (Size, __FILE__, __LINE__)
-#define UTIL_MEM_FREE(pMem)  UtilMemFree  (pMem, __FILE__, __LINE__)
+unsigned long long UtilGetInstalledRAM (void); // Number of bytes
+unsigned int       UtilGetNumberOfCPUs (void);
 
-
 APIRET UtilInit   (void);
 APIRET UtilDeInit (void);
 
Index: guymager.pro
===================================================================
--- guymager.pro	(revision 1063)
+++ guymager.pro	(working copy)
@@ -156,7 +156,7 @@
 fastasm.commands = g++ -c $$FAST_ASM_CXXFLAGS ${QMAKE_FILE_IN} -o  ${QMAKE_FILE_BASE}.o 2>&1 | grep -vE \"matching constraint does not allow a register|In function |At global scope:\"  | cat
 QMAKE_EXTRA_COMPILERS += fastasm
 
-LIBS += -lproc
+#LIBS += -lproc
 #LIBS += -lewf
 #LIBS += -lguytools
 LIBS += /usr/lib/libewf.a
@@ -167,7 +167,7 @@
 #xou may use any of the 3 following line for the libssl hash functions
 #LIBS += -lssl  # See also macro definitions in common.h
 #LIBS += -lcrypto  # See also macro definitions in common.h
-LIBS += /usr/lib/libcrypto.a
+LIBS += /usr/lib64/libcrypto.a
 
 
 TRANSLATIONS  = guymager_en.ts
@@ -176,3 +176,4 @@
 TRANSLATIONS += guymager_it.ts
 TRANSLATIONS += guymager_nl.ts
 TRANSLATIONS += guymager_cn.ts
+
Index: config.cpp
===================================================================
--- config.cpp	(revision 1063)
+++ config.cpp	(working copy)
@@ -29,7 +29,7 @@
 #include "common.h"
 
 #include <limits.h>
-#include "proc/sysinfo.h"  // Required in order to get smp_num_cpus for finding out the number of CPUs in the system
+//#include "proc/sysinfo.h"  // Required in order to get smp_num_cpus for finding out the number of CPUs in the system
 
 #include <qcolor.h>
 #include <qfont.h>
@@ -41,6 +41,7 @@
 #include "file.h"
 
 #include "qtutil.h"
+#include "util.h"
 #include "config.h"
 
 // ------------------------------------
@@ -58,7 +59,7 @@
 
 static const unsigned char CONFIG_DUMMY_FILL = 0xAA;
 
-static const int CFG_MAX_COMPRESSIONTHREADS = 16;
+static const uint CFG_MAX_COMPRESSIONTHREADS = 16;
 
 // ------------------------------------
 //          Type definitions
@@ -594,16 +595,19 @@
 
 APIRET CfgIniCPUs (t_pToolCfgParamDesc pCfgParamDesc, t_pchar *ppErrorText)
 {
-   t_pcchar pParamName;
+   t_pcchar     pParamName;
+   unsigned int  CPUs;
 
    *ppErrorText = NULL;
    pParamName = pCfgParamDesc->DataDesc.pName;
 
    if (CONFIG (CompressionThreads) == CONFIG_COMPRESSIONTHREADS_AUTO)
    {
-      LOG_INFO ("Parameter %s set to AUTO; %ld CPUs detected", pParamName, smp_num_cpus)
-      CONFIG (CompressionThreads) = smp_num_cpus;
-      if (smp_num_cpus > CFG_MAX_COMPRESSIONTHREADS)
+//      CPUs = smp_num_cpus;
+      CPUs = UtilGetNumberOfCPUs();
+      LOG_INFO ("Parameter %s set to AUTO; %u CPUs detected", pParamName, CPUs)
+      CONFIG (CompressionThreads) = CPUs;
+      if (CPUs > CFG_MAX_COMPRESSIONTHREADS)
       {
          CONFIG (CompressionThreads) = CFG_MAX_COMPRESSIONTHREADS;
          LOG_INFO ("Maximum value for %s is %d", pParamName, CFG_MAX_COMPRESSIONTHREADS)
@@ -616,17 +620,22 @@
 
 APIRET CfgIniMem (t_pToolCfgParamDesc pCfgParamDesc, t_pchar *ppErrorText)
 {
-   t_pcchar pParamName;
+   t_pcchar           pParamName;
+   unsigned long long  Bytes;
 
    *ppErrorText = NULL;
    pParamName = pCfgParamDesc->DataDesc.pName;
 
-   meminfo();
+//   meminfo();
+//   Bytes = kb_main_total * 1024;
+
+   Bytes = UtilGetInstalledRAM ();
+
    if (CONFIG (FifoMaxMem) == 0)
    {
-      CONFIG (FifoMaxMem) = GETMAX (1, (int)(kb_main_total / (8*1024)));   // Use one eighth of the available mem, convert KB to MB
-      CONFIG (FifoMaxMem) = GETMIN (CONFIG (FifoMaxMem), 64);              // Stay below 64MB
-      LOG_INFO ("Parameter %s set to 0 (auto); %lu MB of RAM detected.", pParamName, kb_main_total/1024)
+      CONFIG (FifoMaxMem) = GETMAX (1, (int)(Bytes / (8*1024*1024)));   // Use one eighth of the available mem, convert to MB
+      CONFIG (FifoMaxMem) = GETMIN (CONFIG (FifoMaxMem), 64);       // Stay below 64MB
+      LOG_INFO ("Parameter %s set to 0 (auto); %0.1f MB of RAM detected.", pParamName, Bytes/(1024.0*1024.0));
       LOG_INFO ("Setting %s to %d (i.e. using %d MB per acquisition as FIFO memory)", pParamName, CONFIG (FifoMaxMem), CONFIG (FifoMaxMem))
    }
 
Index: util.cpp
===================================================================
--- util.cpp	(revision 1063)
+++ util.cpp	(working copy)
@@ -109,6 +109,42 @@
 }
 
 
+unsigned long long UtilGetInstalledRAM (void)
+{
+   unsigned long long Bytes;
+   int                Pages, PageSize;
+
+   Pages    = sysconf(_SC_PHYS_PAGES);
+   PageSize = sysconf(_SC_PAGESIZE);
+
+   if ((Pages < 0) || (PageSize < 0))
+   {
+      LOG_ERROR ("Amount of instlled RAM could not be determined, assume 256MB");
+      Bytes = 256*1024*1024;
+   }
+   else
+   {
+      Bytes = (unsigned long long) sysconf(_SC_PHYS_PAGES) * 
+              (unsigned long long) sysconf(_SC_PAGESIZE  );
+   }
+
+   return Bytes;
+}
+
+unsigned int UtilGetNumberOfCPUs (void)
+{
+   int ret;
+
+   ret = sysconf( _SC_NPROCESSORS_ONLN );
+   if (ret<0)
+   {
+      LOG_ERROR ("Number of CPUs could not be determined, assume 1 CPU");
+      ret = 1;
+   }
+   return (unsigned int) ret;
+}
+
+
 APIRET UtilInit (void)
 {   
    int MaxFifoBockSize;
Index: main.cpp
===================================================================
--- main.cpp	(revision 1063)
+++ main.cpp	(working copy)
@@ -33,7 +33,7 @@
 #include <signal.h>
 #include <locale.h>
 #include <pwd.h>
-#include "proc/sysinfo.h"  // Required in order to get the amount of memory installed
+// #include "proc/sysinfo.h"  // Required in order to get the amount of memory installed
 
 #include <QApplication>
 #include <QtGui>
@@ -274,8 +274,10 @@
    pLibEwfVersionInstalled = (const char *) libewf_get_version();
    LOG_INFO ("Libguytools version installed on this PC: %s", pLibGuyToolsVersionInstalled)
    LOG_INFO ("Libewf      version installed on this PC: %s", pLibEwfVersionInstalled)
-   meminfo();
-   LOG_INFO ("Total amount of memory installed: %lu KB", kb_main_total)
+
+
+   unsigned long long Bytes = UtilGetInstalledRAM ();
+   LOG_INFO ("Total amount of memory installed: %0.1f MB", Bytes/(1024.0*1024.0))
    
 //   pLibEwfVersionCompiled = LIBEWF_VERSION_STRING;
 //