void
dumpExpandedHeap(virt_ptr<MEMExpHeap> heap)
{
   internal::HeapLock lock { virt_addrof(heap->header) };

   gLog->debug("MEMExpHeap(0x{:8x})", heap);
   gLog->debug("Status Address   Size       Group");

   for (auto block = heap->freeList.head; block; block = block->next) {
      auto attribs = static_cast<MEMExpHeapBlockAttribs>(block->attribs);

      gLog->debug("FREE  0x{:8x} 0x{:8x} {:d}",
                  block,
                  static_cast<uint32_t>(block->blockSize),
                  attribs.groupId());
   }

   for (auto block = heap->usedList.head; block; block = block->next) {
      auto attribs = static_cast<MEMExpHeapBlockAttribs>(block->attribs);

      gLog->debug("USED  0x{:8x} 0x{:8x} {:d}",
                  block,
                  static_cast<uint32_t>(block->blockSize),
                  attribs.groupId());
   }
}
void GxsChannelPostsWidget::subscribeGroup(bool subscribe)
{
    if (groupId().isNull()) {
        return;
    }

    uint32_t token;
    rsGxsChannels->subscribeToGroup(token, groupId(), subscribe);
//	mChannelQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
}
Example #3
0
void PostedListWidget::subscribeGroup(bool subscribe)
{
	if (groupId().isNull()) {
		return;
	}

	uint32_t token;
	rsPosted->subscribeToGroup(token, groupId(), subscribe);
//	mTokenQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
}
Example #4
0
    void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
    {
        WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);

        if (typeInfo->isSubclass(&V8StyleSheetList::info)) {
            StyleSheetList* styleSheetList = static_cast<StyleSheetList*>(object);
            GroupId groupId(styleSheetList);
            if (Document* document = styleSheetList->document())
                groupId = GroupId(document);
            m_grouper.append(GrouperItem(groupId, wrapper));

        } else if (typeInfo->isSubclass(&V8DOMImplementation::info)) {
            DOMImplementation* domImplementation = static_cast<DOMImplementation*>(object);
            GroupId groupId(domImplementation);
            if (Document* document = domImplementation->document())
                groupId = GroupId(document);
            m_grouper.append(GrouperItem(groupId, wrapper));

        } else if (typeInfo->isSubclass(&V8StyleSheet::info) || typeInfo->isSubclass(&V8CSSRule::info)) {
            m_grouper.append(GrouperItem(calculateGroupId(static_cast<StyleBase*>(object)), wrapper));

#if 0 //CMP_ERROR_UNCLEAR CSSMutableStyleDeclaration
        } else if (typeInfo->isSubclass(&V8CSSStyleDeclaration::info)) {
            CSSStyleDeclaration* cssStyleDeclaration = static_cast<CSSStyleDeclaration*>(object);

            GroupId groupId = calculateGroupId(cssStyleDeclaration);
            m_grouper.append(GrouperItem(groupId, wrapper));

            // Keep alive "dirty" primitive values (i.e. the ones that
            // have user-added properties) by creating implicit
            // references between the style declaration and the values
            // in it.
            if (cssStyleDeclaration->isMutableStyleDeclaration()) {
                CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(cssStyleDeclaration);
                Vector<v8::Persistent<v8::Value> > values;
                values.reserveCapacity(cssMutableStyleDeclaration->length());
                CSSMutableStyleDeclaration::const_iterator end = cssMutableStyleDeclaration->end();
                for (CSSMutableStyleDeclaration::const_iterator it = cssMutableStyleDeclaration->begin(); it != end; ++it) {
                    v8::Persistent<v8::Object> value = store->domObjectMap().get(it->value());
                    if (!value.IsEmpty() && value->IsDirty())
                        values.append(value);
                }
                if (!values.isEmpty())
                    v8::V8::AddImplicitReferences(wrapper, values.data(), values.size());
            }
        } else if (typeInfo->isSubclass(&V8CSSRuleList::info)) {
            CSSRuleList* cssRuleList = static_cast<CSSRuleList*>(object);
            GroupId groupId(cssRuleList);
            StyleList* styleList = cssRuleList->styleList();
            if (styleList)
                groupId = calculateGroupId(styleList);
            m_grouper.append(GrouperItem(groupId, wrapper));
#endif
        }
    }
Example #5
0
void PostedListWidget::newPost()
{
	if (groupId().isNull())
		return;

	if (!IS_GROUP_SUBSCRIBED(subscribeFlags())) {
		return;
	}

 	PostedCreatePostDialog *cp = new PostedCreatePostDialog(mTokenQueue, rsPosted, groupId(), this);
	cp->show();

	/* window will destroy itself! */
}
void GxsChannelPostsWidget::createMsg()
{
    if (groupId().isNull()) {
        return;
    }

    if (!IS_GROUP_SUBSCRIBED(subscribeFlags())) {
        return;
    }

    CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(groupId());
    msgDialog->show();

    /* window will destroy itself! */
}
/**
 * To return a valid contact item id.
 */
TContactItemId CSyncTestStep::GetValidUIDFromContactsDbL()
	{
	TContactItemId firstId(KNullContactId);

	CContactDatabase *iDb = NULL;
	TRAPD(err,iDb = CContactDatabase::OpenL()); // open existing database
	CleanupStack::PushL(iDb);
	if (err != KErrNone)
		{
		CleanupStack::PopAndDestroy(); // iDb
		return firstId;
		}

	iDb->SetDbViewContactType(KUidContactICCEntry);    
    
	// to get the unique groupId for the phonebook
	TContactItemId groupId(KNullContactId);
	User::LeaveIfError(iSession.GetPhoneBookId(groupId, RPhoneBookSession::ESyncGroupId));
	TESTCHECKCONDITIONL(groupId != KNullContactId);
  
	// based on the groupId, get an item belonging to the phonebook
	CContactGroup* group = static_cast<CContactGroup*>(iDb->ReadContactLC(groupId));
	const CContactIdArray* array = group->ItemsContained();
	TInt count(array->Count());
	if (count > 0)
		firstId = (*array)[0];

	CleanupStack::PopAndDestroy(group);	
	CleanupStack::PopAndDestroy(); // iDb
	return firstId;
	}
