Fixed regression errors for windows
This commit is contained in:
parent
9f68c2083a
commit
05197abf6e
10 changed files with 42 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "ConnectionListener.h"
|
||||
#include "Event.h"
|
||||
#include "Socket.h"
|
||||
#include "common/Socket.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <AccCtrl.h>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#define _CRT_RAND_S
|
||||
#include "service/Controller.h"
|
||||
#include <stdlib.h>
|
||||
#include <map>
|
||||
|
@ -14,6 +15,16 @@
|
|||
#include "common/Strings.h"
|
||||
#include "common/common.h" //debug
|
||||
|
||||
inline int random( unsigned int* seed ){
|
||||
#ifdef _WINDOWS
|
||||
unsigned int randomNumber;
|
||||
rand_s( &randomNumber ); //no seed needed
|
||||
return randomNumber;
|
||||
#else
|
||||
return rand_r( seed );
|
||||
#endif
|
||||
}
|
||||
|
||||
class Controller::PrivateData {
|
||||
public:
|
||||
TelldusCore::EventRef event, updateEvent;
|
||||
|
@ -44,7 +55,7 @@ void Controller::publishData(const std::string &msg) const {
|
|||
|
||||
void Controller::decodePublishData(const std::string &data) const {
|
||||
// Garbange collect?
|
||||
if (rand_r(&d->randSeed) % 1000 == 1) {
|
||||
if (random(&d->randSeed) % 1000 == 1) {
|
||||
time_t t = time(NULL);
|
||||
// Standard associative-container erase idiom
|
||||
for (std::map<std::string, time_t>::iterator it = d->duplicates.begin(); it != d->duplicates.end(); /* no increment */) {
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
#ifndef TELLDUS_CORE_SERVICE_CONTROLLERMESSAGE_H_
|
||||
#define TELLDUS_CORE_SERVICE_CONTROLLERMESSAGE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
class ControllerMessage {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <syslog.h>
|
||||
#elif defined(_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include "service/Strings.h"
|
||||
#include "service/Messages.h"
|
||||
#include "common/Strings.h"
|
||||
#include "Messages.h"
|
||||
#endif
|
||||
|
||||
class Log::PrivateData {
|
||||
|
@ -159,16 +159,16 @@ void Log::message(Log::LogLevel logLevel, const char *format, va_list ap) const
|
|||
|
||||
switch (logLevel) {
|
||||
case Debug:
|
||||
ReportEvent(d->eventSource, EVENTLOG_SUCCESS, NULL, LOG_DEBUG, NULL, 1, 0, reinterpret_cast<LPCWSTR*>(pInsertStrings), NULL);
|
||||
ReportEvent(d->eventSource, EVENTLOG_SUCCESS, NULL, LOG_DEBUG, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL);
|
||||
break;
|
||||
case Notice:
|
||||
ReportEvent(d->eventSource, EVENTLOG_INFORMATION_TYPE, NULL, LOG_NOTICE, NULL, 1, 0, reinterpret_cast<LPCWSTR*>(pInsertStrings), NULL);
|
||||
ReportEvent(d->eventSource, EVENTLOG_INFORMATION_TYPE, NULL, LOG_NOTICE, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL);
|
||||
break;
|
||||
case Warning:
|
||||
ReportEvent(d->eventSource, EVENTLOG_WARNING_TYPE, NULL, LOG_WARNING, NULL, 1, 0, reinterpret_cast<LPCWSTR*>(pInsertStrings), NULL);
|
||||
ReportEvent(d->eventSource, EVENTLOG_WARNING_TYPE, NULL, LOG_WARNING, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL);
|
||||
break;
|
||||
case Error:
|
||||
ReportEvent(d->eventSource, EVENTLOG_ERROR_TYPE, NULL, LOG_ERR, NULL, 1, 0, reinterpret_cast<LPCWSTR*>(pInsertStrings), NULL);
|
||||
ReportEvent(d->eventSource, EVENTLOG_ERROR_TYPE, NULL, LOG_ERR, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
#include "common/Strings.h"
|
||||
#ifdef _WINDOWS
|
||||
#define strtok_r(s,d,p) strtok_s(s,d,p)
|
||||
#endif
|
||||
|
||||
int ProtocolIkea::methods() const {
|
||||
return TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_DIM;
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
#ifndef TELLDUS_CORE_SERVICE_PROTOCOLNEXA_H_
|
||||
#define TELLDUS_CORE_SERVICE_PROTOCOLNEXA_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <string>
|
||||
#include "service/ControllerMessage.h"
|
||||
#include "service/Device.h"
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
//
|
||||
//
|
||||
#include "service/ProtocolSartano.h"
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
//
|
||||
//
|
||||
#include "service/ProtocolWaveman.h"
|
||||
#ifdef _MSC_VER
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
//
|
||||
//
|
||||
#include "service/ProtocolX10.h"
|
||||
#ifdef _MSC_VER
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "Settings.h"
|
||||
#include "Strings.h"
|
||||
#include "common/Strings.h"
|
||||
#include <Windows.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "common.h"
|
||||
#include "common/common.h"
|
||||
|
||||
#include "../client/telldus-core.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue