Ejemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////
// Subtitles
//////////////////////////////////////////////////////////////////////////
void SoundQueue::updateSubtitles() {
	Common::StackLock locker(_mutex);

	uint32 index = 0;
	SubtitleEntry *subtitle = NULL;

	for (Common::List<SubtitleEntry *>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
		uint32 current_index = 0;
		SoundEntry *soundEntry = (*i)->getSoundEntry();
		SoundStatus status = (SoundStatus)soundEntry->getStatus().status;

		if (!(status & kSoundStatus_40)
		 || status & kSoundStatus_180
		 || soundEntry->getTime() == 0
		 || (status & kSoundStatusFilter) < 6
		 || ((getFlags()->nis & 0x8000) && soundEntry->getPriority() < 90)) {
			 current_index = 0;
		} else {
			current_index = soundEntry->getPriority() + (status & kSoundStatusFilter);

			if (_currentSubtitle == (*i))
				current_index += 4;
		}

		if (index < current_index) {
			index = current_index;
			subtitle = (*i);
		}
	}

	if (_currentSubtitle == subtitle) {
		if (subtitle)
			subtitle->setupAndDraw();

		return;
	}

	if (!subtitle)
		return;

	if (_subtitlesFlag & 1)
		subtitle->drawOnScreen();

	subtitle->loadData();
	subtitle->setupAndDraw();
}
Ejemplo n.º 2
0
void PicButtonWidget::drawWidget() {
	g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags());

	if (_gfx.getPixels()) {
		// Check whether the set up surface needs to be converted to the GUI
		// color format.
		const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
		if (_gfx.format != requiredFormat) {
			_gfx.convertToInPlace(requiredFormat);
		}

		const int x = _x + (_w - _gfx.w) / 2;
		const int y = _y + (_h - _gfx.h) / 2;

		g_gui.theme()->drawSurface(Common::Rect(x, y, x + _gfx.w,  y + _gfx.h), _gfx, _state, _alpha, _transparency);
	}
}
Ejemplo n.º 3
0
int
process_switchB(ea_t curr, ea_t start, ea_t func_end)
{
  ea_t diff = start - curr, 
       min = func_end,
       ptr;
  unsigned long i;

  if ( diff && diff < 4 )
  {
    do_unknown_range(curr, diff, true);
  }
#ifdef PIC_DEBUG
 RP_TRACE2("start %X, to %X\n", start, func_end);
#endif
  ptr = get_next_code(start);
  if ( NULL == ptr )
   do_unknown(start,false);
  else
  {
   if ( isTail(getFlags(start)) )
   {
     do_unknown(prev_not_tail(start),false);
   }
   else
     do_unknown_range(start, ptr-start, true);
  }
  for ( i = 0; start+i < min; i += 4 )
  {
    ptr = got_addr - get_long(start + i);
#ifdef PIC_DEBUG
 RP_TRACE3("min is %X, ptr %X, i %d\n", min, ptr, i);
#endif
    if ( ptr < func_end )
    {
      if ( ptr < min )
        min = ptr;
#ifdef PIC_DEBUG
 RP_TRACE2("one_switch_entry %X, ptr %X\n", start+i, ptr );
#endif
      one_switch_entry(start+i, ptr);
    } else
     break; /* end ? */
  }
  return (i>>2);
}
Ejemplo n.º 4
0
/**
 * ifaceGetFlags
 *
 * @ifname : name of the interface
 * @flags : pointer to short holding the flags on success
 *
 * Get the flags of the interface. Returns 0 on success, -errno on failure.
 */
int
ifaceGetFlags(const char *ifname, short *flags) {
    struct ifreq ifr;
    int rc;
    int fd = socket(PF_PACKET, SOCK_DGRAM, 0);

    if (fd < 0)
        return -errno;

    rc = getFlags(fd, ifname, &ifr);

    *flags = ifr.ifr_flags;

    VIR_FORCE_CLOSE(fd);

    return rc;
}
Ejemplo n.º 5
0
bool TimeBase::isRunning() {
	if (_paused && _pausedRate != 0)
		return true;

	Common::Rational rate = getRate();

	if (rate == 0)
		return false;

	if (getFlags() & kLoopTimeBase)
		return true;

	if (rate > 0)
		return getTime() != getStop();

	return getTime() != getStart();
}
Ejemplo n.º 6
0
//////////////////////////////////////////////////////////////////////////
// Overlays & elements
//////////////////////////////////////////////////////////////////////////
void Menu::checkHotspots() {
	if (!_isShowingMenu)
		return;

	if (!getFlags()->shouldRedraw)
		return;

	if (_isShowingCredits)
		return;

	SceneHotspot *hotspot = NULL;
	getScenes()->get(getState()->scene)->checkHotSpot(getCoords(), &hotspot);

	if (hotspot)
		handleEvent((StartMenuAction)hotspot->action, _mouseFlags);
	else
		hideOverlays();
}
v8::Handle<v8::Value> V8DirectoryEntrySync::getDirectoryCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.DirectoryEntrySync.getDirectory");
    DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
    ExceptionCode ec = 0;
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
    RefPtr<WebKitFlags> flags = getFlags(args[1], ec);
    if (UNLIKELY(ec)) {
        V8Proxy::setDOMException(ec);
        return v8::Handle<v8::Value>();
    }
    RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
    if (UNLIKELY(ec)) {
        V8Proxy::setDOMException(ec);
        return v8::Handle<v8::Value>();
    }
    return toV8(result.release());
}
Ejemplo n.º 8
0
void OperatorWidget::getContent(OpaOperatorParams * params)
{
    params->flags = getFlags();
    params->volume = ui->volumeSlide->value();

    params->coarse = ui->coarseDial->value();
    params->fine = ui->fineDial->value();
    params->LFOSpeed = ui->LFOSpeedDial->value();
    params->LFOAmount = ui->LFOAmountDial->value();
    params->feedback = ui->feedbackDial->value();

    params->envAttack = ui->attackDial->value();
    params->envDecay = ui->decayDial->value();
    params->envSusLevel = ui->sustainDial->value();
    params->envIniLevel = ui->initDial->value();
    params->envRelease = ui->releaseDial->value();

}
Ejemplo n.º 9
0
//////////////////////////////////////////////////////////////////////////
// Subtitles
//////////////////////////////////////////////////////////////////////////
void SoundQueue::updateSubtitles() {
	uint32 index = 0;
	SubtitleEntry *subtitle = NULL;

	for (Common::List<SubtitleEntry *>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
		uint32 current_index = 0;
		SoundEntry *soundEntry = (*i)->getSoundEntry();
		SoundFlag status = (SoundFlag)soundEntry->getStatus();

		if (!(status & kSoundFlagPlaying)
		 || status & kSoundFlagMute
		 || soundEntry->getTime() == 0
		 || (status & kSoundVolumeMask) < kVolume6
		 || ((getFlags()->nis & 0x8000) && soundEntry->getPriority() < 90)) {
			 current_index = 0;
		} else {
			current_index = soundEntry->getPriority() + (status & kSoundVolumeMask);

			if (_currentSubtitle == (*i))
				current_index += 4;
		}

		if (index < current_index) {
			index = current_index;
			subtitle = (*i);
		}
	}

	if (_currentSubtitle == subtitle) {
		if (subtitle)
			subtitle->setupAndDraw();

		return;
	}

	if (!subtitle)
		return;

	if (_subtitlesFlag & 1)
		subtitle->drawOnScreen();

	subtitle->loadData();
	subtitle->setupAndDraw();
}
Ejemplo n.º 10
0
void View::AttachedToWindow()
{
  lock();
  
  	// First, add to the Window's pulse list if this view needs it.
	  if ( (getFlags() & PULSE_NEEDED) != 0 )
		  if ( GetWindow() != NULL ) GetWindow()->AddPulseChild( this );


  // ...
  for ( int i = 0; i < CountChildren(); i++ )
   {
     View *view = ChildAt(i);
           view->_window = GetWindow();
	       view->AttachedToWindow();
   }

  unlock();
}
Ejemplo n.º 11
0
status_t BnMemoryHeap::onTransact(
        uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
       case HEAP_ID: {
            CHECK_INTERFACE(IMemoryHeap, data, reply);
            reply->writeFileDescriptor(getHeapID());
            reply->writeInt32(getSize());
            reply->writeInt32(getFlags());

#ifndef BINDER_COMPAT
            reply->writeInt32(getOffset());
#endif
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
Ejemplo n.º 12
0
std::string Buddy::getSafeName() {
	if (m_jid.isValid()) {
		return m_jid.getNode();
	}
	std::string name = getName();
// 	Transport::instance()->protocol()->prepareUsername(name, purple_buddy_get_account(m_buddy));
	if (getFlags() & BUDDY_JID_ESCAPING) {
		name = Swift::JID::getEscapedNode(name);
	}
	else {
		if (name.find_last_of("@") != std::string::npos) {
			name.replace(name.find_last_of("@"), 1, "%"); // OK
		}
	}
// 	if (name.empty()) {
// 		Log("SpectrumBuddy::getSafeName", "Name is EMPTY! Previous was " << getName() << ".");
// 	}
	return name;
}
Ejemplo n.º 13
0
bool STValidation::isValid (uint256 const& signingHash) const
{
    try
    {
        if (publicKeyType(getSignerPublic()) != KeyType::secp256k1)
            return false;

        return verifyDigest (getSignerPublic(),
            signingHash,
            makeSlice(getFieldVL (sfSignature)),
            getFlags () & vfFullyCanonicalSig);
    }
    catch (std::exception const&)
    {
        JLOG (debugLog().error())
            << "Exception validating validation";
        return false;
    }
}
Ejemplo n.º 14
0
void LiveRange::addSegment(InstNumberT Start, InstNumberT End, CfgNode *Node) {
  if (getFlags().getSplitGlobalVars()) {
    // Disable merging to make sure a live range 'segment' has a single node.
    // Might be possible to enable when the target segment has the same node.
    assert(NodeMap.find(Start) == NodeMap.end());
    NodeMap[Start] = Node;
  } else {
    if (!Range.empty()) {
      // Check for merge opportunity.
      InstNumberT CurrentEnd = Range.back().second;
      assert(Start >= CurrentEnd);
      if (Start == CurrentEnd) {
        Range.back().second = End;
        return;
      }
    }
  }
  Range.push_back(RangeElementType(Start, End));
}
Ejemplo n.º 15
0
void
process_switchA(ea_t curr, ea_t start, unsigned int N)
{
  ea_t diff = start - curr;
  unsigned long i;

  if ( diff && diff < 4 )
  {
    do_unknown_range(curr, diff, true);
  }
  if ( isTail(getFlags(start)) )
     do_unknown(prev_not_tail(start),false);
  else
     do_unknown_range(start, N << 2, true);
  for ( i = 0; i <= N; i++ )
  {
    diff = start + (i<<2);
    one_switch_entry(diff, got_addr - get_long(diff));
  }
}
Ejemplo n.º 16
0
std::vector<glm::vec4> Mesh::buildVertices() const {
  int flags = getFlags();
  size_t attributeCount = getAttributeCount();
  size_t vertexCount = positions.size();
  std::vector<glm::vec4> vertices;
  vertices.reserve(vertexCount * attributeCount);
  for (size_t i = 0; i < vertexCount; ++i) {
    vertices.push_back(positions[i]);
    if (flags & gl::Geometry::Flag::HAS_NORMAL) {
      vertices.push_back(normals[i]);
    }
    if (flags & gl::Geometry::Flag::HAS_COLOR) {
      vertices.push_back(glm::vec4(colors[i], 1));
    }
    if (flags & gl::Geometry::Flag::HAS_TEXTURE) {
      vertices.push_back(glm::vec4(texCoords[i], 1, 1));
    }
  }
  return vertices;
}
Ejemplo n.º 17
0
static int idaapi hook(void *user_data, int event_id, va_list va) {
  static ea_t old_addr = 0;
  ea_t addr;
  if (event_id == view_curpos) {
    addr = get_screen_ea();
    if (old_addr != addr) {
      if (isCode(getFlags(addr))) {
        // don't update the address if it's already the qira address
        if (addr != qira_address) {
          set_qira_address(addr);
          update_address("iaddr", addr);
        }
      } else {
        update_address("daddr", addr);
      }
    }
    old_addr = addr;
  }
  return 0;
}
Ejemplo n.º 18
0
ea_t find_instruction_backward(ea_t start, uint16 itype)
{
	func_t *f = get_func(start);
	if(f)
	{
		ea_t addr = prev_head(start, f->startEA);
		while (addr != BADADDR)
		{
			flags_t flags = getFlags(addr);
			if (isHead(flags) && isCode(flags))
			{
				ua_ana0(addr);
				if(cmd.itype == itype)return addr;

			}
			addr = prev_head(addr, f->startEA);
		}
	}
	return BADADDR;
}
Ejemplo n.º 19
0
void PicButtonWidget::drawWidget() {
	g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags());

	if (_gfx->pixels) {
		// Check whether the set up surface needs to be converted to the GUI
		// color format.
		const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
		if (_gfx->format != requiredFormat) {
			Graphics::Surface *converted = _gfx->convertTo(requiredFormat);
			_gfx->free();
			delete _gfx;
			_gfx = converted;
		}

		const int x = _x + (_w - _gfx->w) / 2;
		const int y = _y + (_h - _gfx->h) / 2;

		g_gui.theme()->drawSurface(Common::Rect(x, y, x + _gfx->w,  y + _gfx->h), *_gfx, _state, _alpha, _transparency);
	}
}
Ejemplo n.º 20
0
Archivo: lemon.c Proyecto: Ndunmo/lemon
int main(int argc, char *argv[]) {

    if(argc < 2) {
        fprintf(stderr, "Usage: %s [-a <number of attemps>|-e <onerror> '<args>'|-r <onrestart> '<args>'] <program> <args>\n", argv[0]);
        exit(1);
    }


    int i;
    command_options *commands = malloc(sizeof(*commands));

    getFlags(argc, argv, commands);

    for(i = 0; i < commands->max_attempts; i++) {
        start(commands);
        on_restart(commands);
    }

    return 0;
}
Ejemplo n.º 21
0
//////////////////////////////////////////////////////////////////////////
// Setup
void Menu::setup() {

	// Clear drawing queue
	getScenes()->removeAndRedraw(&_frames[kOverlayAcorn], false);
	SAFE_DELETE(_seqAcorn);

	// Load Menu scene
	// + 1 = normal menu with open egg / clock
	// + 2 = shield menu, when no savegame exists (no game has been started)
	_isGameStarted = _lowerTime >= kTimeStartGame;
	getScenes()->loadScene((SceneIndex)(_isGameStarted ? _gameId * 5 + 1 : _gameId * 5 + 2));
	getFlags()->shouldRedraw = true;
	getLogic()->updateCursor();

	//////////////////////////////////////////////////////////////////////////
	// Load Acorn sequence
	_seqAcorn = loadSequence(getAcornSequenceName(_isGameStarted ? getNextGameId() : kGameBlue));

	//////////////////////////////////////////////////////////////////////////
	// Check if we loaded sequences before
	if (_seqTooltips && _seqTooltips->count() > 0)
		return;

	// Load all static data
	_seqTooltips = loadSequence("helpnewr.seq");
	_seqEggButtons = loadSequence("buttns.seq");
	_seqButtons = loadSequence("quit.seq");
	_seqCity1 = loadSequence("jlinetl.seq");
	_seqCity2 = loadSequence("jlinecen.seq");
	_seqCity3 = loadSequence("jlinebr.seq");
	_seqCredits = loadSequence("credits.seq");

	_frames[kOverlayTooltip] = new SequenceFrame(_seqTooltips);
	_frames[kOverlayEggButtons] = new SequenceFrame(_seqEggButtons);
	_frames[kOverlayButtons] = new SequenceFrame(_seqButtons);
	_frames[kOverlayAcorn] = new SequenceFrame(_seqAcorn);
	_frames[kOverlayCity1] = new SequenceFrame(_seqCity1);
	_frames[kOverlayCity2] = new SequenceFrame(_seqCity2);
	_frames[kOverlayCity3] = new SequenceFrame(_seqCity3);
	_frames[kOverlayCredits] = new SequenceFrame(_seqCredits);
}
Ejemplo n.º 22
0
void            FCDeAllocate( void ) {
//==============================

    call_handle         handle;
    sym_id              arr;
    uint                num;

    handle = InitCall( RT_DEALLOCATE );
    for( num = 0; (arr = GetPtr()) != NULL; ++num ) {
        CGAddParm( handle, CGFEName( arr, TY_POINTER ), TY_POINTER );
        CGAddParm( handle, getFlags( arr ), FLAG_PARM_TYPE );
    }
    CGAddParm( handle, CGInteger( num, TY_UNSIGNED ), TY_UNSIGNED );
    if( GetU16() & ALLOC_STAT ) {
        FCodeSequence();
        CGAddParm( handle, XPop(), TY_POINTER );
    } else {
        CGAddParm( handle, CGInteger( 0, TY_POINTER ), TY_POINTER );
    }
    CGDone( CGCall( handle ) );
}
Ejemplo n.º 23
0
string TcpPacket::toString ()
{
	ostringstream out;
	Packet::PAYLOAD_BUFFER opts = getOptions ();

	out << "TCP packet" << std::endl
		<< "\tsource port: \t"		<< getSourceport() << std::endl
		<< "\tdest port: \t"		<< getDestport() << std::endl
		<< "\tsequencenum: \t"		<< getSequencenum() << std::endl
		<< "\tacknum: \t"		<< getAcknum() << std::endl
		<< "\theaderlen: \t"		<< getHeaderlength() << " bytes" << std::endl
		<< "\tflags: \t\t0x"		<< std::hex << std::setw(4) << std::setfill ('0') << getFlags () << std::endl << std::dec
		<< "\twindowsize: \t"		<< getWindowsize() << std::endl
		<< "\tchecksum: \t0x"		<< std::hex << std::setw(4) << std::setfill ('0') << getChecksum () << std::endl << std::dec
		<< "\turgent pnt: \t"		<< getUrgentpointer() << std::endl
		<< "\toptions len: \t"		<< opts.size << std::endl
		<< "\toptions: \t"		<< opts.toString ();

	opts.destroy ();
	return out.str ();
}
Ejemplo n.º 24
0
void initFlags() {
  SetCommonFlagsDefaults();
  {
    CommonFlags cf;
    cf.CopyFrom(*common_flags());
    cf.exitcode = 1;
    OverrideCommonFlags(cf);
  }
  Flags *f = getFlags();
  f->setDefaults();

  FlagParser scudo_parser;
  RegisterScudoFlags(&scudo_parser, f);
  RegisterCommonFlags(&scudo_parser);

  scudo_parser.ParseString(GetEnv("SCUDO_OPTIONS"));

  InitializeCommonFlags();

  // Sanity checks and default settings for the Quarantine parameters.

  if (f->QuarantineSizeMb < 0) {
    const int DefaultQuarantineSizeMb = 64;
    f->QuarantineSizeMb = DefaultQuarantineSizeMb;
  }
  // We enforce an upper limit for the quarantine size of 4Gb.
  if (f->QuarantineSizeMb > (4 * 1024)) {
    dieWithMessage("ERROR: the quarantine size is too large\n");
  }
  if (f->ThreadLocalQuarantineSizeKb < 0) {
    const int DefaultThreadLocalQuarantineSizeKb = 1024;
    f->ThreadLocalQuarantineSizeKb = DefaultThreadLocalQuarantineSizeKb;
  }
  // And an upper limit of 128Mb for the thread quarantine cache.
  if (f->ThreadLocalQuarantineSizeKb > (128 * 1024)) {
    dieWithMessage("ERROR: the per thread quarantine cache size is too "
                   "large\n");
  }
}
Ejemplo n.º 25
0
/*
*******************************************************************
* Function: 
*
* Description: 
*    
* Parameters: 
*
* Returns: 
*
*******************************************************************
*/
void xDistributedPoint3F::pack(xNStream *bstream)
{

	if (this->getPropertyInfo()->mPredictionType == E_PTYPE_PREDICTED)
	{

		TNL::Point3f p;

		p.x  = mCurrentValue.x;
		p.y  = mCurrentValue.y;
		p.z = mCurrentValue.z;
		bstream->writePointCompressed(p,1.0f);

		TNL::Point3f v;
		v.x  = mDifference.x;
		v.y  = mDifference.y;
		v.z = mDifference.z;
		bstream->writePointCompressed(v,1.0f);
	}


	if (this->getPropertyInfo()->mPredictionType == E_PTYPE_RELIABLE)
	{
		TNL::Point3f p;

		p.x  = mCurrentValue.x;
		p.y  = mCurrentValue.y;
		p.z = mCurrentValue.z;
		bstream->writePointCompressed(p,1.0f);

	}
		int flags = getFlags();
		flags &= (~E_DP_NEEDS_SEND);
		setFlags(flags);



}
Ejemplo n.º 26
0
void processRangeAccessWorkingSet(uptr PC, uptr Addr, SIZE_T Size,
                                  bool IsWrite) {
  if (Size == 0)
    return;
  SIZE_T I = 0;
  uptr LineSize = getFlags()->cache_line_size;
  // As Addr+Size could overflow at the top of a 32-bit address space,
  // we avoid the simpler formula that rounds the start and end.
  SIZE_T NumLines = Size / LineSize +
    // Add any extra at the start or end adding on an extra line:
    (LineSize - 1 + Addr % LineSize + Size % LineSize) / LineSize;
  byte *Shadow = (byte *)appToShadow(Addr);
  // Write shadow bytes until we're word-aligned.
  while (I < NumLines && (uptr)Shadow % 4 != 0) {
    if ((*Shadow & ShadowAccessedVal) != ShadowAccessedVal)
      *Shadow |= ShadowAccessedVal;
    ++Shadow;
    ++I;
  }
  // Write whole shadow words at a time.
  // Using a word-stride loop improves the runtime of a microbenchmark of
  // memset calls by 10%.
  u32 WordValue = ShadowAccessedVal | ShadowAccessedVal << 8 |
    ShadowAccessedVal << 16 | ShadowAccessedVal << 24;
  while (I + 4 <= NumLines) {
    if ((*(u32*)Shadow & WordValue) != WordValue)
      *(u32*)Shadow |= WordValue;
    Shadow += 4;
    I += 4;
  }
  // Write any trailing shadow bytes.
  while (I < NumLines) {
    if ((*Shadow & ShadowAccessedVal) != ShadowAccessedVal)
      *Shadow |= ShadowAccessedVal;
    ++Shadow;
    ++I;
  }
}
Ejemplo n.º 27
0
std::uint64_t
SetRegularKey::calculateBaseFee (
    PreclaimContext const& ctx)
{
    auto const id = ctx.tx.getAccountID(sfAccount);
    auto const spk = ctx.tx.getSigningPubKey();

    if (publicKeyType (makeSlice (spk)))
    {
        if (calcAccountID(PublicKey (makeSlice(spk))) == id)
        {
            auto const sle = ctx.view.read(keylet::account(id));

            if (sle && (! (sle->getFlags () & lsfPasswordSpent)))
            {
                // flag is armed and they signed with the right account
                return 0;
            }
        }
    }

    return Transactor::calculateBaseFee (ctx);
}
Ejemplo n.º 28
0
//--------------------------------------------------------------------------
// find all dwords equal to 'ea' and remember their translations
// search in the current module
static bool calc_thunk_target(uint32 ea32, uint32 imp32)
{
  bool matched = false;

  for ( ea_t pos = curmod.startEA;
        pos <= curmod.endEA
     && (pos = bin_search(pos, curmod.endEA, (uchar *)&ea32, NULL,
                          4, BIN_SEARCH_FORWARD,
                          BIN_SEARCH_NOBREAK|BIN_SEARCH_CASE)) != BADADDR;
        pos += sizeof(DWORD) )
  {
    if ( pos & 3 )
      continue;

    flags_t F = getFlags(pos);
    if( isTail(F) )
      continue;

    matched = true;
    thunks[pos] = imp32;
  }
  return matched;
}
Ejemplo n.º 29
0
api_return FilelistApi::handleQueueList(ApiRequest& aRequest, QueueItem::Flags aFlags) {
    const auto& reqJson = aRequest.getRequestBody();

    auto user = Deserializer::deserializeHintedUser(reqJson);
    auto directory = Util::toNmdcFile(JsonUtil::getOptionalFieldDefault<string>("directory", reqJson, "/", false));

    auto flags = aFlags;
    flags.setFlag(QueueItem::FLAG_PARTIAL_LIST);

    QueueItemPtr q = nullptr;
    try {
        q = QueueManager::getInstance()->addList(user, flags.getFlags(), directory);
    } catch (const Exception& e) {
        aRequest.setResponseErrorStr(e.getError());
        return websocketpp::http::status_code::bad_request;
    }

    aRequest.setResponseBody({
        { "id", user.user->getCID().toBase32() }
    });

    return websocketpp::http::status_code::ok;
}
Ejemplo n.º 30
0
// if doWork is complete or aborted, call endWork() and return true
bool LLWorkerClass::checkWork(bool aborting)
{
	LLMutexLock lock(&mMutex);
	bool complete = false, abort = false;
	if (mRequestHandle != LLWorkerThread::nullHandle())
	{
		LLWorkerThread::WorkRequest* workreq = (LLWorkerThread::WorkRequest*)mWorkerThread->getRequest(mRequestHandle);
		llassert_always(workreq);
		LLQueuedThread::status_t status = workreq->getStatus();
		if (status == LLWorkerThread::STATUS_ABORTED)
		{
			complete = true;
			abort = true;
		}
		else if (status == LLWorkerThread::STATUS_COMPLETE)
		{
			complete = true;
		}
		else
		{
			llassert_always(!aborting || (workreq->getFlags() & LLQueuedThread::FLAG_ABORT));
		}
		if (complete)
		{
			llassert_always(!(getFlags(WCF_WORKING)));
			endWork(workreq->getParam(), abort);
			mWorkerThread->completeRequest(mRequestHandle);
			mRequestHandle = LLWorkerThread::nullHandle();
			clearFlags(WCF_HAVE_WORK);
		}
	}
	else
	{
		complete = true;
	}
	return complete;
}