Пример #1
0
TVerdict CInitialiseStep::doTestStepL()
	{
    SetTestStepResult(EFail);	

 	INFO_PRINTF1(_L("Scheduler BUR test Init"));

    TSchedulerItemRef ref,ref2;

	_LIT(KBackupCondition, "AddCondition");
	
	TPtrC data;
	if (!GetStringFromConfig(ConfigSection(), KBackupCondition, data))
		{
		ERR_PRINTF1(KMissingInputParam);
		SetTestStepResult(EFail);
		User::Leave(KErrCorrupt);
		}

	_LIT(KTimeStr, "Time");
	_LIT(KTestStr, "Test");
	_LIT(KBackupStr, "Backup");
	_LIT(KRestoreStr, "Restore");
	_LIT(KRestoreStr1, "Restore1");

 	if (data == KTimeStr)
		{
		// Creates a time based schedule    
		_LIT(KSchTestName, "Persistent Schedule Test (Time)");				
		
	    // This is the time when we want the time-based schedule to fire
	    TDateTime datetime1(2000, EJanuary, 1, 10, 0, 0, 0);
	    TTsTime dueTime(datetime1, EFalse);

		AddTimeScheduleL(KSchTestName, dueTime, ref);
		_LIT(KSchTestName2, "Transient Time Schedule Test");				
		AddTransientTimeScheduleL(KSchTestName2, dueTime, ref2);
		}
	else
		{
		// Creates a condition based schedule    		
		_LIT(KSchTestName, "Persistent Schedule Test (Condition)");		
		
	    // If condition not met, task is run one year from now.
	    TDateTime datetime1(2001, EJanuary, 1, 10, 0, 0, 0);
	    TTsTime dueTime(datetime1, EFalse);

	    CSchConditionArray* conditionList = new (ELeave) CSchConditionArray(2);
	    CleanupStack::PushL(conditionList);
		
		if (data == KTestStr)
			{
			CreatePSKeyL(KTestKey1);
			AddTestConditionL(*conditionList, KTestKey1);
			AddConditionScheduleL(KSchTestName, dueTime, ref, *conditionList);
			}
		else if (data == KBackupStr)
			{
			// Only create sema if condition not triggered by test but by SBE
			iSem.CreateL();
			CreatePSKeyL(conn::KUidBackupRestoreKey);
			AddBackupConditionL(*conditionList);
			AddConditionScheduleL(KSchTestName, dueTime, ref, *conditionList);
			}
		else if (data == KRestoreStr || data == KRestoreStr1)
			{
			// Only create sema if condition not triggered by test but by SBE
			TRAPD(ignoreifalreadycreated, iSem.CreateL());
			if (ignoreifalreadycreated != KErrNone && ignoreifalreadycreated != KErrAlreadyExists)
				{
				User::Leave(ignoreifalreadycreated);
				}
			CreatePSKeyL(conn::KUidBackupRestoreKey);				
			AddRestoreConditionL(*conditionList);

			if (data==KRestoreStr1)
				{
				AddTransientConditionScheduleL(KSchTestName, dueTime,*conditionList);
				}
			else
				{
				AddConditionScheduleL(KSchTestName, dueTime, ref, *conditionList);				
				}				
			}
		else
			{
			SetTestStepResult(EFail);
			User::Leave(KErrCorrupt);
			}
		
		CleanupStack::PopAndDestroy(conditionList);    
		}

	SetTestStepResult(EPass);
	
	return TestStepResult();
	}
