Making sure no warnings are printed (except for getenv) on windows.
This commit is contained in:
6
json.cpp
6
json.cpp
@@ -92,7 +92,7 @@ const JSON &JSON::at(unsigned int index) const {
|
||||
|
||||
int JSON::length() const {
|
||||
if( Type == Class::Array )
|
||||
return Internal.List->size();
|
||||
return static_cast<int>(Internal.List->size());
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@@ -105,9 +105,9 @@ bool JSON::hasKey(const std::string &key) const {
|
||||
|
||||
int JSON::size() const {
|
||||
if( Type == Class::Object )
|
||||
return Internal.Map->size();
|
||||
return static_cast<int>(Internal.Map->size());
|
||||
else if( Type == Class::Array )
|
||||
return Internal.List->size();
|
||||
return static_cast<int>(Internal.List->size());
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
BIN
lib/windows-x86_64/rktwebview.lib
Normal file
BIN
lib/windows-x86_64/rktwebview.lib
Normal file
Binary file not shown.
1
main.cpp
1
main.cpp
@@ -63,6 +63,7 @@ static void event_cb(rkt_data_t *data)
|
||||
free_data(data);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *me = argv[0];
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
#define ALIVE_SLOT 4
|
||||
#define ALIVE_ACK_SLOT 5
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -106,12 +110,12 @@ bool runRktWebview(Handle_t *handler)
|
||||
char alive_slot[10];
|
||||
char alive_ack_slot[10];
|
||||
|
||||
sprintf(shm_size_str, "%d", static_cast<int>(handler->shm_size));
|
||||
sprintf(command_slot, "%d", COMMAND_SLOT);
|
||||
sprintf(command_result_slot, "%d", COMMAND_RESULT_SLOT);
|
||||
sprintf(event_slot, "%d", EVENT_SLOT);
|
||||
sprintf(alive_slot, "%d", ALIVE_SLOT);
|
||||
sprintf(alive_ack_slot, "%d", ALIVE_ACK_SLOT);
|
||||
snprintf(shm_size_str, 30, "%d", static_cast<int>(handler->shm_size));
|
||||
snprintf(command_slot, 10, "%d", COMMAND_SLOT);
|
||||
snprintf(command_result_slot, 10, "%d", COMMAND_RESULT_SLOT);
|
||||
snprintf(event_slot, 10, "%d", EVENT_SLOT);
|
||||
snprintf(alive_slot, 10, "%d", ALIVE_SLOT);
|
||||
snprintf(alive_ack_slot, 10, "%d", ALIVE_ACK_SLOT);
|
||||
|
||||
|
||||
// run rktwebview_prg using the environment variable RKT_WEBVIEW_PRG
|
||||
@@ -316,7 +320,7 @@ void rkt_webview_init()
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
DWORD p = GetCurrentProcessId();
|
||||
sprintf(buf, "rktwebview-%ld", p);
|
||||
snprintf(buf, 1024, "rktwebview-%ld", p);
|
||||
#else
|
||||
pid_t p = getpid();
|
||||
sprintf(buf, "rktwebview-%x", p);
|
||||
|
||||
14
shm.cpp
14
shm.cpp
@@ -138,7 +138,7 @@ public:
|
||||
first_i->prev = p_i;
|
||||
}
|
||||
i->prev = SHM_NULL;
|
||||
i->alloc_size = bytes;
|
||||
i->alloc_size = static_cast<int>(bytes);
|
||||
|
||||
*_first = p_i;
|
||||
place = p_i + sizeof(ShmItem);
|
||||
@@ -152,8 +152,8 @@ public:
|
||||
} else {
|
||||
*_used = u;
|
||||
i->prev = SHM_NULL;
|
||||
i->size = bytes;
|
||||
i->alloc_size = bytes;
|
||||
i->size = static_cast<int>(bytes);
|
||||
i->alloc_size = static_cast<int>(bytes);
|
||||
i->next = *_first;
|
||||
if (*_first != SHM_NULL) {
|
||||
ShmItem *first_i;
|
||||
@@ -180,6 +180,7 @@ public:
|
||||
ShmPlace p_i = place - sizeof(ShmItem);
|
||||
ShmItem *i;
|
||||
ref(p_i, &i);
|
||||
if (i == nullptr) return;
|
||||
|
||||
if (i->prev != SHM_NULL) {
|
||||
ShmItem *prev_i;
|
||||
@@ -218,8 +219,9 @@ public:
|
||||
|
||||
public:
|
||||
ShmApiBase(const char *name, size_t size, bool owner) {
|
||||
char *buf = reinterpret_cast<char *>(malloc(strlen(name) + 50));
|
||||
sprintf(buf, "sem_%s", name);
|
||||
size_t buf_size = strlen(name) + 50;
|
||||
char *buf = reinterpret_cast<char *>(malloc(buf_size));
|
||||
snprintf(buf, buf_size, "sem_%s", name);
|
||||
_sem_name = _strdup(buf);
|
||||
_mem_name = _strdup(name);
|
||||
::free(buf);
|
||||
@@ -495,7 +497,7 @@ public:
|
||||
if (_owner) {
|
||||
*_first = SHM_NULL;
|
||||
*_free_list = SHM_NULL;
|
||||
*_used = sizeof(int) + sizeof(ShmItem *) + sizeof(ShmItem *) + slots_size;
|
||||
*_used = static_cast<int>(sizeof(int) + sizeof(ShmItem *) + sizeof(ShmItem *) + slots_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "shmqueue.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define sprintf sprintf_s
|
||||
#endif
|
||||
|
||||
ShmQueue::ShmQueue(Shm *shm, ShmSlot slot, bool owner)
|
||||
{
|
||||
_shm = shm;
|
||||
|
||||
Reference in New Issue
Block a user