Example #8
0
QString QFileInfo::group() const
{
    struct group *gr = getgrgid( groupId() );
    if ( gr )
	return QFile::decodeName( gr->gr_name );
    return QString::null;
}
Example #9
0
void GxsFeedItem::requestMessage()
{
#ifdef DEBUG_ITEM
	std::cerr << "GxsFeedItem::requestMessage()";
	std::cerr << std::endl;
#endif

	if (!initLoadQueue()) {
		return;
	}

	if (mLoadQueue->activeRequestExist(mTokenTypeMessage)) {
		/* Request already running */
		return;
	}

	RsTokReqOptions opts;
	opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;

	GxsMsgReq msgIds;
	std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
	vect_msgIds.push_back(mMessageId);

	uint32_t token;
	mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessage);
}
Example #10
0
void GxsFeedItem::copyMessageLink()
{
	if (groupId().isNull() || mMessageId.isNull()) {
		return;
	}

	if (getLinkType() == RetroShareLink::TYPE_UNKNOWN) {
		return;
	}

	RetroShareLink link;
	if (link.createGxsMessageLink(getLinkType(), groupId(), mMessageId, messageName())) {
		QList<RetroShareLink> urls;
		urls.push_back(link);
		RSLinkClipboard::copyLinks(urls);
	}
}
void GxsChannelPostsWidget::groupNameChanged(const QString &name)
{
    if (groupId().isNull()) {
        ui->nameLabel->setText(tr("No Channel Selected"));
        ui->logoLabel->setPixmap(QPixmap(":/images/channels.png"));
    } else {
        ui->nameLabel->setText(name);
    }
}
bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId)
{
    FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId);
    if (!feedItem) {
        return false;
    }

    return ui->feedWidget->scrollTo(feedItem, true);
}
ScriptValue MediaDeviceInfo::toJSONForBinding(ScriptState* scriptState)
{
    V8ObjectBuilder result(scriptState);
    result.addString("deviceId", deviceId());
    result.addString("kind", kind());
    result.addString("label", label());
    result.addString("groupId", groupId());
    return result.scriptValue();
}
void GxsChannelPostsWidget::setAllMessagesReadDo(bool read, uint32_t &token)
{
    if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(subscribeFlags())) {
        return;
    }

    GxsChannelPostsReadData data(read);
    ui->feedWidget->withAll(setAllMessagesReadCallback, &data);

    token = data.mLastToken;
}
Example #15
0
void GxsFeedItem::comments(const QString &title)
{
#ifdef DEBUG_ITEM
	std::cerr << "GxsFeedItem::comments()";
	std::cerr << std::endl;
#endif

	if (mFeedHolder)
	{
		mFeedHolder->openComments(feedId(), groupId(), messageId(), title);
	}
}
Example #16
0
void PostedListWidget::loadPost(const RsPostedPost &post)
{
	/* Group is not always available because of the TokenQueue */
	RsPostedGroup dummyGroup;
	dummyGroup.mMeta.mGroupId = groupId();

	PostedItem *item = new PostedItem(this, 0, dummyGroup, post, true, false);
	connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
	mPosts.insert(post.mMeta.mMsgId, item);
	//QLayout *alayout = ui.scrollAreaWidgetContents->layout();
	//alayout->addWidget(item);
	mPostItems.push_back(item);
}
Example #17
0
bool PostedGroupItem::setGroup(const RsPostedGroup &group)
{
	if (groupId() != group.mMeta.mGroupId) {
		std::cerr << "PostedGroupItem::setContent() - Wrong id, cannot set post";
		std::cerr << std::endl;
		return false;
	}

	mGroup = group;
	fill();

	return true;
}
Example #18
0
void PostedItem::readToggled(bool checked)
{
	if (mInFill) {
		return;
	}

	RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());

	uint32_t token;
	rsPosted->setMessageReadStatus(token, msgPair, !checked);

	setReadStatus(false, checked);
}
void GxsChannelPostsWidget::toggleAutoDownload()
{
    RsGxsGroupId grpId = groupId();
    if (grpId.isNull()) {
        return;
    }

    bool autoDownload ;
    if(!rsGxsChannels->getChannelAutoDownload(grpId,autoDownload) || !rsGxsChannels->setChannelAutoDownload(grpId, !autoDownload))
    {
        std::cerr << "GxsChannelDialog::toggleAutoDownload() Auto Download failed to set";
        std::cerr << std::endl;
    }
}
Example #20
0
void GxsChannelPostItem::readToggled(bool checked)
{
	if (mInFill) {
		return;
	}

	mCloseOnRead = false;

	RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());

	uint32_t token;
	rsGxsChannels->setMessageReadStatus(token, msgPair, !checked);

	setReadStatus(false, checked);
}
Example #21
0
/**
 * Initializes a multicast receiver.
 *
 * @param[out] receiver               The receiver to initialize.
 * @param[in]  hostId                 Address of the TCP server from which to
 *                                    retrieve missed data-blocks. May be
 *                                    hostname or IPv4 address.
 * @param[in]  tcpPort                Port number of the TCP server to which to
 *                                    connect.
 * @param[in]  notifier               Receiving application notifier. Freed by
 *                                    `mcastReceiver_free()`.
 * @param[in]  mcastAddr              Address of the multicast group to receive.
 *                                    May be groupname or IPv4 address.
 * @param[in]  mcastPort              Port number of the multicast group.
 * @param[in]  mcastIface             IP address of interface for receiving
 *                                    multicast packets.
 * @throws     std::invalid_argument  if @code{0==buf_func || 0==eof_func ||
 *                                    0==missed_prod_func || 0==addr}.
 * @throws     std::invalid_argument  if the multicast group address couldn't be
 *                                    converted into a binary IPv4 address.
 * @throws     std::runtime_error     if the IP address of the PA interface
 *                                    couldn't be obtained. (The PA address
 *                                    seems to be specific to Linux and might
 *                                    cause problems.)
 * @throws     std::runtime_error     if the socket couldn't be bound to the
 *                                    interface.
 * @throws     std::runtime_error     if the socket couldn't be bound to the
 *                                    Internet address.
 * @throws     std::runtime_error     if the multicast group couldn't be
 *                                    added to the socket.
 * @throws     std::exception         If the multicast receiver can't be
 *                                    initialized.
 */
static void
mcastReceiver_init(
    McastReceiver* const        receiver,
    const char* const           tcpAddr,
    const unsigned short        tcpPort,
    RecvProxy* const            notifier,
    const char* const           mcastAddr,
    const unsigned short        mcastPort,
    const char* const           mcastIface)
{
    std::string             hostId(tcpAddr);
    std::string             groupId(mcastAddr);
    receiver->notifier = notifier;
    receiver->fmtpReceiver = new fmtpRecvv3(hostId, tcpPort, groupId,
            mcastPort, notifier, mcastIface);
}
Example #22
0
bool PostedItem::setGroup(const RsPostedGroup &group, bool doFill)
{
	if (groupId() != group.mMeta.mGroupId) {
		std::cerr << "PostedItem::setGroup() - Wrong id, cannot set post";
		std::cerr << std::endl;
		return false;
	}

	mGroup = group;

	if (doFill) {
		fill();
	}

	return true;
}
Example #23
0
bool PostedItem::setPost(const RsPostedPost &post, bool doFill)
{
	if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
		std::cerr << "PostedItem::setPost() - Wrong id, cannot set post";
		std::cerr << std::endl;
		return false;
	}

	mPost = post;

	if (doFill) {
		fill();
	}

	return true;
}
Example #24
0
bool GxsChannelPostItem::setPost(const RsGxsChannelPost &post, bool doFill)
{
	if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
		std::cerr << "GxsChannelPostItem::setPost() - Wrong id, cannot set post";
		std::cerr << std::endl;
		return false;
	}

	mPost = post;

	if (doFill) {
		fill();
	}

	updateItem();

	return true;
}
Example #25
0
/**
 * Initializes a multicast receiver.
 *
 * @param[out] receiver               The receiver to initialize.
 * @param[in]  hostId                 Address of the TCP server from which to
 *                                    retrieve missed data-blocks. May be
 *                                    hostname or IP address.
 * @param[in]  tcpPort                Port number of the TCP server to which to
 *                                    connect.
 * @param[in]  bop_func               Function to call when the multicast layer
 *                                    has seen a beginning-of-product.
 * @param[in]  eop_func               Function to call when the multicast layer
 *                                    has completely received a product.
 * @param[in]  missed_prod_func       Function to call when a product is missed
 *                                    by the multicast layer.
 * @param[in]  mcastAddr              Address of the multicast group to receive.
 *                                    May be groupname or formatted IP address.
 * @param[in]  mcastPort              Port number of the multicast group.
 * @param[in]  obj                    Relevant object in the receiving
 *                                    application to pass to the above
 *                                    functions. May be NULL.
 * @throws     std::invalid_argument  if @code{0==buf_func || 0==eof_func ||
 *                                    0==missed_prod_func || 0==addr}.
 * @throws     std::invalid_argument  if the multicast group address couldn't be
 *                                    converted into a binary IPv4 address.
 * @throws     std::runtime_error     if the IP address of the PA interface
 *                                    couldn't be obtained. (The PA address
 *                                    seems to be specific to Linux and might
 *                                    cause problems.)
 * @throws     std::runtime_error     if the socket couldn't be bound to the
 *                                    interface.
 * @throws     std::runtime_error     if the socket couldn't be bound to the
 *                                    Internet address.
 * @throws     std::runtime_error     if the multicast group couldn't be
 *                                    added to the socket.
 * @throws     std::exception         If the multicast receiver can't be
 *                                    initialized.
 */
static void
mcastReceiver_init(
    McastReceiver* const        receiver,
    const char* const           tcpAddr,
    const unsigned short        tcpPort,
    const BopFunc               bop_func,
    const EopFunc               eop_func,
    const MissedProdFunc        missed_prod_func,
    const char* const           mcastAddr,
    const unsigned short        mcastPort,
    void* const                 obj)
{
    std::string             hostId(tcpAddr);
    std::string             groupId(mcastAddr);
    // Following object will be deleted by `vcmtpRecvv3` destructor
    receiver->notifier =
            new PerProdNotifier(bop_func, eop_func, missed_prod_func, obj);
    vcmtpRecvv3*         rcvr = new vcmtpRecvv3(hostId, tcpPort, groupId,
            mcastPort, receiver->notifier);
}
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool related)
{
    GxsChannelPostItem *item = NULL;
    if (related) {
        FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(post.mMeta.mGroupId, post.mMeta.mMsgId);
        item = dynamic_cast<GxsChannelPostItem*>(feedItem);
    }
    if (item) {
        item->setPost(post);
        ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
    } else {
        /* Group is not always available because of the TokenQueue */
        RsGxsChannelGroup dummyGroup;
        dummyGroup.mMeta.mGroupId = groupId();
        dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
        GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
        ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
    }

    ui->fileWidget->addFiles(post, related);
}
Example #27
0
void PostedListWidget::getRankings()
{
	if (groupId().isNull())
		return;

	std::cerr << "PostedListWidget::getRankings()";
	std::cerr << std::endl;

	int oldSortMethod = mSortMethod;

	QObject* button = sender();
	if(button == ui->hotSortButton)
	{
		mSortMethod = RsPosted::HotRankType;
	}
	else if(button == ui->topSortButton)
	{
		mSortMethod = RsPosted::TopRankType;
	}
	else if(button == ui->newSortButton)
	{
		mSortMethod = RsPosted::NewRankType;
	}
	else
	{
		return;
	}

	if (oldSortMethod != mSortMethod)
	{
		/* Reset Counter */
		mPostIndex = 0;
		updateShowText();
	}

	applyRanking();
}
Example #28
0
/* Set the passed DeviceGray image (which should be a PS style image
 * dictionary) as a soft mask.
 */
Bool pdf_setGrayImageAsSoftMask(PDFCONTEXT *pdfc, OBJECT image)
{
  Group *group = NULL ;
  Bool result = FALSE ;

  PDF_CHECK_MC(pdfc);

#define return DO_NOT_RETURN_-_SET_result_INSTEAD!
  /* We need to save the current gstate before we install the DeviceGray color
     space. */
  if ( gs_gpush(GST_GROUP) ) {
    int32 gid = gstackptr->gId ;

    /* Set the colorspace to device gray and initialise the constant alpha. */
    if ( gsc_setcolorspacedirect(gstateptr->colorInfo, GSC_FILL, SPACE_DeviceGray)) {
      OBJECT gray = OBJECT_NOTVM_NAME(NAME_DeviceGray, LITERAL) ;

      tsSetConstantAlpha(gsTranState(gstateptr), FALSE, 1, gstateptr->colorInfo);

      /* Open a group to capture the image. */
      if ( groupOpen(pdfc->corecontext->page, gray, TRUE /*I*/, FALSE /*K*/,
                     TRUE /*Banded*/, NULL /*bgcolor*/, NULL /*xferfn*/,
                     NULL /*patternTA*/, GroupLuminositySoftMask, &group)) {
        if ( gs_gpush(GST_GSAVE) ) {
          OBJECT psDict = OBJECT_NOTVM_NOTHING;

          /* Copy the pdf dictionary into PostScript memory as we're calling a
             PostScript function (we don't want to risk having a mixed pdf/ps
             memory dictionary). */
          if ( pdf_copyobject(NULL, &image, &psDict)) {
            PDF_IMC_PARAMS* imc;

            /* Get hold of the PDF stack. */
            PDF_GET_IMC(imc);

            /* Draw the image. */
            if ( push(&psDict, &imc->pdfstack) ) {
              if ( gs_image(pdfc->corecontext, &imc->pdfstack)) {
                result = TRUE ;
              } else {
                pop(&imc->pdfstack) ;
              }
            }
          } else /* Some routes through pdf_copyobject don't set errors. */
            result = error_handler(VMERROR);
        }

        /* Close the group. */
        if ( !groupClose(&group, result) )
          result = FALSE ;
      }
    }

    /* Restore gstate. */
    if ( !gs_cleargstates(gid, GST_GROUP, NULL) )
      result = FALSE;

    /* Install the soft mask. */
    if ( result )
      result = tsSetSoftMask(gsTranState(gstateptr), LuminositySoftMask,
                             groupId(group), gstateptr->colorInfo);
  }

#undef return
  return result;
}
Example #29
0
void GxsFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, bool complete)
{
	GxsGroupFeedItem::fillDisplay(updateBroadcastBase, complete);

	std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
	updateBroadcastBase->getAllMsgIds(msgs);

	if (!msgs.empty())
	{
		std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
		if (mit != msgs.end())
		{
			const std::vector<RsGxsMessageId> &msgIds = mit->second;
			if (std::find(msgIds.begin(), msgIds.end(), messageId()) != msgIds.end()) {
				requestMessage();
			}
		}
	}
}