Пример #2
0
mt_mutex (mutex) StreamManager::StreamKey
StreamManager::addStream_locked (Stream      * const stream,
                                 ConstMemory   const path,
                                 bool          const fire_stream_added)
{
    logD_ (_func, "name: ", path, ", stream 0x", fmt_hex, (UintPtr) stream);

    StreamEntry * const stream_entry = new (std::nothrow) StreamEntry (NULL /* embed_container */, stream);
    assert (stream_entry);

    {
        StreamHash::EntryKey const entry_key = stream_hash.lookup (path);
        if (entry_key) {
            stream_entry->entry_key = entry_key;

            StRef<StreamHashEntry> * const hash_entry = entry_key.getDataPtr();
            assert (!(*hash_entry)->stream_list.isEmpty());

            bool stream_added = false;

            Stream * const old_stream = (*hash_entry)->stream_list.getFirst()->stream;
            Stream::MomentServerData * const old_stream_data = &old_stream->moment_data;
            if (old_stream_data->stream_info) {
                StreamInfo * const old_stream_info = static_cast <StreamInfo*> (old_stream_data->stream_info.ptr());

              // If the previous stream is waiting for streamer,
              // then bind the previous stream to the new one.

                logD_ (_func, "binding old_stream 0x", fmt_hex, (UintPtr) old_stream);

                if (old_stream_info->waiting_for_streamer) {
                    old_stream_info->waiting_for_streamer = false;

                    logD_ (_func, "waiting_for_streamer complete");

                    old_stream->setPublishingInProgress (true);
                    old_stream->bindToStream (stream /* bind_audio_stream */,
                                              stream /* bind_video_stream */,
                                              true   /* bind_audio */,
                                              true   /* bind_video */,
                                              true   /* propagate_close_audio */,
                                              true   /* propagate_close_video */);

                    stream_entry->list_el = (*hash_entry)->stream_list.prepend (stream_entry);
                    stream_added = true;
                }
            }

            if (!stream_added) {
                if (new_streams_on_top) {
                    (*hash_entry)->stream_list.getFirst()->displaced = true;
                    notifyDeferred_StreamClosed ((*hash_entry)->stream_list.getFirst()->stream);
                    stream_entry->list_el = (*hash_entry)->stream_list.prepend (stream_entry);
                } else {
                    stream_entry->list_el = (*hash_entry)->stream_list.append (stream_entry);
                }
            }
        } else {
            StRef<StreamHashEntry> const hash_entry = st_grab (new (std::nothrow) StreamHashEntry);
            stream_entry->list_el = hash_entry->stream_list.append (stream_entry);

            stream_entry->entry_key = stream_hash.add (path, hash_entry);
        }
    }

    if (fire_stream_added) {
        notifyDeferred_StreamAdded (stream, path);

        if (event_service) {
            StRef<String> esc_path;
            event_service->sendEvent (makeString ("stream add ", lineEscape (path, &esc_path)));
        }
    }

    return StreamKey (stream_entry);
}
Пример #3
0
/**
	Intended primarily as a visual check that the mode is displayed correctly, 
	this code also verifies that the number of physical colours matches the reported mode.
	Note that although written to test GCE, this test is general and applies to all display versions.
**/	
void CTScreenDeviceResSwitch::DeviceResSwitchL()
	{		
	INFO_PRINTF1(_L("DeviceResSwitchL: Entering function"));
	TInt error = KErrNone;
	TInt isTransparencySupportedResult = KErrNone;
		
	TRAP(error, isTransparencySupportedResult = IsTransparencySupportedL());
	
	if(error != KErrNone)
		{
		INFO_PRINTF1(_L("DeviceResSwitchL: Transparency is not supported. Exits."));
		return;
		}	
	
	TRAP(error, CalculateDisplayPropertiesL());
	
	if(error != KErrNone)
		{
		INFO_PRINTF1(_L("DeviceResSwitchL: Could not calculate display properties. Test not supported. Exits."));
		return;		
		}	

	TDisplayMode startDisplayMode = TheClient->iScreen->DisplayMode();
	TInt startColoursPixel = TDisplayModeUtils::NumDisplayModeColors(startDisplayMode);
		
	TPixelsAndRotation modeSettings;
	TheClient->iScreen->GetDefaultScreenSizeAndRotation(modeSettings);
	TRect r(TPoint(0, 0), modeSettings.iPixelSize);

	// Starts off full-screen. Only shrink it if it will still be large enough to run the test
	// It should be... the test only needs 60x20 pixels
	
	if(r.Width() > r.Height())
		{
		if(r.Width() > (CPrimaryColoursWin::kMinWidth) * (CPrimaryColoursWin::kShrinkFactor-2) * 3 / (CPrimaryColoursWin::kShrinkFactor * 2))
			{
			r.iTl.iX = r.iBr.iX / 3;				
			}
		}
	else
		{
		if (r.Height() > (CPrimaryColoursWin::kMinHeight) * (CPrimaryColoursWin::kShrinkFactor - 2) * 3/ (CPrimaryColoursWin::kShrinkFactor * 2))
			{
			r.iTl.iY = r.iBr.iY / 3;				
			}
		}
	if(r.Width() > (CPrimaryColoursWin::kMinWidth) * (CPrimaryColoursWin::kShrinkFactor - 2) / CPrimaryColoursWin::kShrinkFactor)
		{
		if(r.Height() > (CPrimaryColoursWin::kMinHeight) * (CPrimaryColoursWin::kShrinkFactor - 2) / CPrimaryColoursWin::kShrinkFactor)
			{
			r.Shrink(r.Width() / CPrimaryColoursWin::kShrinkFactor, r.Height() / CPrimaryColoursWin::kShrinkFactor);
			}
		}
		
	for(TInt i = 0; i < EColorLast; i++)
		{
		TDisplayMode tryMode = TDisplayMode(i);
		TInt tryColoursPixel = NumDisplayModeColors(tryMode);		
		
		INFO_PRINTF3(_L("DeviceResSwitchL: tryColoursPixel = %d, tryMode = %d"), tryColoursPixel, tryMode);
		
		if(TDisplayModeUtils::IsDisplayModeColor(tryMode) && startColoursPixel <= tryColoursPixel)
			{
				  //Create a test window at this mode, and see if it changes the screen mode
				{ // The braces define the lifetime of testWin. It must be destroyed before we check if mode changed back successfully.
				
				CPrimaryColoursWin* testWin1 = new (ELeave) CPrimaryColoursWin;
				CleanupStack::PushL(testWin1);
				
				TInt expectedColoursPerChannel = 1;
				TInt tt;
				
				testWin1->SetUpL(r.iTl, r.Size(), TheClient->iGroup, *TheClient->iGc, &tryMode);
				TheClient->iWs.Flush();
				TDisplayMode newDisplayMode = TheClient->iScreen->DisplayMode();
				
				TEST(TDisplayModeUtils::NumDisplayModeColors(newDisplayMode) >= tryColoursPixel);	
				
				if(!(TDisplayModeUtils::NumDisplayModeColors(newDisplayMode) >= tryColoursPixel))
					{
					ERR_PRINTF3(_L("testWin1: newDisplayMode = %d, tryColoursPixel = %d"), newDisplayMode, tryColoursPixel);
					}
				
				// Estimate the minimum number of shades of primary colours given the bits per pixel.
				// The maximum is twice this. Very appoximate but seems to work OK for 256 colours. Probably not good for grey modes. 
				for(tt = tryColoursPixel; tt >= 8; tt >>= 3)
					{
					expectedColoursPerChannel <<= 1;
					}
					
				// Draw some test data on the test window.
			    testWin1->DrawNow();
				TheClient->iWs.Flush();
				 
#ifdef VISIBLE_PAUSES
			    TheClient->StdLogWindow().LogMessage(EFalse, _L("Mode: "), tryMode);
				User::After(1000000);
#endif 
				TInt numUniqueColours = testWin1->CountUniquePlottedColours();
				INFO_PRINTF2(_L("testWin1: numUniqueColours = %d"), numUniqueColours);
			    testWin1->DrawNow();
			    TheClient->StdLogWindow().LogMessage(EFalse, _L("Channel Colours: "), numUniqueColours);
				TheClient->iWs.Flush();
				
#ifdef VISIBLE_PAUSES
				User::After(1000000); 
#endif
				// Read it back and see if it has the expected quality
				TEST(numUniqueColours >= (expectedColoursPerChannel * 3));
				
				if(!(numUniqueColours >= (expectedColoursPerChannel * 3)))
					{
					ERR_PRINTF3(_L("testWin1: numUniqueColours = %d, (expectedColoursPerChannel * 3) = %d"), numUniqueColours, (expectedColoursPerChannel * 3));
					}				
		
				/*
				 * Defect 107176 was rejected. This test for transparency is therefore removed.
				 * 
				 */
				if (false) //newDisplayMode != startDisplayMode)	 // Hide the window under a startmode window and see if we switch back?
				if (isTransparencySupportedResult==KErrNone && newDisplayMode != startDisplayMode)	 // Hide the window under a startmode window and see if we switch back?
				/*
				 * Defect 107176 was rejected. This test for transparency is therefore removed.
				 * The crash demonstrated by this code is related to the inconsistant support for origin and scale
				 * See defect DEF111847 and break request 2226
				 */
				if (false) //newDisplayMode != startDisplayMode)	 // Hide the window under a startmode window and see if we switch back?
					{
					// Demonstration of defect 107176
					// Create a translucent window which obscures the high-colour window
					// The existing code reduces the display colour depth because it thinks the obscured window is not visible any more
					// However, the obscured window is actually visible trough the transparency
					CPrimaryColoursWin* testWin2 = new (ELeave) CPrimaryColoursWin;
					CleanupStack::PushL(testWin2);
	
					testWin2->SetUpL(r.iTl - TPoint(20,20), r.Size() + TSize(40,40), TheClient->iGroup, *TheClient->iGc, &startDisplayMode, ETrue, 0x80);
					TheClient->iWs.Flush();
				    testWin2->DrawNow();
					TheClient->iWs.Flush();
					
					TDisplayMode newnewDisplayMode = TheClient->iScreen->DisplayMode();
					TInt newNumUniqueColours = testWin2->CountUniquePlottedColours();	
					INFO_PRINTF2(_L("testWin2: newNumUniqueColours = %d"), newNumUniqueColours);		
					
					TEST(newnewDisplayMode == newDisplayMode);				
				  
					if(!(newnewDisplayMode == newDisplayMode))
						{
						ERR_PRINTF3(_L("testWin2: newnewDisplayMode = %d, newDisplayMode = %d"), newnewDisplayMode, newDisplayMode);
						}
					  
				    testWin2->DrawNow();
					TheClient->iWs.Flush();
					
#ifdef VISIBLE_PAUSES
					User::After(1000000); 
#endif
					TheClient->iWs.Flush();
					
					CleanupStack::PopAndDestroy(testWin2);
					testWin2 = NULL;						
					}
					
					CleanupStack::PopAndDestroy(testWin1);
					testWin1 = NULL;
				}
			 
				TDisplayMode afterDisplayMode = TheClient->iScreen->DisplayMode();
				TEST(afterDisplayMode == startDisplayMode);
				
				if(afterDisplayMode != startDisplayMode)
					{
					ERR_PRINTF3(_L("DeviceResSwitchL: Original colour depth not restored. Was %i, now %i (TDisplayMode)"), startDisplayMode, afterDisplayMode);						
					}

#ifdef VISIBLE_PAUSES
				User::After(1000000); 
#endif			
			} // context 
// -----------------------------------------------------------------------------
// CSIPResponseSender::NewL
// -----------------------------------------------------------------------------
//
CSIPResponseSender* CSIPResponseSender::NewL()
    {
    return new (ELeave) CSIPResponseSender();
    }
Пример #5
0
/**
* @date     24/02/2010
* 
*  arguments handler. Here we parse the arguments, and instanciate the ui.
*
* @param    argc (in): argument count.
* @param    argv (in): arguments.
******************************************************************************/
void VtApp::ArgvReceived(int32 argc, char **argv)
{
   bool     b_Gui = false;
   bool     b_ActionFound = false;
   int32 i_CurArg;

   if(argc > 1)      
   {
      for(i_CurArg=1; i_CurArg<argc; i_CurArg++)
      {
         if(strcmp(argv[i_CurArg], "--help") == 0)
         {
            break;
         }
         else if(strcmp(argv[i_CurArg], "--hash") == 0)
         {
            i_CurArg++;
            if(i_CurArg < argc)
            {
               c_Hash.SetTo(argv[i_CurArg]);
               be_app->PostMessage(APP_MSG_ANALYZE_HASH);
               b_ActionFound = true;
               break;
            }
         }
         else if(strcmp(argv[i_CurArg], "--gui") == 0)
         {
            b_Gui = true;
         }
         else if(strcmp(argv[i_CurArg], "--force_upload") == 0)
         {
            pc_Uploader->ForceUpload(true);
         }
         else if(i_CurArg == argc-1)
         {
            c_FileName.SetTo(argv[i_CurArg]);
            be_app->PostMessage(APP_MSG_ANALYZE_FILE);
            b_ActionFound = true;
            break;
         }
      }
   }
   if(b_ActionFound == false)      
   {
      PrintHelp();
      be_app->PostMessage(B_QUIT_REQUESTED);
   }
   else
   {
      if(b_Gui == false)
         pc_Ui = new(std::nothrow) VtTui();
      else
         pc_Ui = new(std::nothrow) VtGui();
      if(pc_Ui != NULL)
      {
         BHandler *p_Handler;

         pc_Ui->SetUploader(pc_Uploader);
         p_Handler = pc_Ui->GetHandler();
         if(p_Handler != NULL)
            pc_Uploader->SetTarget(p_Handler);
      }
   }

}
 void construct(C* c, Args&&... args) {
     new ((void*)c) C(std::forward<Args>(args)...);
 }
Пример #7
0
inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string)
{
    StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure());
    object->finishCreation(exec->globalData(), string);
    return object;
}
Пример #8
0
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
{
   symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
   return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
}
Пример #9
0
FConstraintInstance * FConstraintInstance::Alloc()
{
	void* Memory = FMemory::Malloc(sizeof(FConstraintInstance));
	FMemory::Memzero(Memory, sizeof(FConstraintInstance));
	return new (Memory)FConstraintInstance();
}
Пример #10
0
void ScriptConsoleLine::Constructor(ScriptConsoleLine* self)
{
	new(self) ScriptConsoleLine();
}
Пример #11
0
void PhaseLive::compute(uint maxlrg) {
  _maxlrg   = maxlrg;
  _worklist = new (_arena) Block_List();

  // Init the sparse live arrays.  This data is live on exit from here!
  // The _live info is the live-out info.
  _live = (IndexSet*)_arena->Amalloc(sizeof(IndexSet)*_cfg._num_blocks);
  uint i;
  for( i=0; i<_cfg._num_blocks; i++ ) {
    _live[i].initialize(_maxlrg);
  }

  // Init the sparse arrays for delta-sets.
  ResourceMark rm;              // Nuke temp storage on exit

  // Does the memory used by _defs and _deltas get reclaimed?  Does it matter?  TT

  // Array of values defined locally in blocks
  _defs = NEW_RESOURCE_ARRAY(IndexSet,_cfg._num_blocks);
  for( i=0; i<_cfg._num_blocks; i++ ) {
    _defs[i].initialize(_maxlrg);
  }

  // Array of delta-set pointers, indexed by block pre_order-1.
  _deltas = NEW_RESOURCE_ARRAY(IndexSet*,_cfg._num_blocks);
  memset( _deltas, 0, sizeof(IndexSet*)* _cfg._num_blocks);

  _free_IndexSet = NULL;

  // Blocks having done pass-1
  VectorSet first_pass(Thread::current()->resource_area());

  // Outer loop: must compute local live-in sets and push into predecessors.
  uint iters = _cfg._num_blocks;        // stat counters
  for( uint j=_cfg._num_blocks; j>0; j-- ) {
    Block *b = _cfg._blocks[j-1];

    // Compute the local live-in set.  Start with any new live-out bits.
    IndexSet *use = getset( b );
    IndexSet *def = &_defs[b->_pre_order-1];
    DEBUG_ONLY(IndexSet *def_outside = getfreeset();)
    uint i;
    for( i=b->_nodes.size(); i>1; i-- ) {
      Node *n = b->_nodes[i-1];
      if( n->is_Phi() ) break;

      uint r = _names[n->_idx];
      assert(!def_outside->member(r), "Use of external LRG overlaps the same LRG defined in this block");
      def->insert( r );
      use->remove( r );
      uint cnt = n->req();
      for( uint k=1; k<cnt; k++ ) {
        Node *nk = n->in(k);
        uint nkidx = nk->_idx;
        if( _cfg._bbs[nkidx] != b ) {
          uint u = _names[nkidx];
          use->insert( u );
          DEBUG_ONLY(def_outside->insert( u );)
        }
      }
    }
Пример #12
0
Join* MultiJoin::splitSubset(const JBBSubset & leftSet,
                             const JBBSubset & rightSet,
                             NABoolean reUseMJ) const
{
  // At this point assert that none of the subsets has a group by member
  CMPASSERT ( (jbbSubset_.getGB() == NULL_CA_ID) &&
              (leftSet.getGB() == NULL_CA_ID) &&
              (rightSet.getGB() == NULL_CA_ID) );
#ifndef NDEBUG
  // assert that left + right == subSet_
  // and left intersect right = phi

  CANodeIdSet unionSet(leftSet.getJBBCs());
  CANodeIdSet intersectSet(leftSet.getJBBCs());

  unionSet += rightSet.getJBBCs();
  intersectSet.intersectSet(rightSet.getJBBCs());

  CMPASSERT ( (unionSet == jbbSubset_.getJBBCs()) &&
              (intersectSet.entries() == 0 ));
#endif

  // Note: Joins including left, semi, anti semi are only created when
  // a single jbbc connected via one of them is split as a single right
  // child. InnerNonSemi joins can be created for any split i.e. any
  // number of jbbcs on the left and the right of the join, but special
  // joins (i.e. left, semi and anti semi joins) are only created when
  // there is a single right child i.e. the rightSet contains only one
  // jbbc that is connected via a special join. This is enforced as follows
  //
  // * The leftSet should be legal: This means that for every jbbc in the
  //   leftSet any predecessor jbbcs should be present in the leftSet.
  // * The rightSet is either a single jbbc or if the rightSet has more
  //   than one jbbc then it should be legal, note that a jbbc connected
  //   via a special join is not a legal set by itself but we allow
  //   creation of special joins assuming the predecessors are present
  //   in the leftSet.
  //
  // An implicit assumption here is that 'this' MultiJoin is legal, which
  // is fair since apart from the top level multijoin, rest of the multijoins
  // are produced by splitting the top level multijoin. This method should
  // not produce illegal multijoins, since we check both leftSet and rightSet
  // for legality. Only time we don't check for legality is when the rightChild
  // is a single jbbc, and a single jbbc does not result in a multijoin.

  if(!leftSet.legal())
    return NULL;

  if((rightSet.getJBBCs().entries() > 1) && (!rightSet.legal()))
    return NULL;

  // everything here goes to statement heap
  CollHeap* outHeap = CmpCommon::statementHeap();

  RelExpr* child0 = generateSubsetExpr(leftSet, reUseMJ);
  RelExpr* child1 = generateSubsetExpr(rightSet, reUseMJ);

  // Flag to remember to pass on the derivedFromRoutineJoin flag if needed.
  NABoolean derivedFromRoutineJoin(FALSE);

  // now form a JoinExpr with these left and right children.
  Join * result = NULL;

  // if the rightSet is a single jbbc, then it could be connected via
  // a special join. In such a case we have to create the appropriate
  // join operator
  if(rightSet.getJBBCs().entries() == 1){

    JBBC * rightChild = rightSet.getJBBCs().getFirst().getNodeAnalysis()
                         ->getJBBC();

    Join * rightChildParentJoin = rightChild->getOriginalParentJoin();

    // If rightChildParentJoin is NULL, then the child is the left
    // child of the left most join and is considered to be connected
    // via a InnerNonSemi join.
    if(rightChildParentJoin)
    {
      if(rightChildParentJoin->derivedFromRoutineJoin())
        derivedFromRoutineJoin = TRUE;

      if(rightChildParentJoin->isSemiJoin())
        result = new (outHeap) Join(child0, child1, REL_SEMIJOIN, NULL);

      if(rightChildParentJoin->isAntiSemiJoin())
        result = new (outHeap) Join(child0, child1, REL_ANTI_SEMIJOIN, NULL);

      if(rightChildParentJoin->isLeftJoin())
      {

        // left joins can have filter preds, i.e. predicates that
        // are applied as filters after applying the join predicate.
        // We need to set them here.
        result = new (outHeap) Join(child0, child1, REL_LEFT_JOIN, NULL);
        result->setSelectionPredicates(rightChild->getLeftJoinFilterPreds());
      }
      
      if(rightChildParentJoin->isRoutineJoin())
      {
        derivedFromRoutineJoin = TRUE;
        result = new (outHeap) Join(child0, child1, REL_ROUTINE_JOIN, NULL);
        ValueIdSet routineJoinFilterPreds = rightChild->getRoutineJoinFilterPreds();
        ValueIdSet predsToAddToRoutineJoin;
          
        // add covered filter preds
        for (ValueId filterPred= routineJoinFilterPreds.init();
             routineJoinFilterPreds.next(filterPred);
             routineJoinFilterPreds.advance(filterPred) )
        {
          if(jbbSubset_.coversExpr(filterPred))
            predsToAddToRoutineJoin += filterPred;
        } 
 
        result->setSelectionPredicates(predsToAddToRoutineJoin);
      }

      if(result)
      {
        // set the join predicate for special joins, note predicates
        // for regular InnerNonSemi joins are set as selection predicates
        // in the join relexpr.
        result->setJoinPred(rightChild->getPredsWithPredecessors());

        result->nullInstantiatedOutput().insert(rightChild->
                                                  nullInstantiatedOutput());
      }
    }
  }

  // The join to be created is a regular InnerNonSemi join
  if (!result)
    result = new (outHeap) Join(child0, child1, REL_JOIN, NULL);

  // Make sure we carry the derivedFromRoutineJoin flag with us 
  if (derivedFromRoutineJoin)
    result->setDerivedFromRoutineJoin();

  // Share my groupAttr with result
  result->setGroupAttr(getGroupAttr());

  // get inner join predicates
  ValueIdSet selPreds = rightSet.joinPredsWithOther(leftSet);

  // get left join filter preds if any
  selPreds += result->getSelectionPredicates();

  result->setSelectionPredicates(selPreds);

  result->findEquiJoinPredicates();

  // May be I could save a little if i pushdown only to the child(ren)
  // that are not already JBBCs, i.e. multijoins
  result->pushdownCoveredExpr
    (result->getGroupAttr()->getCharacteristicOutputs(),
     result->getGroupAttr()->getCharacteristicInputs(),
     result->selectionPred());

  // We used CutOp as children, to avoid pushing predicates to JBBCs.
  // Now put the actual expression back in case the child is a JBBCs
  if(leftSet.getJBBCs().entries() ==  1)
    result->setChild(0, getJBBCRelExpr(leftSet.getJBBCs().getFirst()));

  // We used CutOp as children, to avoid pushing predicates to JBBCs.
  // Now put the actual expression back in case the child is a JBBCs
  if(rightSet.getJBBCs().entries() ==  1)
    result->setChild(1, getJBBCRelExpr(rightSet.getJBBCs().getFirst()));

  // Temp fixup. We need to take the selectionPred out of MultiJoin
  // for now to prevent that pushed expr from being there. selectionPred
  // is not being used now in MultiJoin xxx.
  if (leftSet.getJBBCs().entries() > 1)
    result->child(0)->selectionPred().clear();
  if (rightSet.getJBBCs().entries() > 1)
    result->child(1)->selectionPred().clear();

  return result;
}
PUParticleFollower* PUParticleFollower::create()
{
    auto ppf = new (std::nothrow) PUParticleFollower();
    ppf->autorelease();
    return ppf;
}
Пример #14
0
 Actor*
 SeqU::copy(Space& home, bool share) {
   return new (home) SeqU(home,share,*this);
 }
Пример #15
0
CKeyStoreSession* CKeyStoreSession::NewL(CFSKeyStoreServer& aServer, CPassphraseManager* aPassMan)
	{
	return new (ELeave) CKeyStoreSession(aServer, aPassMan);
	}
Пример #16
0
bool zmq::stream_engine_t::handshake ()
{
    zmq_assert (handshaking);
    zmq_assert (greeting_bytes_read < greeting_size);

    //  Receive the greeting.
    while (greeting_bytes_read < greeting_size) {
        const int n = read (greeting + greeting_bytes_read,
                            greeting_size - greeting_bytes_read);
        if (n == -1) {
            error ();
            return false;
        }

        if (n == 0)
            return false;

        greeting_bytes_read += n;

        //  We have received at least one byte from the peer.
        //  If the first byte is not 0xff, we know that the
        //  peer is using unversioned protocol.
        if (greeting [0] != 0xff)
            break;

        if (greeting_bytes_read < 10)
            continue;

        //  Inspect the right-most bit of the 10th byte (which coincides
        //  with the 'flags' field if a regular message was sent).
        //  Zero indicates this is a header of identity message
        //  (i.e. the peer is using the unversioned protocol).
        if (!(greeting [9] & 0x01))
            break;

        //  The peer is using versioned protocol.
        //  Send the rest of the greeting, if necessary.
        if (outpos + outsize != greeting_output_buffer + greeting_size) {
            if (outsize == 0)
                set_pollout (handle);
            outpos [outsize++] = 1;             // Protocol version
            outpos [outsize++] = options.type;  // Socket type
        }
    }

    //  Position of the version field in the greeting.
    const size_t version_pos = 10;

    //  Is the peer using the unversioned protocol?
    //  If so, we send and receive rests of identity
    //  messages.
    if (greeting [0] != 0xff || !(greeting [9] & 0x01)) {
        encoder = new (std::nothrow) encoder_t (out_batch_size);
        alloc_assert (encoder);
        encoder->set_msg_source (session);

        decoder = new (std::nothrow) decoder_t (in_batch_size, options.maxmsgsize);
        alloc_assert (decoder);
        decoder->set_msg_sink (session);

        //  We have already sent the message header.
        //  Since there is no way to tell the encoder to
        //  skip the message header, we simply throw that
        //  header data away.
        const size_t header_size = options.identity_size + 1 >= 255 ? 10 : 2;
        unsigned char tmp [10], *bufferp = tmp;
        size_t buffer_size = header_size;
        encoder->get_data (&bufferp, &buffer_size);
        zmq_assert (buffer_size == header_size);

        //  Make sure the decoder sees the data we have already received.
        inpos = greeting;
        insize = greeting_bytes_read;

        //  To allow for interoperability with peers that do not forward
        //  their subscriptions, we inject a phony subsription
        //  message into the incomming message stream. To put this
        //  message right after the identity message, we temporarily
        //  divert the message stream from session to ourselves.
        if (options.type == ZMQ_PUB || options.type == ZMQ_XPUB)
            decoder->set_msg_sink (this);
    }
    else
    if (greeting [version_pos] == 0) {
        //  ZMTP/1.0 framing.
        encoder = new (std::nothrow) encoder_t (out_batch_size);
        alloc_assert (encoder);
        encoder->set_msg_source (session);

        decoder = new (std::nothrow) decoder_t (in_batch_size, options.maxmsgsize);
        alloc_assert (decoder);
        decoder->set_msg_sink (session);
    }
    else {
        //  v1 framing protocol.
        encoder = new (std::nothrow) v1_encoder_t (out_batch_size, session);
        alloc_assert (encoder);

        decoder = new (std::nothrow)
            v1_decoder_t (in_batch_size, options.maxmsgsize, session);
        alloc_assert (decoder);
    }

    // Start polling for output if necessary.
    if (outsize == 0)
        set_pollout (handle);

    //  Handshaking was successful.
    //  Switch into the normal message flow.
    handshaking = false;

    return true;
}
Пример #17
0
/**
 * @brief Creates the application UI object for this document.
 * @return the new instance
 */	
CEikAppUi* Csymbian_ua_guiDocument::CreateAppUiL()
	{
	return new ( ELeave ) Csymbian_ua_guiAppUi;
	}
Пример #18
0
 Actor*
 Pair::copy(Space& home, bool share) {
   return new (home) Pair(home,share,*this);
 }
 void construct(pointer p, const_reference t) {
     new((void *)p) T(t);
 }
 void Vector4::operator = (Vector4 const& other) {
     this->~Vector4();
     new(this) Vector4(other);
 }
void PhoneUiHouseHoldPrivate::ConstructL()
{
    new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton );
    FeatureManager::InitializeLibL();
    
    HbTranslator *translator = new HbTranslator(QString("telephone"));

	if (translator) {
        translator->loadCommon();
        m_translators.append(translator);
	}
    
	HbTranslator *translator2 = new HbTranslator(QString("telephone_cp"));
    if (translator2) {
        m_translators.append(translator2);
    }

    PhoneUIQtView *view = new PhoneUIQtView(m_window);
    iViewAdapter = new PhoneUIQtViewAdapter(*view);
    iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
    iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
    
    m_window.addView (view);
    m_window.setCurrentView (view);
    m_window.scene ()->setFocusItem (view);
    iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController);
    iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController);
    QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed()));
    QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)),
                     Qt::QueuedConnection); // async to enable deletion of widget during signal handling
    QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated()));
    QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated()));
    QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
    QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
    QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
                     iCommandAdapter, SLOT(handleCommand (int))); 
    
    // Disable default Send key functionality in application framework 
    // avkon removal
//    CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
//    appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
//                             CAknAppUiBase::EDisableSendKeyLong );
    
    // CLI Name.
    TInt err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLIName,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );
      
    // CLI Number.
    err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLINumber,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // Startup event signalling
    // Define the telephony application system property 
 
     err = RProperty::Define( 
        KPSUidTelInformation,
        KTelPhoneUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );  

// DefineNewPSKeys:

    // UID: KPSUidTelInternalInformation:
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelRemotePartyContactInfo,
        RProperty::EByteArray,
        KPhoneReadPolicy,
        KPhoneWritePolicy );    
               
    // VT UID.
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelVideoCallUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // TELINTERNALPSKEY CHANGE 
    // Move to AudioHandling
    // UID: KPSUidTelAudioPreference
    // Call Audio Routing
    err = RProperty::Define( 
        KPSUidTelAudioPreference, 
        KTelAudioOutput, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );

    // UID: KPSUidNEInformation
    err = RProperty::Define( 
        KPSUidNEInformation, 
        KTelNumberEntryInfo, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );


    // Add DoStartupSignalL to the recovery system 
    iStartupSignalRecoveryId = 
        CPhoneRecoverySystem::Instance()->AddL( 
            TCallBack( DoStartupSignalL, this ),
            CTeleRecoverySystem::EPhonePriorityHigh,
            CTeleRecoverySystem::EPhoneStateIdle );

    // Call DoStartupSignalL within recovery system
    const TInt startupState = CPhonePubSubProxy::Instance()->Value(
        KPSUidStartup,
        KPSGlobalSystemState );

    PHONE_DEBUG2("phoneui::main() startupState value=", startupState );

    if ( startupState == ESwStateCriticalPhaseOK ||
        startupState == ESwStateEmergencyCallsOnly ||
        startupState == ESwStateNormalRfOn ||
        startupState == ESwStateNormalRfOff ||
        startupState == ESwStateNormalBTSap )
        {
        PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready...");    
        CPhoneRecoverySystem::Instance()->RecoverNow(
            iStartupSignalRecoveryId, 
            CTeleRecoverySystem::EPhonePriorityHigh );
        }
    else
        {        
        PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening...");
        CPhonePubSubProxy::Instance()->NotifyChangeL(
            KPSUidStartup,
            KPSGlobalSystemState,
            this );
        }

    if ( err == KErrNone || err == KErrAlreadyExists )
        {
        // Indicate to the system that the Phone has been started
        CPhonePubSubProxy::Instance()->ChangePropertyValue(
            KPSUidTelInformation,
            KTelPhoneUid,
            KUidPhoneApplication.iUid );
        }

    // Update the Apps ready flag
    iAppsReady += EPhoneStartedUp;

    HbMainWindow *main = hbInstance->allMainWindows().at(0);
    RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow());

    CEikonEnv* env = CEikonEnv::Static();
    if ( env ) {
        env->SetSystem(ETrue);
        // Blacklist singleton is initialized here
        CPhoneClearBlacklist::CreateL( env->WsSession(), *win);
    }
}
Пример #22
0
void CEikCapCArray::CreateExtensionL()
{
    iExtension = new(ELeave) CEikCapCArrayExtension;
}
Пример #23
0
/**
* @date     24/02/2010
* 
*  Application constructor.
*
******************************************************************************/
VtApp::VtApp(): BApplication(APP_SIG),
      c_FileName(), c_Hash(),
      pc_Uploader(NULL), pc_Ui(NULL)
{
   pc_Uploader = new(std::nothrow) VtUploader;
}
Пример #24
0
FunctionRareData* FunctionRareData::create(VM& vm)
{
    FunctionRareData* rareData = new (NotNull, allocateCell<FunctionRareData>(vm.heap)) FunctionRareData(vm);
    rareData->finishCreation(vm);
    return rareData;
}
Пример #25
0
XMLSize_t
RefHash3KeysIdPool<TVal, THasher>::put(void* key1, int key2, int key3, TVal* const valueToAdopt)
{
    // First see if the key exists already
    XMLSize_t hashVal;
    XMLSize_t retId;
    RefHash3KeysTableBucketElem<TVal>* newBucket = findBucketElem(key1, key2, key3, hashVal);

    //
    //  If so,then update its value. If not, then we need to add it to
    //  the right bucket
    //
    if (newBucket)
    {
        retId = newBucket->fData->getId();
        if (fAdoptedElems)
            delete newBucket->fData;
        newBucket->fData = valueToAdopt;
        newBucket->fKey1 = key1;
        newBucket->fKey2 = key2;
        newBucket->fKey3 = key3;
    }
    else
    {
    // Revisit: the gcc compiler 2.95.x is generating an
    // internal compiler error message. So we use the default
    // memory manager for now.
#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600)
        newBucket = new RefHash3KeysTableBucketElem<TVal>(key1, key2, key3, valueToAdopt, fBucketList[hashVal]);
#else
        newBucket =
            new (fMemoryManager->allocate(sizeof(RefHash3KeysTableBucketElem<TVal>)))
            RefHash3KeysTableBucketElem<TVal>(key1, key2, key3, valueToAdopt, fBucketList[hashVal]);
#endif
        fBucketList[hashVal] = newBucket;

        //
        //  Give this new one the next available id and add to the pointer list.
        //  Expand the list if that is now required.
        //
        if (fIdCounter + 1 == fIdPtrsCount)
        {
            // Create a new count 1.5 times larger and allocate a new array
            XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5);
            TVal** newArray = (TVal**) fMemoryManager->allocate
            (
                newCount * sizeof(TVal*)
            ); //new TVal*[newCount];

            // Copy over the old contents to the new array
            memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*));

            // Ok, toss the old array and store the new data
            fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
            fIdPtrs = newArray;
            fIdPtrsCount = newCount;
        }
        retId = ++fIdCounter;
    }

    fIdPtrs[retId] = valueToAdopt;

    // Set the id on the passed element
    valueToAdopt->setId(retId);

    // Return the id that we gave to this element
    return retId;
}
Пример #26
0
/*---------------------------------------------------RegisteredURI::operator=-+
| Assignment op                                                               |
+----------------------------------------------------------------------------*/
RegisteredURI & RegisteredURI::operator=(char const * pszUri) {
   this->~RegisteredURI();
   new(this) RegisteredURI(pszUri);
   return *this;
}
Пример #27
0
/**
	Intended primarily as a visual check that the mode is displayed correctly,
	for each rotated mode.
**/
void    CTScreenDeviceResSwitch::DeviceResSwitchWithRotationsL()
	{
	CWsScreenDevice *screen=TheClient->iScreen;
	TInt originalScreenMode = screen->CurrentScreenMode();
	TPixelsTwipsAndRotation originalModeSettings;
	screen->GetScreenModeSizeAndRotation(originalScreenMode,originalModeSettings);
	CArrayFixFlat<TInt> *rotations=new(ELeave) CArrayFixFlat<TInt>(1);
	CleanupStack::PushL(rotations);
	INFO_PRINTF2(_L("ScreenMode and rotation with colour depth. ScreenModes=%i"),TheClient->iScreenModes.Count());
	
	for (TInt rr=0,maxrr=3;rr<maxrr;++rr)
	for (TInt ii=0,maxii=TheClient->iScreenModes.Count();ii<maxii;++ii)
		{
		TInt newMode=TheClient->iScreenModes[ii];
		if (	screen->GetScreenModeOrigin(ii)!=TPoint(0,0)	||	screen->GetScreenModeScale(ii)!=TSize(1,1)	)
			{
			INFO_PRINTF2(_L("ScreenMode %i skipped: has scalind and/ or rotation"),ii);
			INFO_PRINTF1(_L("This scaling code is known to be broken if all modes do not support scaling"));
			INFO_PRINTF1(_L("See defect DEF111847 and break request 2226"));
			INFO_PRINTF5(_L("Origin: %i %i Scale %i %i"),
					screen->GetScreenModeOrigin(ii).iX,screen->GetScreenModeOrigin(ii).iY,
					screen->GetScreenModeScale(ii).iWidth,screen->GetScreenModeScale(ii).iHeight
				);
			continue;
			}
			
		screen->SetAppScreenMode(newMode);
		screen->SetScreenMode(newMode);
		TInt currentScreenMode = screen->CurrentScreenMode();
		TEST(currentScreenMode == newMode);

		User::LeaveIfError(screen->GetRotationsList(newMode,rotations));
		INFO_PRINTF4(_L("ScreenMode and rotation with colour depth. Mode#%i=%i. Rotations=%i"),ii,newMode,rotations->Count());
		TPixelsTwipsAndRotation currentModeSettings;
		screen->GetDefaultScreenSizeAndRotation(currentModeSettings);
		screen->SetScreenSizeAndRotation(currentModeSettings);
		for (TInt jj=0,maxjj=rotations->Count();jj<maxjj;jj++)
			{
			CFbsBitGc::TGraphicsOrientation newOrientation=STATIC_CAST(CFbsBitGc::TGraphicsOrientation,rotations[0][jj]);
			INFO_PRINTF3(_L("ScreenMode and rotation with colour depth. Rotation#%i=%i(0..3)"),jj,newOrientation);
			screen->SetCurrentRotations(newMode,newOrientation);
			TheClient->iWs.Flush();
			
			TPixelsAndRotation modeSettings;
			TheClient->iScreen->GetDefaultScreenSizeAndRotation(modeSettings);
			TRect screenRect(TPoint(0,0),modeSettings.iPixelSize);

			//move the debug windows to inside the area 
			//actually don't bother yet!
			if (screenRect.Width()>screenRect.Height())
				{
				}
			else
				{
				}
			DeviceResSwitchL();
			}
		screen->SetCurrentRotations(newMode,currentModeSettings.iRotation);
		screen->SetScreenSizeAndRotation(currentModeSettings);
		}
	
	CleanupStack::PopAndDestroy();
	screen->SetScreenMode(originalScreenMode);
	screen->SetCurrentRotations(originalScreenMode,originalModeSettings.iRotation);
	screen->SetScreenSizeAndRotation(originalModeSettings);
	}
Пример #28
0
void zmq::pgm_receiver_t::in_event ()
{
    // Read data from the underlying pgm_socket.
    const pgm_tsi_t *tsi = NULL;

    if (has_rx_timer) {
        cancel_timer (rx_timer_id);
        has_rx_timer = false;
    }

    //  TODO: This loop can effectively block other engines in the same I/O
    //  thread in the case of high load.
    while (true) {

        //  Get new batch of data.
        //  Note the workaround made not to break strict-aliasing rules.
        void *tmp = NULL;
        ssize_t received = pgm_socket.receive (&tmp, &tsi);
        inpos = (unsigned char*) tmp;

        //  No data to process. This may happen if the packet received is
        //  neither ODATA nor ODATA.
        if (received == 0) {
            if (errno == ENOMEM || errno == EBUSY) {
                const long timeout = pgm_socket.get_rx_timeout ();
                add_timer (timeout, rx_timer_id);
                has_rx_timer = true;
            }
            break;
        }

        //  Find the peer based on its TSI.
        peers_t::iterator it = peers.find (*tsi);

        //  Data loss. Delete decoder and mark the peer as disjoint.
        if (received == -1) {
            if (it != peers.end ()) {
                it->second.joined = false;
                if (it->second.decoder != NULL) {
                    LIBZMQ_DELETE(it->second.decoder);
                }
            }
            break;
        }

        //  New peer. Add it to the list of know but unjoint peers.
        if (it == peers.end ()) {
            peer_info_t peer_info = {false, NULL};
            it = peers.insert (peers_t::value_type (*tsi, peer_info)).first;
        }

        insize = static_cast <size_t> (received);

        //  Read the offset of the fist message in the current packet.
        zmq_assert (insize >= sizeof (uint16_t));
        uint16_t offset = get_uint16 (inpos);
        inpos += sizeof (uint16_t);
        insize -= sizeof (uint16_t);

        //  Join the stream if needed.
        if (!it->second.joined) {

            //  There is no beginning of the message in current packet.
            //  Ignore the data.
            if (offset == 0xffff)
                continue;

            zmq_assert (offset <= insize);
            zmq_assert (it->second.decoder == NULL);

            //  We have to move data to the beginning of the first message.
            inpos += offset;
            insize -= offset;

            //  Mark the stream as joined.
            it->second.joined = true;

            //  Create and connect decoder for the peer.
            it->second.decoder = new (std::nothrow)
                v1_decoder_t (0, options.maxmsgsize);
            alloc_assert (it->second.decoder);
        }

        int rc = process_input (it->second.decoder);
        if (rc == -1) {
            if (errno == EAGAIN) {
                active_tsi = tsi;

                //  Stop polling.
                reset_pollin (pipe_handle);
                reset_pollin (socket_handle);

                break;
            }

            it->second.joined = false;
            LIBZMQ_DELETE(it->second.decoder);
            insize = 0;
        }
    }

    //  Flush any messages decoder may have produced.
    session->flush ();
}
Пример #29
0
X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
                      X11Display &rDisplay, bool dragDrop, bool playOnDrop,
                      X11Window *pParentWindow, GenericWindow::WindowType_t type ):
    OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ),
    m_dragDrop( dragDrop ), m_pDropTarget( NULL ), m_type ( type )
{
    XSetWindowAttributes attr;
    unsigned long valuemask;
    std::string name_type;

    if( type == GenericWindow::FullscreenWindow )
    {
        m_wnd_parent = DefaultRootWindow( XDISPLAY );

        int i_screen = DefaultScreen( XDISPLAY );

        attr.event_mask = ExposureMask | StructureNotifyMask;
        attr.background_pixel = BlackPixel( XDISPLAY, i_screen );
        attr.backing_store = Always;
        valuemask = CWBackingStore | CWBackPixel | CWEventMask;

        if( NET_WM_STATE_FULLSCREEN == None )
        {
            attr.override_redirect = True;
            valuemask = valuemask | CWOverrideRedirect;
        }

        name_type = "Fullscreen";
    }
    else if( type == GenericWindow::VoutWindow )
    {
        m_wnd_parent = pParentWindow->m_wnd;

        int i_screen = DefaultScreen( XDISPLAY );

        attr.event_mask = ExposureMask | StructureNotifyMask;
        attr.backing_store = Always;
        attr.background_pixel = BlackPixel( XDISPLAY, i_screen );
        valuemask = CWBackingStore | CWBackPixel | CWEventMask;

        name_type = "VoutWindow";
    }
    else if( type == GenericWindow::FscWindow )
    {
        m_wnd_parent = DefaultRootWindow( XDISPLAY );

        attr.event_mask = ExposureMask | StructureNotifyMask;
        valuemask = CWEventMask;

        name_type = "FscWindow";
    }
    else
    {
        m_wnd_parent = DefaultRootWindow( XDISPLAY );

        attr.event_mask = ExposureMask | StructureNotifyMask;
        valuemask = CWEventMask;

        name_type = "TopWindow";
    }

    // Create the window
    m_wnd = XCreateWindow( XDISPLAY, m_wnd_parent, -10, 0, 10, 10, 0, 0,
                           InputOutput, CopyFromParent, valuemask, &attr );

    // wait for X server to process the previous commands
    XSync( XDISPLAY, false );

    // Set the colormap for 8bpp mode
    if( XPIXELSIZE == 1 )
    {
        XSetWindowColormap( XDISPLAY, m_wnd, m_rDisplay.getColormap() );
    }

    // Select events received by the window
    long event_mask = ExposureMask|KeyPressMask|
                      PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
                      LeaveWindowMask|FocusChangeMask;
    XSelectInput( XDISPLAY, m_wnd, event_mask );

    // Store a pointer on the generic window in a map
    X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
    pFactory->m_windowMap[m_wnd] = &rWindow;

    // Changing decorations
    struct {
        unsigned long flags;
        unsigned long functions;
        unsigned long decorations;
        signed   long input_mode;
        unsigned long status;
    } motifWmHints;
    Atom hints_atom = XInternAtom( XDISPLAY, "_MOTIF_WM_HINTS", False );
    motifWmHints.flags = 2;    // MWM_HINTS_DECORATIONS;
    motifWmHints.decorations = 0;
    XChangeProperty( XDISPLAY, m_wnd, hints_atom, hints_atom, 32,
                     PropModeReplace, (unsigned char *)&motifWmHints,
                     sizeof( motifWmHints ) / sizeof( uint32_t ) );

    // Drag & drop
    if( m_dragDrop )
    {
        // Create a Dnd object for this window
        m_pDropTarget = new X11DragDrop( getIntf(), m_rDisplay, m_wnd,
                                         playOnDrop, &rWindow );

        // Register the window as a drop target
        Atom xdndAtom = XInternAtom( XDISPLAY, "XdndAware", False );
        char xdndVersion = 5;
        XChangeProperty( XDISPLAY, m_wnd, xdndAtom, XA_ATOM, 32,
                         PropModeReplace, (unsigned char *)&xdndVersion, 1 );

        // Store a pointer to be used in X11Loop
        pFactory->m_dndMap[m_wnd] = m_pDropTarget;
    }

    // Change the window title
    std::string name_window = "VLC (" + name_type + ")";
    XStoreName( XDISPLAY, m_wnd, name_window.c_str() );

    // Set the WM_TRANSIENT_FOR property
    if( type == GenericWindow::FscWindow )
    {
        // Associate the fsc window to the fullscreen window
        VoutManager* pVoutManager = VoutManager::instance( getIntf() );
        GenericWindow* pGenericWin = pVoutManager->getVoutMainWindow();
        X11Window *pWin = (X11Window*)pGenericWin->getOSWindow();
        Window wnd = pWin->getDrawable();
        XSetTransientForHint( XDISPLAY, m_wnd, wnd );
    }
    else
    {
        // Associate the regular top-level window to the offscren main window
        XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() );
    }

    // initialize Class Hint
    XClassHint classhint;
    classhint.res_name = (char*) "vlc";
    classhint.res_class = (char*) "Vlc";
    XSetClassHint( XDISPLAY, m_wnd, &classhint );

    // copies WM_HINTS from the main window
    XWMHints *wm = XGetWMHints( XDISPLAY, m_rDisplay.getMainWindow() );
    if( wm )
    {
        XSetWMHints( XDISPLAY, m_wnd, wm );
        XFree( wm );
    }

    // initialize WM_CLIENT_MACHINE
    char* hostname = NULL;
    long host_name_max = sysconf( _SC_HOST_NAME_MAX );
    if( host_name_max <= 0 )
        host_name_max = _POSIX_HOST_NAME_MAX;
    hostname = new (std::nothrow) char[host_name_max];
    if( hostname && gethostname( hostname, host_name_max ) == 0 )
    {
        hostname[host_name_max - 1] = '\0';

        XTextProperty textprop;
        textprop.value = (unsigned char *) hostname;
        textprop.encoding = XA_STRING;
        textprop.format = 8;
        textprop.nitems = strlen( hostname );
        XSetWMClientMachine( XDISPLAY, m_wnd, &textprop);
    }
    delete[] hostname;

    // initialize EWMH pid
    pid_t pid = getpid();
    assert(  NET_WM_PID != None );
    XChangeProperty( XDISPLAY, m_wnd, NET_WM_PID, XA_CARDINAL, 32,
                     PropModeReplace, (unsigned char *)&pid, 1 );

    if( NET_WM_WINDOW_TYPE != None )
    {
        if( type == GenericWindow::FullscreenWindow )
        {
            // Some Window Managers like Gnome3 limit fullscreen to the
            // subarea outside the task bar if no window type is provided.
            // For those WMs, setting type window to normal ensures a clean
            // 100% fullscreen
            XChangeProperty( XDISPLAY, m_wnd, NET_WM_WINDOW_TYPE,
                         XA_ATOM, 32, PropModeReplace,
                         (unsigned char *)&NET_WM_WINDOW_TYPE_NORMAL, 1 );
        }
    }
}
QTD_EXTERN QTD_EXPORT void qtd_QXmlStreamNotationDeclaration_placed_copy(void* orig, void* place) {
    const QXmlStreamNotationDeclaration&  __qt_orig = (const QXmlStreamNotationDeclaration& ) *(QXmlStreamNotationDeclaration *)orig;
    QXmlStreamNotationDeclaration *result = new (place) QXmlStreamNotationDeclaration (__qt_orig);
}