Commit 2ae61183 authored by Ghislain MARY's avatar Ghislain MARY

Fix build on Win64.

parent 7850ea2c
......@@ -463,7 +463,7 @@ linphonec_command_generator(const char *text, int state)
{
index=0;
adv=0;
len=strlen(text);
len=(int)strlen(text);
}
/*
* Return the next name which partially matches
......@@ -784,7 +784,7 @@ static int
lpc_cmd_answer(LinphoneCore *lc, char *args){
if (!args)
{
int nb=bctbx_list_size(linphone_core_get_calls(lc));
int nb=(int)bctbx_list_size(linphone_core_get_calls(lc));
if (nb==1){
//if just one call is present answer the only one in passing NULL to the linphone_core_accept_call ...
if ( -1 == linphone_core_accept_call(lc, NULL) )
......@@ -1485,7 +1485,7 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
else
{
const bctbx_list_t *calls = linphone_core_get_calls(lc);
int nbcalls=bctbx_list_size(calls);
int nbcalls=(int)bctbx_list_size(calls);
if( nbcalls == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
......@@ -2491,7 +2491,7 @@ static void lpc_display_call_states(LinphoneCore *lc){
tmp=linphone_call_get_remote_address_as_string (call);
flag=in_conference ? "conferencing" : "";
flag=linphone_call_has_transfer_pending(call) ? "transfer pending" : flag;
linphonec_out("%-2i | %-35s | %-15s | %s\n",(int)(long)linphone_call_get_user_pointer(call),
linphonec_out("%-2i | %-35s | %-15s | %s\n",VOIDPTR_TO_INT(linphone_call_get_user_pointer(call)),
tmp,linphone_call_state_to_string(linphone_call_get_state(call))+strlen("LinphoneCall"),flag);
ms_free(tmp);
}
......
......@@ -174,16 +174,16 @@ bool_t linphonec_camera_enabled=TRUE;
void linphonec_call_identify(LinphoneCall* call){
static long callid=1;
linphone_call_set_user_pointer (call,(void*)callid);
static int callid=1;
linphone_call_set_user_pointer (call,INT_TO_VOIDPTR(callid));
callid++;
}
LinphoneCall *linphonec_get_call(long id){
LinphoneCall *linphonec_get_call(int id){
const MSList *elem=linphone_core_get_calls(linphonec);
for (;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_call_get_user_pointer (call)==(void*)id){
if (VOIDPTR_TO_INT(linphone_call_get_user_pointer(call))==id){
return call;
}
}
......@@ -278,8 +278,8 @@ linphonec_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneC
{
char *remote=linphone_call_get_remote_address_as_string(call);
if (new_call_state==LinphoneCallConnected){
linphonec_out("The distant endpoint %s of call %li has been transfered, you can safely close the call.\n",
remote,(long)linphone_call_get_user_pointer (call));
linphonec_out("The distant endpoint %s of call %i has been transfered, you can safely close the call.\n",
remote,VOIDPTR_TO_INT(linphone_call_get_user_pointer(call)));
}
ms_free(remote);
}
......@@ -322,7 +322,7 @@ static void linphonec_call_updated(LinphoneCall *call){
}
static void linphonec_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t encrypted, const char *auth_token) {
long id=(long)linphone_call_get_user_pointer (call);
int id=VOIDPTR_TO_INT(linphone_call_get_user_pointer(call));
if (!encrypted) {
linphonec_out("Call %i is not fully encrypted and auth token is %s.\n", id,
(auth_token != NULL) ? auth_token : "absent");
......@@ -334,7 +334,7 @@ static void linphonec_call_encryption_changed(LinphoneCore *lc, LinphoneCall *ca
static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
char *from=linphone_call_get_remote_address_as_string(call);
long id=(long)linphone_call_get_user_pointer (call);
int id=VOIDPTR_TO_INT(linphone_call_get_user_pointer(call));
switch(st){
case LinphoneCallEnd:
linphonec_out("Call %i with %s ended (%s).\n", id, from, linphone_reason_to_string(linphone_call_get_reason(call)));
......@@ -357,7 +357,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
case LinphoneCallIncomingReceived:
linphonec_call_identify(call);
linphone_call_enable_camera (call,linphonec_camera_enabled);
id=(long)linphone_call_get_user_pointer (call);
id=VOIDPTR_TO_INT(linphone_call_get_user_pointer(call));
linphonec_set_caller(from);
linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id);
if ( auto_answer) {
......@@ -373,7 +373,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
break;
case LinphoneCallOutgoingInit:
linphonec_call_identify(call);
id=(long)linphone_call_get_user_pointer (call);
id=VOIDPTR_TO_INT(linphone_call_get_user_pointer(call));
linphonec_out("Establishing call id to %s, assigned id %i\n", from,id);
break;
case LinphoneCallUpdatedByRemote:
......@@ -576,7 +576,7 @@ void linphonec_out(const char *fmt,...){
fflush(stdout);
#if !defined(_WIN32_WCE)
if (client_sock!=ORTP_PIPE_INVALID){
if (ortp_pipe_write(client_sock,(uint8_t*)res,strlen(res))==-1){
if (ortp_pipe_write(client_sock,(uint8_t*)res,(int)strlen(res))==-1){
fprintf(stderr,"Fail to send output via pipe: %s",strerror(errno));
}
}
......@@ -1289,7 +1289,7 @@ linphonec_parse_cmdline(int argc, char **argv)
arg_num++;
if (arg_num < argc) {
char *tmp;
window_id = (void *)strtol( argv[arg_num], &tmp, 0 );
window_id = INT_TO_VOIDPTR((int)strtol( argv[arg_num], &tmp, 0 ));
lpc_video_params.wid = window_id;
}
}
......
......@@ -47,6 +47,10 @@
#endif
#undef PARAMS
#define INT_TO_VOIDPTR(i) ((void*)(intptr_t)(i))
#define VOIDPTR_TO_INT(p) ((int)(intptr_t)(p))
/**************************************************************************
*
* Compile-time defines
......@@ -123,7 +127,7 @@ void linphonec_set_autoanswer(bool_t enabled);
bool_t linphonec_get_autoanswer(void);
void linphonec_command_finished(void);
void linphonec_set_caller(const char *caller);
LinphoneCall *linphonec_get_call(long id);
LinphoneCall *linphonec_get_call(int id);
void linphonec_call_identify(LinphoneCall* call);
extern bool_t linphonec_camera_enabled;
......
......@@ -286,7 +286,7 @@ bool_t lp_spawn_command_line_sync(const char *command, char **result,int *comman
if (f!=NULL){
int err;
*result=ms_malloc(4096);
err=fread(*result,1,4096-1,f);
err=(int)fread(*result,1,4096-1,f);
if (err<0){
ms_warning("Error reading command output:%s",strerror(errno));
ms_free(result);
......
......@@ -64,7 +64,7 @@ int main(int argc, char *argv[]){
ReadFile(hin, buf, sizeof(buf), &read, NULL);
if (read > 2) {
buf[read - 2] = '\0'; // Remove ending '\r\n'
if (ortp_pipe_write(fd, (uint8_t *)buf, strlen(buf)) < 0) {
if (ortp_pipe_write(fd, (uint8_t *)buf, (int)strlen(buf)) < 0) {
running = 0;
} else {
read = ortp_pipe_read(fd, (uint8_t *)buf, sizeof(buf));
......
......@@ -83,6 +83,9 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "private.h"
using namespace std;
#define INT_TO_VOIDPTR(i) ((void*)(intptr_t)(i))
#define VOIDPTR_TO_INT(p) ((int)(intptr_t)(p))
#ifndef WIN32
#else
#include <windows.h>
......@@ -340,7 +343,7 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c
listen(mServerFd, 2);
fprintf(stdout, "Server unix socket created, name=%s fd=%i\n", pipe_name, (int)mServerFd);
#else
fprintf(stdout, "Named pipe created, name=%s fd=%i\n", pipe_name, (int)mServerFd);
fprintf(stdout, "Named pipe created, name=%s fd=%p\n", pipe_name, mServerFd);
#endif
}
......@@ -382,9 +385,9 @@ LinphoneSoundDaemon *Daemon::getLSD() {
}
int Daemon::updateCallId(LinphoneCall *call) {
int val = (int) (long) linphone_call_get_user_pointer(call);
int val = VOIDPTR_TO_INT(linphone_call_get_user_pointer(call));
if (val == 0) {
linphone_call_set_user_pointer(call, (void*) (long) ++mCallIds);
linphone_call_set_user_pointer(call, INT_TO_VOIDPTR(++mCallIds));
return mCallIds;
}
return val;
......@@ -394,16 +397,16 @@ LinphoneCall *Daemon::findCall(int id) {
const bctbx_list_t *elem = linphone_core_get_calls(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneCall *call = (LinphoneCall *) elem->data;
if (linphone_call_get_user_pointer(call) == (void*) (long) id)
if (VOIDPTR_TO_INT(linphone_call_get_user_pointer(call)) == id)
return call;
}
return NULL;
}
int Daemon::updateProxyId(LinphoneProxyConfig *cfg) {
int val = (int) (long) linphone_proxy_config_get_user_data(cfg);
int val = VOIDPTR_TO_INT(linphone_proxy_config_get_user_data(cfg));
if (val == 0) {
linphone_proxy_config_set_user_data(cfg, (void*) (long) ++mProxyIds);
linphone_proxy_config_set_user_data(cfg, INT_TO_VOIDPTR(++mProxyIds));
return mProxyIds;
}
return val;
......@@ -413,7 +416,7 @@ LinphoneProxyConfig *Daemon::findProxy(int id) {
const bctbx_list_t *elem = linphone_core_get_proxy_config_list(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneProxyConfig *proxy = (LinphoneProxyConfig *) elem->data;
if (linphone_proxy_config_get_user_data(proxy) == (void*) (long) id)
if (VOIDPTR_TO_INT(linphone_proxy_config_get_user_data(proxy)) == id)
return proxy;
}
return NULL;
......@@ -620,7 +623,7 @@ void Daemon::execCommand(const string &command) {
void Daemon::sendResponse(const Response &resp) {
string buf = resp.toBuf();
if (mChildFd != (ortp_pipe_t)-1) {
if (ortp_pipe_write(mChildFd, (uint8_t *)buf.c_str(), buf.size()) == -1) {
if (ortp_pipe_write(mChildFd, (uint8_t *)buf.c_str(), (int)buf.size()) == -1) {
ms_error("Fail to write to pipe: %s", strerror(errno));
}
} else {
......
......@@ -225,7 +225,7 @@ public:
int updateCallId(LinphoneCall *call);
int updateProxyId(LinphoneProxyConfig *proxy);
inline int maxProxyId() { return mProxyIds; }
inline int maxAuthInfoId() { return bctbx_list_size(linphone_core_get_auth_info_list(mLc)); }
inline int maxAuthInfoId() { return (int)bctbx_list_size(linphone_core_get_auth_info_list(mLc)); }
int updateAudioStreamId(AudioStream *audio_stream);
void dumpCommandsHelp();
void dumpCommandsHelpHtml();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment