Minor cleanups

* Fixed use of ssize_t in zmq_msg_t class
* Corrected error after merge, old reference to inner_fctname (broke build)
This commit is contained in:
Pieter Hintjens 2012-02-16 15:55:18 -06:00
parent a457be315b
commit ccdb7a6305
4 changed files with 16 additions and 10 deletions

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ tests/test_sub_forward
tests/test_invalid_rep tests/test_invalid_rep
tests/test_msg_flags tests/test_msg_flags
tests/test_ts_context tests/test_ts_context
tests/test_connect_resolve
src/platform.hpp* src/platform.hpp*
src/stamp-h1 src/stamp-h1
perf/local_lat perf/local_lat

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o. Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ. This file is part of 0MQ.
@ -202,7 +202,7 @@ void *zmq::msg_t::data ()
} }
} }
size_t zmq::msg_t::size () ssize_t zmq::msg_t::size ()
{ {
// Check the validity of the message. // Check the validity of the message.
zmq_assert (check ()); zmq_assert (check ());

View File

@ -24,6 +24,7 @@
#define __ZMQ_MSG_HPP_INCLUDE__ #define __ZMQ_MSG_HPP_INCLUDE__
#include <stddef.h> #include <stddef.h>
#include <stdio.h>
#include "config.hpp" #include "config.hpp"
#include "atomic_counter.hpp" #include "atomic_counter.hpp"
@ -64,7 +65,7 @@ namespace zmq
int move (msg_t &src_); int move (msg_t &src_);
int copy (msg_t &src_); int copy (msg_t &src_);
void *data (); void *data ();
size_t size (); ssize_t size ();
unsigned char flags (); unsigned char flags ();
void set_flags (unsigned char flags_); void set_flags (unsigned char flags_);
void reset_flags (unsigned char flags_); void reset_flags (unsigned char flags_);
@ -95,7 +96,7 @@ namespace zmq
struct content_t struct content_t
{ {
void *data; void *data;
size_t size; ssize_t size;
msg_free_fn *ffn; msg_free_fn *ffn;
void *hint; void *hint;
zmq::atomic_counter_t refcnt; zmq::atomic_counter_t refcnt;

View File

@ -535,9 +535,11 @@ int zmq_msg_send (zmq_msg_t *msg_, void *s_, int flags_)
return -1; return -1;
} }
zmq::socket_base_t *s = (zmq::socket_base_t *) s_; zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
if(s->thread_safe()) s->lock(); if (s->thread_safe())
int result = inner_sendmsg (s, msg_, flags_); s->lock();
if(s->thread_safe()) s->unlock(); int result = s_sendmsg (s, msg_, flags_);
if (s->thread_safe())
s->unlock();
return result; return result;
} }
@ -548,9 +550,11 @@ int zmq_msg_recv (zmq_msg_t *msg_, void *s_, int flags_)
return -1; return -1;
} }
zmq::socket_base_t *s = (zmq::socket_base_t *) s_; zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
if(s->thread_safe()) s->lock(); if (s->thread_safe())
int result = inner_recvmsg(s, msg_, flags_); s->lock();
if(s->thread_safe()) s->unlock(); int result = s_recvmsg (s, msg_, flags_);
if (s->thread_safe())
s->unlock();
return result; return result;
} }