summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-23 17:05:41 (UTC)
committer zautrix <zautrix>2004-10-23 17:05:41 (UTC)
commit13d274c37baaae48a1c93081077cf3035459c6a8 (patch) (side-by-side diff)
treecf49d1c5bec1fb4cd8bbd7fc9a007304634676a8
parentfbdad188bd7048148cc60c90325efcccb0417060 (diff)
downloadkdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.zip
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.gz
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.bz2
made pwm compile on windows. now the cryptolibs are still missing
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/blowfish.h11
-rw-r--r--pwmanager/pwmanager/gpasmanfile.cpp16
-rw-r--r--pwmanager/pwmanager/htmlgen.cpp2
-rw-r--r--pwmanager/pwmanager/ipc.cpp7
-rw-r--r--pwmanager/pwmanager/ipc.h5
-rw-r--r--pwmanager/pwmanager/libgcryptif.h7
-rw-r--r--pwmanager/pwmanager/pwm.cpp1
-rw-r--r--pwmanager/pwmanager/pwmanager.pro2
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp9
-rw-r--r--pwmanager/pwmanager/spinforsignal.h2
10 files changed, 50 insertions, 12 deletions
diff --git a/pwmanager/pwmanager/blowfish.h b/pwmanager/pwmanager/blowfish.h
index c05de77..5129eab 100644
--- a/pwmanager/pwmanager/blowfish.h
+++ b/pwmanager/pwmanager/blowfish.h
@@ -21,22 +21,31 @@
**************************************************************************/
#ifndef BLOWFISH_H
#define BLOWFISH_H
#include "pwmexception.h"
-
+#ifndef _WIN32_
#include <stdint.h>
+#else
+
+#endif
#include <string>
using std::string;
#define BLOWFISH_BLOCKSIZE 8
#define BLOWFISH_ROUNDS 16
#define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */
+#ifndef _WIN32_
typedef uint8_t byte;
+#else
+#define uint8_t Q_UINT8
+#define byte Q_UINT8
+#define uint32_t Q_UINT32
+#endif
/** blowfish encryption algorithm.
* Derived from libgcrypt-1.1.12
*/
class Blowfish
{
diff --git a/pwmanager/pwmanager/gpasmanfile.cpp b/pwmanager/pwmanager/gpasmanfile.cpp
index f80bc13..ae34c83 100644
--- a/pwmanager/pwmanager/gpasmanfile.cpp
+++ b/pwmanager/pwmanager/gpasmanfile.cpp
@@ -41,13 +41,20 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
+#ifndef _WIN32_
#include <unistd.h>
+#else
+#include <io.h>
+#define S_IRUSR _S_IREAD
+#define S_IWUSR _S_IWRITE
+#define creat _creat
+#endif
#include <string.h>
#include <errno.h>
#include "gpasmanfile.h"
#include "globalstuff.h"
@@ -59,18 +66,21 @@
#endif
// enable/disable debug output
//#define GPASMANFILE_DEBUG
#undef GPASMANFILE_DEBUG
-
+#ifndef _WIN32_
#if defined(PWM_DEBUG) && defined(GPASMANFILE_DEBUG)
# define DBG(msg,x...) do { fprintf(stderr, msg "\n" , ##x); } while (0)
#else
# define DBG(msg,x...) do { } while (0)
#endif
+#else
+# define DBG
+#endif
#ifdef BIG_ENDIAN_HOST
# define WORDS_BIGENDIAN
#else
# undef WORDS_BIGENDIAN
#endif
@@ -407,21 +417,21 @@ int GpasmanFile::check_file(const char *filename)
if (((naamstat.st_mode & S_IAMB) | (S_IRUSR | S_IWUSR)) != (S_IRUSR |
S_IWUSR)) {
DBG("%s perms are bad, they are: %ld, should be -rw------",
filename, (naamstat.st_mode & (S_IREAD | S_IWRITE)));
return (-1);
}
-
+#ifndef _WIN32_
if (!S_ISREG(naamstat.st_mode)) {
lstat(filename, &naamstat);
if (S_ISLNK(naamstat.st_mode)) {
DBG("%s is a symlink", filename);
return (-2);
}
}
-
+#endif
return (1);
}
int GpasmanFile::file_exists(const char *tfile)
{
struct stat naamstat;
diff --git a/pwmanager/pwmanager/htmlgen.cpp b/pwmanager/pwmanager/htmlgen.cpp
index 166b987..bee8198 100644
--- a/pwmanager/pwmanager/htmlgen.cpp
+++ b/pwmanager/pwmanager/htmlgen.cpp
@@ -57,13 +57,13 @@ HtmlGen::~HtmlGen()
QString HtmlGen::escapeHtmlText(const QString &str)
{
QString ret;
unsigned int len = str.length(), i;
char c;
for (i = 0; i < len; ++i) {
- c = str[i];
+ c = str.at(i);
switch (c) {
case '<':
ret.append("&lt;");
break;
case '>':
ret.append("&gt;");
diff --git a/pwmanager/pwmanager/ipc.cpp b/pwmanager/pwmanager/ipc.cpp
index b1d2c68..643b022 100644
--- a/pwmanager/pwmanager/ipc.cpp
+++ b/pwmanager/pwmanager/ipc.cpp
@@ -18,15 +18,15 @@
**************************************************************************/
#include "ipc.h"
#include "pwmexception.h"
#include <qsocketnotifier.h>
-
+#ifndef _WIN32_
#include <sys/socket.h>
-
+#endif
#ifndef PWM_EMBEDDED
#include <sys/types.h>
#include <stdio.h>
#else
#include <qsocket.h>
#endif
@@ -69,16 +69,17 @@ Ipc::Ipc()
}
#else
Ipc::Ipc()
: notifier (0)
, rdBuf (0)
{
+#ifndef _WIN32_
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
qDebug("Ipc: socketpair() failed");
}
-
+#endif
QSocket* qsock = new QSocket();
qsock->setSocket(sock[0]);
rdBufSize = INIT_LINEBUF_LEN;
rdBuf = (char *)(malloc(rdBufSize));
if (!rdBuf) {
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h
index e5a496d..7bfca02 100644
--- a/pwmanager/pwmanager/ipc.h
+++ b/pwmanager/pwmanager/ipc.h
@@ -18,14 +18,17 @@
**************************************************************************/
#ifndef __PWM_IPC_H
#define __PWM_IPC_H
#include <qobject.h>
+#ifndef _WIN32_
#include <unistd.h>
-
+#else
+#include <io.h>
+#endif
#ifndef PWM_EMBEDDED
#include <stdio.h>
#else
#include <qsocket.h>
#endif
diff --git a/pwmanager/pwmanager/libgcryptif.h b/pwmanager/pwmanager/libgcryptif.h
index dffd55b..1a7b658 100644
--- a/pwmanager/pwmanager/libgcryptif.h
+++ b/pwmanager/pwmanager/libgcryptif.h
@@ -28,14 +28,19 @@
//#undef CONFIG_PWMANAGER_GCRY // for debugging only.
#ifdef CONFIG_PWMANAGER_GCRY
#include <stddef.h>
#include <sys/types.h>
+#ifndef _WIN32_
#include <stdint.h>
-
+#else
+#define uint8_t Q_UINT8
+#define byte Q_UINT8
+#define uint32_t Q_UINT32
+#endif
#define STRING2KEY_SALTLEN 8
/** interface class for the libgcrypt cipher and hash algorithms
* NOTE: Always allocate 1024 extra bytes for the inBuf (for padding)
*/
class LibGCryptIf
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index d92c90d..1ab2b71 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1407,12 +1407,13 @@ void PwM::syncHowTo_slot()
void PwM::createAboutData_slot()
{
QString version;
#include <../version>
+;
QMessageBox::about( this, "About PwManager/Pi",
"PwManager/Platform-independent\n"
"(PWM/Pi) " +version + " - " +
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro
index 80b2519..fbc0554 100644
--- a/pwmanager/pwmanager/pwmanager.pro
+++ b/pwmanager/pwmanager/pwmanager.pro
@@ -1,13 +1,13 @@
TEMPLATE = app
CONFIG += qt warn_off
DESTDIR= ../../bin
TARGET = pwmpi
include( ../../variables.pri )
-INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils
+INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib
DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION
#enable this setting if you want debugoutput for pwmanager
#DEFINES += CONFIG_DEBUG
LIBS += -L../libcrypt/
LIBS += -L../../bin/
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 86b6273..129bf7b 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -52,15 +52,16 @@
#include <errno.h>
#include <string.h>
//US#include <iostream>
#include <algorithm>
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef _WIN32_
#include <unistd.h>
#include <stdint.h>
-
+#endif
#ifdef PWM_EMBEDDED
#ifndef Q_LONG
#define Q_LONG long
#endif
@@ -502,16 +503,18 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
f.close();
ret = e_enc;
goto out_moveback;
}
unsetDocStatFlag(DOC_STAT_DISK_DIRTY);
f.close();
+#ifndef _WIN32_
if (chmod(filename.latin1(),
conf()->confGlobFilePermissions())) {
printWarn(string("chmod failed: ") + strerror(errno));
}
+#endif
openDocList.edit(this, getTitle().latin1());
if (wasDeepLocked) {
/* Do _not_ save the data with the deepLock()
* call, because this will recurse
* into saveDoc()
*/
@@ -2215,16 +2218,18 @@ bool PwMDoc::execLauncher(const QString &category, unsigned int entryIndex)
return execLauncher(cat, entryIndex);
}
bool PwMDoc::execLauncher(unsigned int category, unsigned int entryIndex)
{
+#ifndef _WIN32_
if (geteuid() == 0) {
rootAlertMsgBox();
return false;
}
+#endif
QString command(dti.dta[category].d[entryIndex].launcher.c_str());
bool wasLocked = isLocked(category, entryIndex);
if (command.find("$p") != -1) {
/* the user requested the password to be included
* into the command. We have to ask for the password,
@@ -2267,16 +2272,18 @@ bool PwMDoc::goToURL(const QString &category, unsigned int entryIndex)
return goToURL(cat, entryIndex);
}
bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex)
{
+#ifndef _WIN32_
if (geteuid() == 0) {
rootAlertMsgBox();
return false;
}
+#endif
QString url(dti.dta[category].d[entryIndex].url.c_str());
if (url.isEmpty())
return false;
QString customBrowser(conf()->confGlobBrowserCommand());
if (!customBrowser.isEmpty()) {
diff --git a/pwmanager/pwmanager/spinforsignal.h b/pwmanager/pwmanager/spinforsignal.h
index ec6103b..f3cabee 100644
--- a/pwmanager/pwmanager/spinforsignal.h
+++ b/pwmanager/pwmanager/spinforsignal.h
@@ -19,13 +19,15 @@
#ifndef SPINFORSIGNAL_H
#define SPINFORSIGNAL_H
#include <qobject.h>
+#ifndef _WIN32_
#include <stdint.h>
+#endif
#include <string>
using std::string;
/** non-ui-blocking spin for a QT-signal */
class SpinForSignal : public QObject
{