File ypops-64-build.diff of Package ypops
--- src/ServiceClient.cpp.orig 2007-09-05 12:29:53.000000000 +0700
+++ src/ServiceClient.cpp 2008-05-18 12:03:48.000000000 +0700
@@ -386,10 +386,10 @@
* Purpose : To service a POP3 clients request. This is a thread
* which is spawned by ListenThread()
*******************************************************************/
-UINT ServiceClientThread(void *lpParameter)
+UINT ServiceClientThread(int lpParameter)
{
int retVal = 1;
- SOCKET sock = (reinterpret_cast<SOCKET>(lpParameter));
+ SOCKET sock = lpParameter;
// begin detecting memory leaks
#if defined(YPOPS_DEBUG_MSLEAK) && defined(_DEBUG) && defined(WIN32)
--- src/ServiceClient.h.orig 2006-09-05 00:45:30.000000000 +0700
+++ src/ServiceClient.h 2008-05-18 12:06:14.000000000 +0700
@@ -69,7 +69,7 @@
#include "WebBrowser.h"
UINT ListenThread(void *lpParameter);
-UINT ServiceClientThread(void *lpParameter);
+UINT ServiceClientThread(int lpParameter);
UINT EmailDownloadStatusThread(void *lpParameter);
UINT ProgressThread(void *lpParameter);
--- src/SmtpListener.cpp.orig 2007-09-05 12:29:53.000000000 +0700
+++ src/SmtpListener.cpp 2008-05-18 12:08:12.000000000 +0700
@@ -72,7 +72,7 @@
extern LogFile logFile;
extern YahooSessionCache sessionCache;
-UINT ServiceSmtpClientThread(void *lpParameter);
+UINT ServiceSmtpClientThread(int lpParameter);
class ServiceSmtpClient
{
@@ -239,7 +239,7 @@
}
else
{
- logFile.Write(LOG_ADVANCED,"Got SMTP request on socket %d\n", (int)socket);
+ logFile.Write(LOG_ADVANCED,"Got SMTP request on socket %d\n", (int)sockfd);
#ifdef WIN32
::AfxBeginThread(ServiceSmtpClientThread, (LPVOID)sockfd);
#else
@@ -267,10 +267,10 @@
* Purpose : To service a SMTP clients request. This is a thread
* which is spawned by SmtpListenThread()
*******************************************************************/
-UINT ServiceSmtpClientThread(void *lpParameter)
+UINT ServiceSmtpClientThread(int lpParameter)
{
int retVal;
- SOCKET sock = (reinterpret_cast<SOCKET>(lpParameter));
+ SOCKET sock = lpParameter;
{
ServiceSmtpClient service(sock);
--- src/LogFile.h.orig 2005-03-19 16:50:21.000000000 +0700
+++ src/LogFile.h 2008-05-18 13:00:33.000000000 +0700
@@ -62,6 +62,7 @@
void Write(const LOGTYPE logtype, const char *format, ...);
LogFile(const CStdString &filename = "ypops.log");
virtual ~LogFile();
+ CStringEx GetLogDir();
protected:
void Trim();
--- src/LogFile.cpp.orig 2007-08-31 13:59:05.000000000 +0700
+++ src/LogFile.cpp 2008-05-18 13:12:06.000000000 +0700
@@ -54,10 +54,11 @@
#include <time.h>
extern CDataHolder settings;
+extern const char * logdirenv;
LogFile::LogFile(const CStdString &filename)
{
- m_strLogFile.Format("%s/%s", logdirenv ? logdirenv : DEFLOGDIR, LPCSTR(filename));
+ m_strLogFile.Format("%s/%s", LPCSTR(GetLogDir()), LPCSTR(filename));
fp = fopen(m_strLogFile, "a");
if(fp == NULL)
@@ -107,11 +108,10 @@
CStdString str;
char strTime[80];
- if (fp == NULL)
- goto write_exit; // Log file has been disabled
-
- va_list list;
- va_start(list, format);
+ if (fp != NULL){
+
+ va_list list;
+ va_start(list, format);
#ifdef WIN32
char strDate[80];
@@ -143,7 +143,7 @@
m_nFileSize += str.length();
if(logtype == LOG_BASIC ||
- logtype <= settings.m_nLogLevel)
+ (logtype == LOG_ADVANCED && settings.m_nLogLevel == LOG_ADVANCED))
{
fprintf(fp, "%s", str.c_str());
}
@@ -156,7 +156,7 @@
Trim();
}
-write_exit:
+ }
#ifdef WIN32
lock.Unlock();
#else
@@ -177,3 +177,21 @@
m_nFileSize = 0;
}
+CStringEx LogFile::GetLogDir()
+{
+ CStringEx logdir = logdirenv ? logdirenv : DEFLOGDIR;
+#ifdef WIN32
+ if (logdir.Compare(".") == 0)
+ {
+ // Get the current working directory:
+ char wdir[_MAX_PATH];
+
+ if (getcwd(wdir, _MAX_PATH-1) != NULL)
+ {
+ wdir[_MAX_PATH] = '\0';
+ logdir = CStringEx(wdir);
+ }
+ }
+#endif
+ return logdir;
+}