Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
3bd8f83f
Commit
3bd8f83f
authored
Sep 22, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
language bindings use zmq_strerror instead of strerror
parent
a0db7f6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
45 deletions
+25
-45
zmq.hpp
bindings/cpp/zmq.hpp
+1
-8
Context.cpp
bindings/java/Context.cpp
+3
-9
Socket.cpp
bindings/java/Socket.cpp
+2
-9
pyzmq.cpp
bindings/python/pyzmq.cpp
+10
-10
rbzmq.cpp
bindings/ruby/rbzmq.cpp
+9
-9
No files found.
bindings/cpp/zmq.hpp
View file @
3bd8f83f
...
@@ -41,14 +41,7 @@ namespace zmq
...
@@ -41,14 +41,7 @@ namespace zmq
virtual
const
char
*
what
()
const
throw
()
virtual
const
char
*
what
()
const
throw
()
{
{
#if defined _MSC_VER
return
zmq_strerror
(
errnum
);
#pragma warning (push)
#pragma warning (disable:4996)
#endif
return
strerror
(
errnum
);
#if defined _MSC_VER
#pragma warning (pop)
#endif
}
}
private
:
private
:
...
...
bindings/java/Context.cpp
View file @
3bd8f83f
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
#include <assert.h>
#include <assert.h>
#include <errno.h>
#include <errno.h>
#include "zmq.h"
#include "../c/zmq.h"
#include "org_zmq_Context.h"
#include "org_zmq_Context.h"
static
jfieldID
ctx_handle_fid
=
NULL
;
static
jfieldID
ctx_handle_fid
=
NULL
;
...
@@ -34,14 +35,7 @@ static void raise_exception (JNIEnv *env, int err)
...
@@ -34,14 +35,7 @@ static void raise_exception (JNIEnv *env, int err)
assert
(
exception_class
);
assert
(
exception_class
);
// Get text description of the exception.
// Get text description of the exception.
#if defined _MSC_VER
const
char
*
err_msg
=
zmq_strerror
(
err
);
#pragma warning (push)
#pragma warning (disable:4996)
#endif
const
char
*
err_msg
=
strerror
(
err
);
#if defined _MSC_VER
#pragma warning (pop)
#endif
// Raise the exception.
// Raise the exception.
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
...
...
bindings/java/Socket.cpp
View file @
3bd8f83f
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
#include <errno.h>
#include <errno.h>
#include "../../src/stdint.hpp"
#include "../../src/stdint.hpp"
#include "../c/zmq.h"
#include "zmq.h"
#include "org_zmq_Socket.h"
#include "org_zmq_Socket.h"
static
jfieldID
socket_handle_fid
=
NULL
;
static
jfieldID
socket_handle_fid
=
NULL
;
...
@@ -37,14 +37,7 @@ static void raise_exception (JNIEnv *env, int err)
...
@@ -37,14 +37,7 @@ static void raise_exception (JNIEnv *env, int err)
assert
(
exception_class
);
assert
(
exception_class
);
// Get text description of the exception.
// Get text description of the exception.
#if defined _MSC_VER
const
char
*
err_msg
=
zmq_strerror
(
err
);
#pragma warning (push)
#pragma warning (disable:4996)
#endif
const
char
*
err_msg
=
strerror
(
err
);
#if defined _MSC_VER
#pragma warning (pop)
#endif
// Raise the exception.
// Raise the exception.
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
...
...
bindings/python/pyzmq.cpp
View file @
3bd8f83f
...
@@ -64,7 +64,7 @@ int context_init (context_t *self, PyObject *args, PyObject *kwdict)
...
@@ -64,7 +64,7 @@ int context_init (context_t *self, PyObject *args, PyObject *kwdict)
assert
(
!
self
->
handle
);
assert
(
!
self
->
handle
);
self
->
handle
=
zmq_init
(
app_threads
,
io_threads
,
flags
);
self
->
handle
=
zmq_init
(
app_threads
,
io_threads
,
flags
);
if
(
!
self
->
handle
)
{
if
(
!
self
->
handle
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -76,7 +76,7 @@ void context_dealloc (context_t *self)
...
@@ -76,7 +76,7 @@ void context_dealloc (context_t *self)
if
(
self
->
handle
)
{
if
(
self
->
handle
)
{
int
rc
=
zmq_term
(
self
->
handle
);
int
rc
=
zmq_term
(
self
->
handle
);
if
(
rc
!=
0
)
if
(
rc
!=
0
)
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
}
}
self
->
ob_type
->
tp_free
((
PyObject
*
)
self
);
self
->
ob_type
->
tp_free
((
PyObject
*
)
self
);
...
@@ -114,7 +114,7 @@ int socket_init (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -114,7 +114,7 @@ int socket_init (socket_t *self, PyObject *args, PyObject *kwdict)
assert
(
!
self
->
handle
);
assert
(
!
self
->
handle
);
self
->
handle
=
zmq_socket
(
context
->
handle
,
socket_type
);
self
->
handle
=
zmq_socket
(
context
->
handle
,
socket_type
);
if
(
!
self
->
handle
)
{
if
(
!
self
->
handle
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -126,7 +126,7 @@ void socket_dealloc (socket_t *self)
...
@@ -126,7 +126,7 @@ void socket_dealloc (socket_t *self)
if
(
self
->
handle
)
{
if
(
self
->
handle
)
{
int
rc
=
zmq_close
(
self
->
handle
);
int
rc
=
zmq_close
(
self
->
handle
);
if
(
rc
!=
0
)
if
(
rc
!=
0
)
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
}
}
self
->
ob_type
->
tp_free
((
PyObject
*
)
self
);
self
->
ob_type
->
tp_free
((
PyObject
*
)
self
);
...
@@ -171,7 +171,7 @@ PyObject *socket_setsockopt (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -171,7 +171,7 @@ PyObject *socket_setsockopt (socket_t *self, PyObject *args, PyObject *kwdict)
}
}
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -191,7 +191,7 @@ PyObject *socket_bind (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -191,7 +191,7 @@ PyObject *socket_bind (socket_t *self, PyObject *args, PyObject *kwdict)
int
rc
=
zmq_bind
(
self
->
handle
,
addr
);
int
rc
=
zmq_bind
(
self
->
handle
,
addr
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -211,7 +211,7 @@ PyObject *socket_connect (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -211,7 +211,7 @@ PyObject *socket_connect (socket_t *self, PyObject *args, PyObject *kwdict)
int
rc
=
zmq_connect
(
self
->
handle
,
addr
);
int
rc
=
zmq_connect
(
self
->
handle
,
addr
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -233,7 +233,7 @@ PyObject *socket_send (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -233,7 +233,7 @@ PyObject *socket_send (socket_t *self, PyObject *args, PyObject *kwdict)
zmq_msg_t
data
;
zmq_msg_t
data
;
int
rc
=
zmq_msg_init_size
(
&
data
,
PyString_Size
(
msg
));
int
rc
=
zmq_msg_init_size
(
&
data
,
PyString_Size
(
msg
));
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
memcpy
(
zmq_msg_data
(
&
data
),
PyString_AsString
(
msg
),
memcpy
(
zmq_msg_data
(
&
data
),
PyString_AsString
(
msg
),
...
@@ -247,7 +247,7 @@ PyObject *socket_send (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -247,7 +247,7 @@ PyObject *socket_send (socket_t *self, PyObject *args, PyObject *kwdict)
return
PyBool_FromLong
(
0
);
return
PyBool_FromLong
(
0
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -264,7 +264,7 @@ PyObject *socket_flush (socket_t *self, PyObject *args, PyObject *kwdict)
...
@@ -264,7 +264,7 @@ PyObject *socket_flush (socket_t *self, PyObject *args, PyObject *kwdict)
int
rc
=
zmq_flush
(
self
->
handle
);
int
rc
=
zmq_flush
(
self
->
handle
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
PyErr_SetString
(
PyExc_SystemError
,
strerror
(
errno
));
PyErr_SetString
(
PyExc_SystemError
,
zmq_
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
...
bindings/ruby/rbzmq.cpp
View file @
3bd8f83f
...
@@ -44,7 +44,7 @@ static VALUE context_initialize (VALUE self_, VALUE app_threads_,
...
@@ -44,7 +44,7 @@ static VALUE context_initialize (VALUE self_, VALUE app_threads_,
void
*
ctx
=
zmq_init
(
NUM2INT
(
app_threads_
),
NUM2INT
(
io_threads_
),
void
*
ctx
=
zmq_init
(
NUM2INT
(
app_threads_
),
NUM2INT
(
io_threads_
),
NUM2INT
(
flags_
));
NUM2INT
(
flags_
));
if
(
!
ctx
)
{
if
(
!
ctx
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -76,7 +76,7 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
...
@@ -76,7 +76,7 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
void
*
s
=
zmq_socket
(
DATA_PTR
(
context_
),
NUM2INT
(
type_
));
void
*
s
=
zmq_socket
(
DATA_PTR
(
context_
),
NUM2INT
(
type_
));
if
(
!
s
)
{
if
(
!
s
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -123,7 +123,7 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
...
@@ -123,7 +123,7 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
}
}
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -137,7 +137,7 @@ static VALUE socket_bind (VALUE self_, VALUE addr_)
...
@@ -137,7 +137,7 @@ static VALUE socket_bind (VALUE self_, VALUE addr_)
int
rc
=
zmq_bind
(
DATA_PTR
(
self_
),
rb_string_value_cstr
(
&
addr_
));
int
rc
=
zmq_bind
(
DATA_PTR
(
self_
),
rb_string_value_cstr
(
&
addr_
));
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -150,7 +150,7 @@ static VALUE socket_connect (VALUE self_, VALUE addr_)
...
@@ -150,7 +150,7 @@ static VALUE socket_connect (VALUE self_, VALUE addr_)
int
rc
=
zmq_connect
(
DATA_PTR
(
self_
),
rb_string_value_cstr
(
&
addr_
));
int
rc
=
zmq_connect
(
DATA_PTR
(
self_
),
rb_string_value_cstr
(
&
addr_
));
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -166,7 +166,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
...
@@ -166,7 +166,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
zmq_msg_t
msg
;
zmq_msg_t
msg
;
int
rc
=
zmq_msg_init_size
(
&
msg
,
RSTRING_LEN
(
msg_
));
int
rc
=
zmq_msg_init_size
(
&
msg
,
RSTRING_LEN
(
msg_
));
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
memcpy
(
zmq_msg_data
(
&
msg
),
RSTRING_PTR
(
msg_
),
RSTRING_LEN
(
msg_
));
memcpy
(
zmq_msg_data
(
&
msg
),
RSTRING_PTR
(
msg_
),
RSTRING_LEN
(
msg_
));
...
@@ -179,7 +179,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
...
@@ -179,7 +179,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
}
}
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
rc
=
zmq_msg_close
(
&
msg
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
return
Qnil
;
return
Qnil
;
...
@@ -196,7 +196,7 @@ static VALUE socket_flush (VALUE self_)
...
@@ -196,7 +196,7 @@ static VALUE socket_flush (VALUE self_)
int
rc
=
zmq_flush
(
DATA_PTR
(
self_
));
int
rc
=
zmq_flush
(
DATA_PTR
(
self_
));
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
return
Qnil
;
return
Qnil
;
}
}
...
@@ -219,7 +219,7 @@ static VALUE socket_recv (VALUE self_, VALUE flags_)
...
@@ -219,7 +219,7 @@ static VALUE socket_recv (VALUE self_, VALUE flags_)
}
}
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
rb_raise
(
rb_eRuntimeError
,
strerror
(
errno
));
rb_raise
(
rb_eRuntimeError
,
zmq_
strerror
(
errno
));
rc
=
zmq_msg_close
(
&
msg
);
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
return
Qnil
;
return
Qnil
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment