[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/soprano
From:       Andreas Holzammer <andy () kdab ! com>
Date:       2010-04-28 7:00:41
Message-ID: 20100428070041.E3217AC8A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1120014 by aholzammer:

- soprano prepared for wince

 M  +4 -0      server/CMakeLists.txt  
 M  +26 -0     server/lockfile.cpp  
 M  +9 -0      server/randomgenerator.cpp  
 M  +2 -0      server/sopranod.cpp  
 M  +1 -1      soprano/qhashqurlcompat.cpp  
 M  +4 -0      tools/sopranocmd.cpp  


--- trunk/kdesupport/soprano/server/CMakeLists.txt #1120013:1120014
@@ -57,6 +57,10 @@
 
 add_executable(sopranod sopranod.cpp sopranodcore.cpp lockfile.cpp)
 
+if(WINCE)
+    target_link_libraries(sopranod Coredll)
+endif(WINCE)
+
 set_target_properties(sopranoserver PROPERTIES
   VERSION 1.2.0
   SOVERSION 1
--- trunk/kdesupport/soprano/server/lockfile.cpp #1120013:1120014
@@ -12,6 +12,7 @@
 
 #include "lockfile.h"
 
+#ifndef _WIN32_WCE
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -24,6 +25,10 @@
 
 #include <string.h>
 #include <errno.h>
+#else
+#include <Winbase.h>
+#include <atlbase.h>
+#endif
 
 #include <QtCore/QFile>
 #include <QtCore/QDebug>
@@ -84,9 +89,26 @@
         f.setPermissions( f.permissions() | QFile::WriteOwner );
     }
 
+#ifndef _WIN32_WCE
     d->fd = open( QFile::encodeName( d->path ).data(), O_WRONLY|O_CREAT, 0600 );
+#else
+    CA2W wpath( QFile::encodeName( d->path ).data() );
+    d->fd = reinterpret_cast<int>(CreateFile( wpath, GENERIC_WRITE, 0, NULL, \
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL )); +#endif
     if ( d->fd == -1 ) {
+#ifndef _WIN32_WCE
         qDebug() << "(LockFile) could not open" << d->path << QString( "(%1)" ).arg( \
strerror( errno ) ); +#else
+        char *msg;
+
+        FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      FORMAT_MESSAGE_IGNORE_INSERTS |
+                      FORMAT_MESSAGE_FROM_SYSTEM,
+                      NULL, GetLastError(), 0,
+                      (LPWSTR) &msg, 0, NULL);
+                      
+        qDebug() << "(LockFile) could not open" << d->path << QString( "(%1)" ).arg( \
msg ); +#endif
         return false;
     }
     // flock isn't defined under windows
@@ -115,7 +137,11 @@
 void LockFile::releaseLock()
 {
     if ( d->fd > 0 ) {
+#ifndef _WIN32_WCE
         close( d->fd );
+#else
+        CloseHandle( reinterpret_cast<HANDLE>(d->fd ));
+#endif
     }
     d->fd = -1;
 }
--- trunk/kdesupport/soprano/server/randomgenerator.cpp #1120013:1120014
@@ -25,14 +25,23 @@
 #include <QtCore/QObject>
 
 #include <stdlib.h>
+#ifndef _WIN32_WCE
 #include <time.h>
+#endif
 
+#ifdef _WIN32_WCE
+    #include <winbase.h>
+#endif
 
 Q_GLOBAL_STATIC( Soprano::RandomGenerator, s_randomGenerator )
 
 Soprano::RandomGenerator::RandomGenerator()
 {
+    #ifndef _WIN32_WCE
     srand( time(0) );
+    #else
+        srand( GetTickCount() );
+    #endif
 }
 
 
--- trunk/kdesupport/soprano/server/sopranod.cpp #1120013:1120014
@@ -27,7 +27,9 @@
 #include <QtCore/QFile>
 #include <QtCore/QDir>
 
+#ifndef Q_OS_WIN
 #include <signal.h>
+#endif
 
 
 namespace {
--- trunk/kdesupport/soprano/soprano/qhashqurlcompat.cpp #1120013:1120014
@@ -46,7 +46,7 @@
     uint soprano_qHash_QUrl(const QUrl &);
 }
 
-#if !(defined(Q_OS_MACX) && QT_VERSION >= 0x040700)
+#if !((defined(Q_OS_MACX) || defined(_WIN32) ) && QT_VERSION >= 0x040700)
 uint qHash(const QUrl &url)
 {
     return Soprano::soprano_qHash_QUrl(url);
--- trunk/kdesupport/soprano/tools/sopranocmd.cpp #1120013:1120014
@@ -55,7 +55,11 @@
 #endif
 #include "../client/sparql/sparqlmodel.h"
 
+#ifndef _WIN32_WCE
 #include <signal.h>
+#else
+#include <wcecompat/signal.h>
+#endif
 
 using namespace Soprano;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic