Repository: qpid-proton Updated Branches: refs/heads/master f77163529 -> de94b253a
PROTON-515: Change pn_handle_t to be void* to get around limitations in OpenVMS linker Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/de94b253 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/de94b253 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/de94b253 Branch: refs/heads/master Commit: de94b253ad7b5f212973244968fedad043de8402 Parents: f771635 Author: Andrew Stitcher <[email protected]> Authored: Wed Feb 3 10:55:18 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Mon Feb 15 16:39:27 2016 -0500 ---------------------------------------------------------------------- proton-c/bindings/cpp/src/data.cpp | 4 ++-- proton-c/bindings/perl/CMakeLists.txt | 5 ++--- proton-c/bindings/python/CMakeLists.txt | 5 ++--- proton-c/include/proton/cproton.i | 2 ++ proton-c/include/proton/object.h | 2 +- proton-c/src/codec/codec.c | 8 ++++---- proton-c/src/object/map.c | 10 +++++----- 7 files changed, 18 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/bindings/cpp/src/data.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/data.cpp b/proton-c/bindings/cpp/src/data.cpp index 7b6aad0..6783dae 100644 --- a/proton-c/bindings/cpp/src/data.cpp +++ b/proton-c/bindings/cpp/src/data.cpp @@ -32,9 +32,9 @@ void data::clear() { ::pn_data_clear(pn_object()); } bool data::empty() const { return ::pn_data_size(pn_object()) == 0; } -uintptr_t data::point() const { return pn_data_point(pn_object()); } +uintptr_t data::point() const { return uintptr_t(pn_data_point(pn_object())); } -void data::restore(uintptr_t h) { pn_data_restore(pn_object(), h); } +void data::restore(uintptr_t h) { pn_data_restore(pn_object(), pn_handle_t(h)); } void data::narrow() { pn_data_narrow(pn_object()); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/bindings/perl/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/perl/CMakeLists.txt b/proton-c/bindings/perl/CMakeLists.txt index 55cf032..4f223f0 100644 --- a/proton-c/bindings/perl/CMakeLists.txt +++ b/proton-c/bindings/perl/CMakeLists.txt @@ -19,9 +19,8 @@ include_directories("${PERL_INCLUDE_PATH}") -if (BUILD_WITH_CXX) - SET_SOURCE_FILES_PROPERTIES(cproton.i perl.i PROPERTIES CPLUSPLUS ON) -endif(BUILD_WITH_CXX) +# Always need to treat SWIG files as C +set_source_files_properties(cproton.i perl.i PROPERTIES CPLUSPLUS NO) # Need to pass in the same compiler flags used to build Perl itself execute_process(COMMAND perl -MConfig -e "print \$Config{ccflags}" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/bindings/python/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/CMakeLists.txt b/proton-c/bindings/python/CMakeLists.txt index 10ae572..d16caad 100644 --- a/proton-c/bindings/python/CMakeLists.txt +++ b/proton-c/bindings/python/CMakeLists.txt @@ -23,9 +23,8 @@ set(CMAKE_SWIG_FLAGS "-threads") include_directories (${PYTHON_INCLUDE_PATH}) -if (BUILD_WITH_CXX) - SET_SOURCE_FILES_PROPERTIES(cproton.i PROPERTIES CPLUSPLUS ON) -endif (BUILD_WITH_CXX) + +set_source_files_properties(cproton.i PROPERTIES CPLUSPLUS NO) list(APPEND SWIG_MODULE_cproton_EXTRA_DEPS ${CMAKE_SOURCE_DIR}/proton-c/include/proton/cproton.i http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/include/proton/cproton.i ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i index 629cc20..c4e877b 100644 --- a/proton-c/include/proton/cproton.i +++ b/proton-c/include/proton/cproton.i @@ -57,6 +57,8 @@ typedef unsigned long int uintptr_t; %immutable PN_OBJECT; %immutable PN_VOID; %immutable PN_WEAKREF; +/* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really it's just an int */ +%apply uintptr_t { pn_handle_t }; %include "proton/object.h" %ignore pn_error_format; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/include/proton/object.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/object.h b/proton-c/include/proton/object.h index 8595eae..464aff3 100644 --- a/proton-c/include/proton/object.h +++ b/proton-c/include/proton/object.h @@ -33,7 +33,7 @@ extern "C" { #endif -typedef uintptr_t pn_handle_t; +typedef void* pn_handle_t; typedef intptr_t pn_shandle_t; typedef struct pn_class_t pn_class_t; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/src/codec/codec.c ---------------------------------------------------------------------- diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c index 1cc1ee7..ae77b08 100644 --- a/proton-c/src/codec/codec.c +++ b/proton-c/src/codec/codec.c @@ -1153,9 +1153,9 @@ void pn_data_widen(pn_data_t *data) pn_handle_t pn_data_point(pn_data_t *data) { if (data->current) { - return data->current; + return (pn_handle_t)(uintptr_t)data->current; } else { - return -data->parent; + return (pn_handle_t)(uintptr_t)-data->parent; } } @@ -1166,8 +1166,8 @@ bool pn_data_restore(pn_data_t *data, pn_handle_t point) data->parent = -((pn_shandle_t) point); data->current = 0; return true; - } else if (point && point <= data->size) { - data->current = point; + } else if (spoint && spoint <= data->size) { + data->current = spoint; pni_node_t *current = pni_data_current(data); data->parent = current->parent; return true; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/de94b253/proton-c/src/object/map.c ---------------------------------------------------------------------- diff --git a/proton-c/src/object/map.c b/proton-c/src/object/map.c index 20bb4ea..cd38f19 100644 --- a/proton-c/src/object/map.c +++ b/proton-c/src/object/map.c @@ -346,7 +346,7 @@ pn_handle_t pn_map_head(pn_map_t *map) for (size_t i = 0; i < map->capacity; i++) { if (map->entries[i].state != PNI_ENTRY_FREE) { - return i + 1; + return (pn_handle_t)(i + 1); } } @@ -355,9 +355,9 @@ pn_handle_t pn_map_head(pn_map_t *map) pn_handle_t pn_map_next(pn_map_t *map, pn_handle_t entry) { - for (size_t i = entry; i < map->capacity; i++) { + for (size_t i = (size_t)entry; i < map->capacity; i++) { if (map->entries[i].state != PNI_ENTRY_FREE) { - return i + 1; + return (pn_handle_t)(i + 1); } } @@ -368,14 +368,14 @@ void *pn_map_key(pn_map_t *map, pn_handle_t entry) { assert(map); assert(entry); - return map->entries[entry - 1].key; + return map->entries[(size_t)entry - 1].key; } void *pn_map_value(pn_map_t *map, pn_handle_t entry) { assert(map); assert(entry); - return map->entries[entry - 1].value; + return map->entries[(size_t)entry - 1].value; } struct pn_hash_t { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
