0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

2729 Commits

Author SHA1 Message Date
Simon Giesecke
4a651251a7 Problem: code duplication within socket_poller_t
Solution: remove duplicated code
2018-06-01 18:24:42 +02:00
Simon Giesecke
74d3d8421f Problem: huge stack allocation with select on Windows in socket_poller_t::wait
Solution: use optimized_fd_set_t
2018-06-01 18:22:49 +02:00
Simon Giesecke
3d39bb9ca9 Problem: valid_pollset_bytes not reused in socket_poller
Solution: use it
2018-06-01 18:22:49 +02:00
Simon Giesecke
a8d62d14c1 Problem: polling utilities not at a reusable location
Solution: move to separate header
2018-06-01 18:22:48 +02:00
Simon Giesecke
7c0efcb588 Problem: huge stack allocation in Windows select code
Solution: use fast_vector_t as in poll implementation
2018-06-01 18:20:10 +02:00
Simon Giesecke
2533ffed86 Problem: memcpy code fragment is duplicated
Solution: unify between Windows and non-Windows code
2018-06-01 18:19:46 +02:00
Simon Giesecke
04dedfbc2a Problem: duplicated calculation of valid bytes in select pollset
Solution: extract to function
2018-06-01 18:16:46 +02:00
Simon Giesecke
e4c3297ed8 Problem: fragile handling of possibly dynamically allocated pollfds
Solution: extract class template fast_vector_t
2018-06-01 17:08:39 +02:00
Simon Giesecke
c6e4b0abb1 Problem: zmq_poll implementation is complex
Solution: extract compute_timeout method
2018-06-01 17:08:38 +02:00
Simon Giesecke
3db3bbfbbb Problem: duplication in implementation zmq_poller_poll
Solution: remove duplication
2018-06-01 17:08:38 +02:00
Simon Giesecke
4604014c12 Problem: unused result of call to pull_msg
Solution: add TODO comment regarding handling of the result
2018-05-31 11:21:33 +02:00
Simon Giesecke
c2ba553d87 Problem: unused values stored to variable, duplicated code
Solution: remove duplicated and redundant code
2018-05-31 11:02:26 +02:00
Simon Giesecke
ee4cdf8bf0 Problem: suspicious use of memcmp result
Solution: explicitly compare result against 0
2018-05-31 11:02:26 +02:00
Simon Giesecke
a2f91c5509 Problem: unnecessary passing of non-const data
Solution: make const
2018-05-30 23:21:53 +02:00
Simon Giesecke
c641644bb2 Problem: inconsistent parameter names
Solution: harmonize
2018-05-30 23:21:52 +02:00
Simon Giesecke
9e6f1c9a3c Problem: redundant else after return
Solution: remove redundant else
2018-05-30 23:21:52 +02:00
Simon Giesecke
6fa12bd692 Problem: unused stored value warning
Solution: add LIBZMQ_UNUSED
2018-05-30 23:21:52 +02:00
Simon Giesecke
0f2979a38e Problem: assignment used as condition warning
Solution: changed condition
2018-05-30 23:21:52 +02:00
Simon Giesecke
24edc828ab Problem: redundant else after return
Solution: remove redundant else
2018-05-30 23:21:52 +02:00
Simon Giesecke
88646438d2 Problem: differing parameter names between declaration and definition
Solution: harmonize
2018-05-30 23:21:52 +02:00
Simon Giesecke
da4309da13 Problem: violation of parameter naming conventions
Solution: change to comply with naming conventions
2018-05-30 23:21:52 +02:00
Simon Giesecke
29f1f39df3 Problem: unused parameter warning
Solution: mark parameter as unused depending on platform definitions
2018-05-30 23:21:52 +02:00
Simon Giesecke
b59d7d574d Problem: typo in parameter name
Solution: correct spelling
2018-05-30 22:52:19 +02:00
Simon Giesecke
a91c7e718c Problem: warnings on violations of CERT ERR-58
Solution: declare functions noexcept
2018-05-30 22:52:19 +02:00
Simon Giesecke
93194e7c53 Problem: non-portable memset
Solution: add dummy pointer meber to union instead
2018-05-30 22:50:30 +02:00
Simon Giesecke
9c8fde09ca Problem: inconsistent control structures in address.cpp, redundant check for NULLness before delete
Solution: harmonize, remove redundant checks
2018-05-30 22:50:30 +02:00
Simon Giesecke
0179b7577a Problem: literals protocol names used at various places
Solution: introduced named constants
2018-05-30 22:50:29 +02:00
Simon Giesecke
bd76926f5b Problem: code style issues in options_t (C-style cast, suboptimal std::string::find call, redundant method is_valid)
Solution: resolved these issues
2018-05-30 13:13:31 +02:00
Simon Giesecke
a96a87f343 Problem: problematic atoi function is used (CERT ERR-34C)
Solution: use strtol instead
2018-05-30 10:35:01 +02:00
Simon Giesecke
273137741a Problem: protected data members in ip_address_t, ip_address_mask_t violates LSP
Solution: make ip_address_mask_t independent of ip_address_t, they do not share that much, remove some code duplication between ip_address_t and ip_addr_t
2018-05-30 10:28:14 +02:00
Simon Giesecke
314ac28dbd Problem: protected data member in ip_resolver_t
Solution: declare private
2018-05-30 10:03:55 +02:00
Simon Giesecke
573815da83 Problem: protected data member in encoder_base_t
Solution: encapsulate data member properly
2018-05-30 09:57:46 +02:00
Simon Giesecke
be8e7de6be Problem: temporary files in repo
Solution: remove them
2018-05-30 09:30:00 +02:00
Simon Giesecke
5a343fc27b Problem: stream_t/router_t access data member of base class
Solution: pull up functionality to base class
2018-05-29 15:05:27 +02:00
Simon Giesecke
ab3895a470 Problem: duplicated code in stream_t & router_t
Solution: pulled up to routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
09fab930b3 Problem: xwrite_activated duplicated between stream_t and router_t
Solution: pull up into routing_socket_base_t
2018-05-29 15:05:27 +02:00
Simon Giesecke
c9d6ef3035 Problem: Member outpipes is duplicate between router_t and stream_t
Solution: extract into common base class routing_socket_base_t, for now as protected
2018-05-29 15:05:26 +02:00
Simon Giesecke
728eddfcfd Problem: socket_base_t::connect_routing_id is protected and only used in router_t and stream_t
Solution: add an intermediary base class routing_socket_base_t, move common functionality there and make connect_routing_id private
2018-05-29 15:05:26 +02:00
Simon Giesecke
25461a78dd Problem: members of mechanmism_t are needlessly protected
Solution: make them private
2018-05-29 11:08:22 +02:00
Simon Giesecke
47dcd84f21 Problem: C-style casts
Solution: replace by reinterpret_casts or avoid entirely
2018-05-28 18:47:07 +02:00
Simon Giesecke
917a4a8e10 Problem: reinterpret_casts between unsigned char* and char*
Solution: use char* from the beginning
2018-05-28 18:47:07 +02:00
Simon Giesecke
0a43c66a32 Problem: magic literals in zap_client.cpp
Solution: extracted constants
2018-05-28 18:47:07 +02:00
Simon Giesecke
7c2d1c1824 Problem: magic literals for UCHAR_MAX
Solution: use UCHAR_MAX constant instead
2018-05-28 18:46:50 +02:00
Simon Giesecke
a4c817e736 Problem: magic number "2" in socket_base.cpp
Solution: calculate from field sizes
2018-05-28 18:45:41 +02:00
Simon Giesecke
d75ec5e055 Problem: produce_* functions always return 0
Solution: change return type to void, and remove redundant result checks
2018-05-28 17:53:46 +02:00
Simon Giesecke
7f880c256f Problem: magic numbers and data duplication in plain_*.cpp
Solution: extract constants / move to plain_common.hpp
2018-05-28 17:53:46 +02:00
Simon Giesecke
8269b23e56 Problem: magic numbers and code duplication in msg.cpp
Solution: extract constants and unified cases
2018-05-28 17:53:44 +02:00
Simon Giesecke
18000a213f Problem: magic numbers in mechanism_base.cpp
Solution: extract constants
2018-05-28 17:53:44 +02:00
Simon Giesecke
abca9f6bc1 Problem: Magic numbers in plain_server.cpp
Solution: introduced constants
2018-05-28 17:53:44 +02:00
Simon Giesecke
2da6629e0f Problem: Magic numbers "1" and "100" in signaler.cpp
Solution: introduced constants, use std::min/std::max instead of control structures
2018-05-28 17:53:43 +02:00
Simon Giesecke
a6060674b4 Problem: Magic numbers "32" and "128" in tcp_address.cpp
Solution: introduced constants
2018-05-28 17:53:43 +02:00
Simon Giesecke
93e75fd695 Problem: Magic numbers "6" and "7" in null_mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
c05db7f025 Problem: Magic numbers "1" and "6" in null_mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
ff27dd01f0 Problem: Magic numbers "1" and "4" in mechanism.cpp
Solution: introduced constants
2018-05-28 17:53:42 +02:00
Simon Giesecke
7c9d058cdb Problem: Magic number "2" in ip_resolver.cpp
Solution: introduced constant
2018-05-28 17:53:41 +02:00
Simon Giesecke
16bb62e6f7 Problem: ctx_t::_slots is a plain array
Solution: use a std::vector instead
2018-05-28 17:53:41 +02:00
Simon Giesecke
a0a60e80ca Problem: Magic number "2" in ctx.cpp
Solution: introduced constant
2018-05-28 17:53:40 +02:00
Luca Boccassi
624c142365 Problem: static analysis warning about ifdef typo
Solution: fix it
2018-05-28 12:32:23 +01:00
Simon Giesecke
d767909b50 Problem: old C-style casts used
Solution: replace by static_cast/reinterpret_cast
2018-05-27 13:24:07 +02:00
Simon Giesecke
e3c73d9881 Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
2018-05-27 13:24:07 +02:00
Simon Giesecke
06cfd0d8ad Problem: unclear why QueryPerformanceFrequency is called for every call of QueryPerformanceCounter
Solution: add a comment
2018-05-27 13:24:07 +02:00
Simon Giesecke
97ba02bc2f Problem: redundant empty dtor
Solution: removed
2018-05-27 13:24:06 +02:00
Simon Giesecke
6ef67f13e3 Problem: use of C-style casts and magic literals
Solution: replace by static_cast, and introduce appropriate constants
2018-05-27 13:24:06 +02:00
Simon Giesecke
37344d0b7c Problem: redundant old-style void argument declarations
Solution: remove
2018-05-26 09:34:45 +02:00
Simon Giesecke
12a97bb769 Problem: redundant else after return
Solution: remove else
2018-05-26 09:34:45 +02:00
Simon Giesecke
21498700ef Problem: integer literals assigned to bool variables
Solution: replace by bool literals
2018-05-26 09:34:45 +02:00
Simon Giesecke
eacc805646 Problem: complex unnecessary ternary expressions
Solution: simplify to comparison against 0
2018-05-26 09:34:44 +02:00
Simon Giesecke
1432011277 Problem: inconsistent local variable naming
Solution: configured clang-tidy check and applied fixes
2018-05-26 09:34:44 +02:00
Simon Giesecke
c581f43c97 Problem: parameter naming style inconsistent
Solution: define and apply parameter naming style: lower_case_
2018-05-26 09:34:44 +02:00
Simon Giesecke
763760988f Problem: VS2008 has no definition of UINT16_MAX
Solution: provide definition based on _UI16_MAX
2018-05-25 15:13:07 +02:00
Simon Giesecke
d90e70c1cf Problem: maximum allowed value for ZMQ_HEARTBEAT_TTL is wrong
Solution: use UINT16_MAX
2018-05-25 15:06:11 +02:00
Simon Giesecke
2ae0c4e2c5 Problem: unnecessarily complex inheritance hierarchy in decoders, warning C4355 with VS2010
Solution: make allocator a member of decoder_base_t
2018-05-24 15:17:08 +02:00
Simon Giesecke
082b6aa641 Problem: epoll not supported under Windows
Solution: Use wepoll on Windows
2018-05-23 16:25:07 +02:00
Luca Boccassi
3730833f9d
Merge pull request #3125 from sigiesec/improve-socket-inheritance
Improve socket inheritance handling
2018-05-23 13:50:39 +01:00
Simon Giesecke
2d9a8955f5 Problem: race condition in making socket non-inheritable
Solution: create sockets with WSA_FLAG_NO_HANDLE_INHERIT
2018-05-23 11:23:33 +02:00
Simon Giesecke
44da0e7e42 Problem: code duplication in making sockets non-inheritable
Solution: extracted make_socket_noninheritable function
2018-05-23 11:23:33 +02:00
Simon Giesecke
c432aada84 Problem: inconsistent error handling and unnecessary code duplication
Solution: make error handling consistent and use retired_fd to remove code duplication
2018-05-23 11:23:33 +02:00
Luca Boccassi
44b0753c5c
Merge pull request #3047 from acsearle/master
Allow EBADF on iOS #3046
2018-05-23 09:56:32 +01:00
Luca Boccassi
d02ba13576
Merge pull request #3122 from sigiesec/test-migrations
Migrated some more tests to unity and fixed some more code style issues
2018-05-22 20:37:34 +01:00
Simon Giesecke
440be28d7e Problem: unnecessary non-const variables
Solution: add const
2018-05-22 18:46:40 +02:00
Simon Giesecke
d6952ded71 Problem: unused include directives and redundant forward declarations
Solution: removed
2018-05-22 18:46:40 +02:00
Simon Giesecke
04ec6aaf28 Problem: malloc call may fail
Solution: add alloc_assert
2018-05-22 18:46:40 +02:00
Simon Giesecke
d326434b37 Problem: API poller cannot be set independently from I/O thread poller, poll I/O thread poller broken on Windows
Solution: change platform definitions to separate API poller from I/O thread poller, disallow configuring poll I/O thread poller on Windows
2018-05-22 18:36:04 +02:00
Simon Giesecke
4e616f30dd Problem: C-style casts used
Solution: replace by C++-style casts
2018-05-18 17:04:01 +02:00
Simon Giesecke
d002eb5578 Problem: analyzer does not know that zmq_abort does not return
Solution: add no-return attributes
2018-05-18 16:25:24 +02:00
Simon Giesecke
7b3acd47b2 Problem: malloc may fail in blob_t ctors
Solution: add alloc_assert calls
2018-05-18 16:25:24 +02:00
Simon Giesecke
9da0c6d62f Problem: goto jumping backwards
Solution: replace by for loop
2018-05-18 14:34:43 +02:00
Simon Giesecke
62e48f837d Problem: assignment within complex condition
Solution: restructured code, inverted condition
2018-05-18 14:34:43 +02:00
Simon Giesecke
fcee4ccdfd Problem: type of retired_fd is not fd_t (but int)
Solution: properly declared underlying type of enum declaring retired_fd
2018-05-18 14:34:43 +02:00
Simon Giesecke
f103f62630 Problem: unreachable return statement
Solution: fix #if/#else structure
2018-05-18 14:34:42 +02:00
Simon Giesecke
290d215324 Problem: stream_engine assumes options_t.type is a single byte, but its type is int
Solution: change options_t.type to int8_t
2018-05-18 14:34:42 +02:00
Simon Giesecke
e19823d83a Problem: redundant else
Solution: remove redundant else
2018-05-17 15:17:55 +02:00
Simon Giesecke
ad781319ef Problem: ternary operator used with boolean literals\n\nSolution: Use comparison with 0 instead 2018-05-17 15:17:55 +02:00
Simon Giesecke
22b72bb678 Problem: deallocate calls release after de-allocation
Solution: reduce to newly extracted function clear, which does not use the freed pointer
2018-05-17 15:05:41 +02:00
Simon Giesecke
e37fc47fb6 Problem: return value is stored but never used
Solution: add code to make non-use explicit
2018-05-17 15:05:41 +02:00
Simon Giesecke
2120f6aced Problem: ypipe_t::read is called with NULL argument
Solution: call check_read instead
2018-05-17 15:05:41 +02:00
Simon Giesecke
440d428153 Problem: single-argument ctor of blob_t is not marked explicit
Solution: add explicit
2018-05-17 13:29:27 +02:00
Antony Searle
fa027970bb Allow EBADF on iOS #3046 2018-05-16 14:59:44 +10:00
Luca Boccassi
cbd52feb48
Merge pull request #3112 from devindusoft/FixCompilation_ZMQ_ATOMIC_PTR_MUTEX
Fixed compilation with ZMQ_ATOMIC_PTR_MUTEX
2018-05-15 15:10:49 +01:00
Simon Giesecke
e78d20ff2c Problem: test_radio_dish_udp_ipv6 triggers assertion under Windows
Solution: fix handling of sockaddr in recvfrom
2018-05-15 14:53:40 +02:00