From 005520bb3851e1136eec1c91c2730143aa36e43d Mon Sep 17 00:00:00 2001 From: Justin Azoff Date: Thu, 20 Jul 2017 21:16:17 -0400 Subject: [PATCH] problem: zframe_meta documentation is incorrect zframe_meta returns the value from zmq_msg_gets directly and according to http://api.zeromq.org/4-2:zmq-msg-gets The zmq_msg_gets() function shall return the string value for the property if successful. Otherwise it shall return NULL and set errno to one of the values defined below. The caller shall not modify or free the returned value, which shall be owned by the message. The encoding of the property and value shall be UTF8. --- README.md | 3 ++- api/zframe.api | 3 ++- bindings/lua_ffi/czmq_ffi.lua | 3 ++- bindings/python/czmq/_czmq_ctypes.py | 3 ++- bindings/python_cffi/czmq_cffi/_cdefs.inc | 3 ++- bindings/python_cffi/czmq_cffi/cdefs.py | 3 ++- bindings/qml/src/QmlZframe.cpp | 3 ++- bindings/qt/src/qzframe.cpp | 3 ++- bindings/ruby/lib/czmq/ffi/zframe.rb | 3 ++- include/zframe.h | 3 ++- src/zframe.c | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 75a38652d..d2a5a85b4 100644 --- a/README.md +++ b/README.md @@ -2463,7 +2463,8 @@ This is the class interface: zframe_data (zframe_t *self); // Return meta data property for frame - // Caller must free string when finished with it. + // The caller shall not modify or free the returned value, which shall be + // owned by the message. CZMQ_EXPORT const char * zframe_meta (zframe_t *self, const char *property); diff --git a/api/zframe.api b/api/zframe.api index cf3c3219f..35e48e380 100644 --- a/api/zframe.api +++ b/api/zframe.api @@ -63,7 +63,8 @@ Return meta data property for frame - Caller must free string when finished with it. + The caller shall not modify or free the returned value, which shall be + owned by the message. diff --git a/bindings/lua_ffi/czmq_ffi.lua b/bindings/lua_ffi/czmq_ffi.lua index f7b79fedd..1cbe3f84d 100644 --- a/bindings/lua_ffi/czmq_ffi.lua +++ b/bindings/lua_ffi/czmq_ffi.lua @@ -1092,7 +1092,8 @@ byte * zframe_data (zframe_t *self); // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const char * zframe_meta (zframe_t *self, const char *property); diff --git a/bindings/python/czmq/_czmq_ctypes.py b/bindings/python/czmq/_czmq_ctypes.py index 9e095b8a5..f0319c1c6 100644 --- a/bindings/python/czmq/_czmq_ctypes.py +++ b/bindings/python/czmq/_czmq_ctypes.py @@ -2539,7 +2539,8 @@ def data(self): def meta(self, property): """ Return meta data property for frame -Caller must free string when finished with it. + The caller shall not modify or free the returned value, which shall be + owned by the message. """ return lib.zframe_meta(self._as_parameter_, property) diff --git a/bindings/python_cffi/czmq_cffi/_cdefs.inc b/bindings/python_cffi/czmq_cffi/_cdefs.inc index d780ab1b9..706ba77da 100644 --- a/bindings/python_cffi/czmq_cffi/_cdefs.inc +++ b/bindings/python_cffi/czmq_cffi/_cdefs.inc @@ -1097,7 +1097,8 @@ byte * zframe_data (zframe_t *self); // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const char * zframe_meta (zframe_t *self, const char *property); diff --git a/bindings/python_cffi/czmq_cffi/cdefs.py b/bindings/python_cffi/czmq_cffi/cdefs.py index 9b9dfbc71..531d38d1a 100644 --- a/bindings/python_cffi/czmq_cffi/cdefs.py +++ b/bindings/python_cffi/czmq_cffi/cdefs.py @@ -1099,7 +1099,8 @@ zframe_data (zframe_t *self); // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const char * zframe_meta (zframe_t *self, const char *property); diff --git a/bindings/qml/src/QmlZframe.cpp b/bindings/qml/src/QmlZframe.cpp index f77c1098f..ff51da9a0 100644 --- a/bindings/qml/src/QmlZframe.cpp +++ b/bindings/qml/src/QmlZframe.cpp @@ -22,7 +22,8 @@ byte *QmlZframe::data () { /// // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const QString QmlZframe::meta (const QString &property) { return QString (zframe_meta (self, property.toUtf8().data())); }; diff --git a/bindings/qt/src/qzframe.cpp b/bindings/qt/src/qzframe.cpp index 17dd8925a..02a4baa44 100644 --- a/bindings/qt/src/qzframe.cpp +++ b/bindings/qt/src/qzframe.cpp @@ -81,7 +81,8 @@ byte * QZframe::data () /// // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const QString QZframe::meta (const QString &property) { const QString rv = QString (zframe_meta (self, property.toUtf8().data())); diff --git a/bindings/ruby/lib/czmq/ffi/zframe.rb b/bindings/ruby/lib/czmq/ffi/zframe.rb index fd034b278..0cb3d7161 100644 --- a/bindings/ruby/lib/czmq/ffi/zframe.rb +++ b/bindings/ruby/lib/czmq/ffi/zframe.rb @@ -164,7 +164,8 @@ def data() end # Return meta data property for frame - # Caller must free string when finished with it. + # The caller shall not modify or free the returned value, which shall be + # owned by the message. # # @param property [String, #to_s, nil] # @return [String] diff --git a/include/zframe.h b/include/zframe.h index 728093c36..d2ff0f245 100644 --- a/include/zframe.h +++ b/include/zframe.h @@ -67,7 +67,8 @@ CZMQ_EXPORT byte * zframe_data (zframe_t *self); // Return meta data property for frame -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. CZMQ_EXPORT const char * zframe_meta (zframe_t *self, const char *property); diff --git a/src/zframe.c b/src/zframe.c index a62fa8105..2863ca50e 100644 --- a/src/zframe.c +++ b/src/zframe.c @@ -226,7 +226,8 @@ zframe_data (zframe_t *self) // -------------------------------------------------------------------------- // Return meta data property for frame. -// Caller must free string when finished with it. +// The caller shall not modify or free the returned value, which shall be +// owned by the message. const char * zframe_meta (zframe_t *self, const char *property)