/* Destructor for call_data */ static void destroy_call_elem(grpc_call_element *elem) { /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; ignore_unused(calld); ignore_unused(channeld); }
static void noop_mutate_op(grpc_call_element *elem, grpc_transport_stream_op *op) { /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; ignore_unused(calld); ignore_unused(channeld); /* do nothing */ }
void BingoView::view(const NumberLotElement &numberLotElement, int id) { ignore_unused(id); QString letter = findLetter(numberLotElement.number()); setViewText(0, letter.append(" ").append(QString::number(numberLotElement.number()))); }
/* Called either: - in response to an API call (or similar) from above, to send something - a network event (or similar) from below, to receive something op contains type and call direction information, in addition to the data that is being sent or received. */ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, grpc_call_op *op) { /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; ignore_unused(calld); ignore_unused(channeld); switch (op->type) { default: /* pass control up or down the stack depending on op->dir */ grpc_call_next_op(elem, op); break; } }
/* Destructor for channel data */ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) { /* grab pointers to our data from the channel element */ channel_data *channeld = elem->channel_data; ignore_unused(channeld); }
/// \brief TODOCUMENT vcie_vcie_vec_pair view_cache_index_entry_test_suite_fixture::build_alignment_vcies_pair(const size_t &arg_num_entries, ///< TODOCUMENT const protein &arg_protein_a, ///< TODOCUMENT const protein &arg_protein_b, ///< TODOCUMENT const alignment &arg_alignment, ///< TODOCUMENT mt19937 &arg_rng ///< TODOCUMENT ) { const auto &present_posn_indices = indices_of_present_positions_of_both_entries( arg_alignment ); const auto num_present_posn_indices = present_posn_indices.size(); if ( num_present_posn_indices < 2 ) { BOOST_THROW_EXCEPTION(invalid_argument_exception("Cannot build random_vcie pairs if the alignment has fewer than two residues")); } vcie_vcie_vec_pair results; for (const auto &entry_ctr : irange( 0_z, arg_num_entries ) ) { ignore_unused( entry_ctr ); const auto index_pair = pick_random_pair( 0_z, num_present_posn_indices - 1, arg_rng ); const auto &index_1 = present_posn_indices[ index_pair.first ]; const auto &index_2 = present_posn_indices[ index_pair.second ]; results.first.push_back( make_view_cache_index_entry( arg_protein_a, get_a_position_of_index( arg_alignment, index_1 ), get_a_position_of_index( arg_alignment, index_2 ) ) ); results.second.push_back( make_view_cache_index_entry( arg_protein_b, get_b_position_of_index( arg_alignment, index_1 ), get_b_position_of_index( arg_alignment, index_2 ) ) ); } return results; }
TEST_F(stack_allocatorTest, ThatANullBlockIsReturnedWhenTheAllocatorIsOutOfMemory) { auto allMem = sut.allocate(64); auto noFreeMem = sut.allocate(1); ignore_unused(allMem); EXPECT_EQ(nullptr, noFreeMem.ptr); EXPECT_EQ(0u, noFreeMem.length); }
/* Constructor for call_data */ static void init_call_elem(grpc_call_element *elem, const void *server_transport_data) { /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; ignore_unused(channeld); /* initialize members */ memset(calld, 0, sizeof(*calld)); }
TEST_F(stack_allocatorTest, ThatAFreedBlockWhichWasTheLastAllocatedOnesGetsReusedForANewAllocation) { auto mem1 = sut.allocate(8); auto mem2 = sut.allocate(8); ignore_unused(mem1); auto ptrOf2ndLocation = mem2.ptr; deallocateAndCheckBlockIsThenEmpty(mem2); auto mem3 = sut.allocate(8); EXPECT_EQ(ptrOf2ndLocation, mem3.ptr); deallocateAndCheckBlockIsThenEmpty(mem2); deallocateAndCheckBlockIsThenEmpty(mem3); }
void SingleNumberView::view(const NumberLotElement& numberLotElement, int id) { ignore_unused(id); setViewText(0, QString::number(numberLotElement.number())); }
inline void ignore_unused_icase() { ignore_unused(icase); }
void Messenger::onDataReceived( ::net::IStream::TId streamId, const unsigned char* buf, size_t bufSize) { util::ScopedLock lock(&s_sync); try { // Append data to corresponding data buffer TStreamData::iterator dd = m_streamData.find(streamId); if (dd == m_streamData.end()) { dd = m_streamData.insert(std::make_pair(streamId, TData(0))).first; } TData& data = dd->second; // Required data length size_t dataSize = data.size(); size_t requiredLen = dataSize + bufSize; size_t availableLen = data.capacity(); #ifndef NDEBUG { char buf2[128]; memset(buf2, 0, sizeof(buf2)); sprintf(buf2, "%p data before: ", reinterpret_cast<void*>(streamId)); OutputDebugStringA(buf2); if (0 < data.size()) dumpBinBuffer(&data[0], data.size()); else OutputDebugStringA("<empty>\n"); } #endif // !NDEBUG // Resize data buffer if it is not large enough if (availableLen < requiredLen) { // Reserve 20% more size_t reserve = static_cast<size_t>(requiredLen * 1.2); if (reserve < KMSG_INITIAL_DATA_BUF_SIZE) reserve = KMSG_INITIAL_DATA_BUF_SIZE; data.reserve(reserve); } data.resize(requiredLen); // Copy data to buffer memcpy(&data[dataSize], buf, bufSize); // Try to extract message from data while (sizeof(MessageHeader) <= (dataSize = data.size())) { MessageHeader header; memset(&header, 0, sizeof(header)); assert(data.size() == dataSize); unsigned char* pData = &data[0]; memcpy(&header, pData, sizeof(header)); util::T_UI4 messageSize = header.payloadSize + sizeof(MessageHeader); // two bytes at the beginning are message type and payload length if (messageSize <= dataSize) { TMessagePtr message; try { if (!m_messageFactory) { assert(!"Message factory must be set before receiving messages"); throw std::logic_error("Internal error"); } chkptr(m_messageFactory); message = m_messageFactory->createMessage(header.messageType); { util::ScopedLock lock(&m_memStreamSync); util::MemoryStream memstream(pData + sizeof(MessageHeader), pData + messageSize); message->load(memstream); } // Remove message bytes from data { TData::iterator bb = data.begin(); std::advance(bb, messageSize); #ifndef NDEBUG size_t dataSizeBefore = data.size(); assert(dataSizeBefore >= messageSize); #endif // !NDEBUG data.erase(data.begin(), bb); #ifndef NDEBUG size_t dataSizeAfter = data.size(); assert(dataSizeAfter + messageSize == dataSizeBefore); assert(dd->second.size() == dataSizeAfter); { char buf2[128]; memset(buf2, 0, sizeof(buf2)); sprintf(buf2, "%p data after: ", reinterpret_cast<void*>(streamId)); OutputDebugStringA(buf2); if (0 < data.size()) dumpBinBuffer(&data[0], data.size()); else OutputDebugStringA("<empty>\n"); } #endif // !NDEBUG } TMessengerDelegates::iterator ii = m_messengerDelegates.find(streamId); if (ii == m_messengerDelegates.end()) { assert(0); throw util::Error("Stream not found"); } IMessengerDelegate* delegate_ = ii->second; chkptr(delegate_); delegate_->onMessageReceived(streamId, message); } catch (const std::exception& x) { #ifndef NDEBUG const char* szMsg = x.what(); #endif // Unknown messages and message handling errors are simple discarded ignore_unused(x); assert(!"Unknown message type or message handling error"); } catch (...) { // Unknown messages and message handling errors are simple discarded assert(!"Unknown message type or message handling error"); } } else { // Not enough data break; } } } catch (const std::exception& x) { // Some error (probably bad_alloc) occured while processing stream data. // In this case stream is assumed to be in incosistent state and thus is not used any more. net::StreamListener::instance().closeStream(streamId, x.what()); } catch (...) { // Some unknown error occured while processing stream data. // In this case stream is assumed to be in incosistent state and thus is not used any more. net::StreamListener::instance().closeStream(streamId, "Unknown error"); } }