/** Allocates and constructs a CProcessInfo object. @param aId Kernel process id @param aName Kernel process name @see CProcessInfo::CProcessInfo */ EXPORT_C CProcessInfo* CProcessInfo::NewL( const TUint64 aId, const TDesC & aName ) { const TUint size = sizeof( TUint32 ) // iId Low + sizeof( TUint32 ) // iId High + sizeof( TUint32 ) // When externalized, we send the name length, so must include this + 2 // When externalized, the << operator writes 2 bytes for the descriptor size + aName.Size() // iName Size, in bytes. + sizeof( TUint32 ) // Observed + sizeof( TUint32 ); // iSize itself if( size >= MaxSize() ) { LOG_MSG3( "CProcessInfo::NewL() : Descriptorized object = 0x%X bytes would exceed the maximum of 0x%X\n", size, MaxSize() ); User::Leave( KErrTooBig ); } CProcessInfo * data = new (ELeave) CProcessInfo( aId ); CleanupStack::PushL( data ); data->ConstructL( aName ); CleanupStack::Pop(data); return (data); }
bool MemFileArray::SetSize(size_t size, bool preserve,bool AllowLess) { // if we haven't allocated yet, we'll need to if ( size > 0 ) { // gr: errr do we need this to be readonly sometimes? bool ReadOnly = false; if ( !Init( size, ReadOnly ) ) return false; } // if we hit the limit, don't change and fail // gr: this is rare enough that an assert should be okay to add to debug auto Error = [size,this] { std::stringstream Error; Error << "Cannot allocate " << size << " > maxsize " << MaxSize(); return Error.str(); }; if ( !Soy::Assert( size <= MaxSize(), Error ) ) return false; mOffset = size; return true; }
EXPORT_C void CMemSpyEngineChunkEntry::OutputDataL( CMemSpyEngineHelperChunk& aHelper ) const { HBufC* columns = HBufC::NewLC( 1024 ); TPtr pColumns( columns->Des() ); // Name pColumns.Copy( Name() ); MemSpyEngineUtils::TextAfterDoubleColon( pColumns ); pColumns.Append( KMemSpyEngineChunkListOutputComma ); // Owning Process AppendOwnerName( pColumns ); pColumns.Append( KMemSpyEngineChunkListOutputComma ); // Size pColumns.AppendNum( Size(), EDecimal ); pColumns.Append( KMemSpyEngineChunkListOutputComma ); // Max. Size pColumns.AppendNum( MaxSize(), EDecimal ); pColumns.Append( KMemSpyEngineChunkListOutputComma ); // Address _LIT( KAddressFormat, "0x%08x - 0x%08x"); pColumns.AppendFormat( KAddressFormat, BaseAddress(), UpperAddress() ); // aHelper.Engine().Sink().OutputLineL( pColumns ); CleanupStack::PopAndDestroy( columns ); }
unsigned int ByteQueueNode::Put(const byte *inString, unsigned int length) { unsigned int l = STDMIN(length, MaxSize()-tail); memcpy(buf+tail, inString, l); tail += l; return l; }
Node* Nonleaf::InsertMightSplit(Stat *Stats, const Entry &Ent, Node *Ptr) { short samegroup; Nonleaf *NewNode; int i1,i2,n1,n2,head1,head2; double d1, d2; Entry ent1,ent2; ent1.Init(Stats->Dimension); ent2.Init(Stats->Dimension); if (NotFull(Stats)) { entry[actsize]=Ent; child[actsize]=Ptr; actsize++; return NULL; } NewNode=new Nonleaf(Stats); Stats->MemUsed++; Stats->TreeSize++; NewNode->entry[NewNode->actsize]=Ent; NewNode->child[NewNode->actsize]=Ptr; NewNode->actsize++; this->FarthestTwoOut(Stats,this,NewNode,samegroup,i1,i2); switch (samegroup) { case 0: this->swap(this,0, this,i1); NewNode->swap(NewNode,0, NewNode,i2); break; case 1: this->swap(this,0, this,i1); NewNode->swap(NewNode,0, this,i2); break; default: print_error("Nonleaf::InsertMightSplit","Invalid group flag"); } n1=MaxSize(Stats); n2=1; head1=1; head2=1; ent1 = this->entry[0]; ent2 = NewNode->entry[0]; while (head1<n1) { d1 = distance(Stats->BDtype,ent1,this->entry[head1]); d2 = distance(Stats->BDtype,ent2,this->entry[head1]); if (d1<d2) { ent1+=this->entry[head1]; head1++; } else { this->assign(NewNode,head2,this,head1); this->assign(this,head1,this,n1-1); ent2+=NewNode->entry[head2]; head2++; n1--; n2++; } } this->actsize=n1; NewNode->actsize=n2; return(NewNode); }
/* inline unsigned int Put(byte inByte) { if (MaxSize()==m_tail) return 0; buf[m_tail++]=inByte; return 1; } */ inline unsigned int Put(const byte *begin, unsigned int length) { unsigned int l = STDMIN(length, MaxSize()-m_tail); memcpy(buf+m_tail, begin, l); m_tail += l; return l; }
BSize TabView::MinSize() { BSize size(MaxSize()); size.width = 60.0f; return size; }
unsigned int ByteQueueNode::Put(byte inByte) { if (MaxSize()==tail) return 0; buf[tail++]=inByte; return 1; }
inline size_t Put(const byte *begin, size_t length) { size_t l = STDMIN(length, MaxSize()-m_tail); if (buf+m_tail != begin) memcpy(buf+m_tail, begin, l); m_tail += l; return l; }
inline size_t Put(const byte *begin, size_t length) { // Avoid passing NULL to memcpy if (!begin || !length) return length; size_t l = STDMIN(length, MaxSize()-m_tail); if (m_buf+m_tail != begin) memcpy(m_buf+m_tail, begin, l); m_tail += l; return l; }
void addNumber(T begin, T end) { if ((_lst.size() + std::distance(begin, end)) < _maxSize) { _lst.insert(_lst.end(), begin, end); std::sort(_lst.begin(), _lst.end()); } else throw MaxSize(); }
Boolean PtrDynArray<T>::RegisterIterator() { if (_IteratorsActive < MaxSize()) { ++_IteratorsActive; return TRUE; } return FALSE; }
double Nonleaf::Occupancy(Stat *Stats) const { int leafsize, nonleafsize; #ifdef RECTANGLE leafsize=(Stats->PageSize-2*sizeof(int))/ (sizeof(int)+sizeof(double)*(3*Stats->Dimension+1)); #else leafsize=(Stats->PageSize-2*sizeof(int))/ (sizeof(int)+sizeof(double)*(Stats->Dimension+1)); #endif nonleafsize=MaxSize(Stats); return NumEntry()/(1.0*nonleafsize*NonleafNum()+1.0*leafsize*LeafNum()); }
// fit with expanding but without splitting short Leaf::BestFitPath2(Stat *Stats, const Entry &ent, Path& BestPath) { int EntryI=ClosestOne(Stats,ent); if (EntryI>=0) { BestPath.Push(EntryI,this); return TRUE; } else if (actsize<MaxSize(Stats)) { BestPath.Push(actsize,this); return TRUE; } else return FALSE; }
char *get_flag_names(long flags) { u_int i, found = 0; memset(&mybuf, 0, sizeof mybuf); for (i = 0; i <= CS_TABLE_SIZE; i++) if (flags & _ClientFlagsTable[i].number) { if (found) strncat(mybuf, ", ", MaxSize(mybuf)); else found = 1; strncat(mybuf, _ClientFlagsTable[i].name, MaxSize(mybuf)); } if (!strlen(mybuf)) strcpy(mybuf, "<None>"); return mybuf; }
void QuadParticleSystemDrawer::adjustVolume(ParticleSystemUnrecPtr System, Volume & volume) { //Get The Volume of the Particle System Pnt3f MinVolPoint,MaxVolPoint; System->getVolume().getBounds(MinVolPoint,MaxVolPoint); Real32 Width, Height, Max(0.0f); Vec3f MaxSize(System->getMaxParticleSize() * 0.5f); volume.extendBy( MinVolPoint - MaxSize ); volume.extendBy( MaxVolPoint + MaxSize ); }
char *get_proto_names(short proto) { u_int i, found = 0; memset(&mybuf, 0, sizeof mybuf); for (i = 0; i <= PROTOCTL_TABLE_SIZE; i++) if (proto & _ProtoctlTable[i].number) { if (found) strncat(mybuf, ", ", MaxSize(mybuf)); else found = 1; strncat(mybuf, _ProtoctlTable[i].name, MaxSize(mybuf)); } if (!strlen(mybuf)) strcpy(mybuf, "<None>"); return mybuf; }
std::string lerpFromSide( const std::string& From, const std::string& To, const Real32& t) { UInt32 MaxSize(osgMax<UInt32>(From.size(),To.size())); Real32 TimePerChar(1.0f/static_cast<Real32>(MaxSize)); Real32 FromChar(' '),ToChar(' '); std::string Result(""); if(From.size() < To.size()) { //Left To Right Int32 Index(osgFloor<Int32>(static_cast<Real32>(MaxSize)*t)); Real32 CharT((t-Index*TimePerChar)/TimePerChar); Result = To.substr(0,osgMin<Int32>(To.size(),Index)); Result.resize(Index, ' '); if(Index<To.size()) { ToChar = To[Index]; } if(Index<From.size()) { FromChar = From[Index]; } Result += static_cast<Char8>(FromChar +( (ToChar - FromChar) * CharT )); //Interp Index Result += From.substr(osgMin<Int32>(Index+1,From.size()),std::string::npos); } else { //Right to Left Int32 Index(osgMax<Int32>(0,MaxSize - osgFloor(static_cast<Real32>(MaxSize)*t) - 1)); Real32 CharT((t-osgFloor<Int32>(static_cast<Real32>(MaxSize)*t)*TimePerChar)/TimePerChar); Result = From.substr(0,osgMin<Int32>(From.size(),Index)); Result.resize(Index, ' '); if(Index<To.size()) { ToChar = To[Index]; } if(Index<From.size()) { FromChar = From[Index]; } Result += static_cast<Char8>(FromChar +( (ToChar - FromChar) * CharT )); //Interp Index Result += To.substr(osgMin<Int32>(Index+1,To.size()),std::string::npos); } return Result; }
EXPORT_C void RDbRow::GrowL(TInt aMaxSize) // // Grow the buffer to at least aMaxSize, the buffer empty on return // { if (aMaxSize>MaxSize()) { ReallocL(aMaxSize); Reset(); // __ASSERT(iFirst<=iEnd); __ASSERT(iFirst<=iLast && iLast<=iEnd); __ASSERT(iFirst<=iCell && iCell<=iLast); } }
// absorb with expanding but without splitting short Leaf::AbsorbEntry2(Stat *Stats, const Entry &ent) { int EntryI; EntryI=ClosestOne(Stats,ent); if (EntryI>=0) { entry[EntryI]+=ent; return TRUE; } else if (actsize<MaxSize(Stats)) { entry[actsize]=ent; actsize++; Stats->CurrEntryCnt++; return TRUE; } else return FALSE; }
void GeneratePattern(char *&pattern, int seed=TCM_SEED,int max=-1) { if(max==-1) max=MaxSize(); pattern=new char[max]; for(int k=seed,j=0;k<seed+max/(int)(sizeof(int));k++,j+=sizeof(int)) { *(int *)(pattern+j)=k; } /*for(int k=0,j=0;k<max/sizeof(int);k++,j+=sizeof(int)) { printf("%d",*(int *)(pattern+j)); }*/ }
FVector2D SSequencerTrackArea::ComputeDesiredSize( float ) const { FVector2D MaxSize(0,0); for (int32 ChildIndex = 0; ChildIndex < Children.Num(); ++ChildIndex) { const FTrackAreaSlot& CurChild = Children[ChildIndex]; const EVisibility ChildVisibilty = CurChild.GetWidget()->GetVisibility(); if (ChildVisibilty != EVisibility::Collapsed) { FVector2D ChildDesiredSize = CurChild.GetWidget()->GetDesiredSize(); MaxSize.X = FMath::Max(MaxSize.X, ChildDesiredSize.X); MaxSize.Y = FMath::Max(MaxSize.Y, ChildDesiredSize.Y); } } return MaxSize; }
TInt RDbRow::ReallocL(TInt aMaxSize) // // Grow the buffer to aMaxSize, return the offset of buffer movement // leave iLast and cache untouched // { __ASSERT(aMaxSize>MaxSize()); if (!Owned()) __LEAVE(KErrTooBig); // cannot reallocate if not owned // aMaxSize+=EGranularity-1; aMaxSize&=~(EGranularity-1); TDbCell* buf=(TDbCell*)User::ReAllocL(iFirst,aMaxSize); TInt move=Diff(iFirst,buf); iFirst=buf; iEnd=PtrAdd(buf,aMaxSize); return move; }
inline bool UsedUp() const { return (m_head==MaxSize()); }
AboutDlg::AboutDlg(QWidget *parent) : QDialog(parent) { this->setWindowTitle(tr("About QtRptDesigner")); QSize MaxSize(420, 450); QSize MinSize(420, 450); setMaximumSize(MaxSize); setMinimumSize(MinSize); QRect gry = geometry(); gry.moveCenter(qApp->desktop()->availableGeometry().center()); setGeometry(gry); QPushButton *btnOK = new QPushButton(this); btnOK->setText("OK"); QObject::connect(btnOK, SIGNAL(clicked()), this, SLOT(close())); QLabel *labImg = new QLabel(this); labImg->setPixmap(QPixmap(":/new/prefix1/images/Logo128.png")); QString lbl1 = "<h2><b><p style='color:#0033FF'>"+QApplication::applicationName()+"</p></b></h2>"+ tr("Version: ")+QApplication::applicationVersion()+"<br>"+ tr("Programmer: Aleksey Osipov")+"<br>"+ "WebSite: <a href='http://www.aliks-os.tk'>http://www.aliks-os.tk</a>"+"<br>"+ "E-mail: [email protected]"+"<br>"+ "<a href='http://www.qtrpt.tk'>http://www.qtrpt.tk</a>"+"<br>"+ tr("2012-2015 years")+"<br><br>"; QString lbl2 = "<b>"+tr("Thanks for donation:")+"</b>"+ "<ul>"+ "<li>"+tr("Sailendram")+"</li>"+ "</ul>"+ "<b>"+tr("Thanks for project developing:")+"</b>"+ "<ul>"+ "<li>"+tr("Lukas Lalinsky for DBmodel")+"</li>"+ "<li>"+tr("Norbert Schlia for help in developing")+"</li>"+ "<li>"+tr("Muhamad Bashir Al-Noimi for Arabic translation")+"</li>"+ "<li>"+tr("Luis Brochado for Portuguese translation")+"</li>"+ "<li>"+tr("Li Wei for Chinese translation")+"</li>"+ "<li>"+tr("Laurent Guilbert for French translation")+"</li>"+ "<li>"+tr("David Heremans for Dutch translation")+"</li>"+ "<li>"+tr("Mirko Marx for German translation")+"</li>"+ "<li>"+tr("Manuel Soriano for Spanish translation")+"</li>"+ "</ul>"; QLabel *lab1 = new QLabel(lbl1, this); QObject::connect(lab1, SIGNAL(linkActivated(const QString)), this, SLOT(openLink(const QString))); QLabel *lab2 = new QLabel(lbl2, this); QHBoxLayout *hLayout2 = new QHBoxLayout; hLayout2->addWidget(labImg); hLayout2->addWidget(lab1); hLayout2->addStretch(); QHBoxLayout *hLayout1 = new QHBoxLayout; //hLayout->addSpacerItem(spacer1); hLayout1->addStretch(); hLayout1->addWidget(btnOK); //hLayout->addSpacerItem(spacer2); hLayout1->addStretch(); QVBoxLayout *vLayout = new QVBoxLayout; //vLayout->addSpacerItem(spacer3); vLayout->addLayout(hLayout2); vLayout->addWidget(lab2); vLayout->addStretch(); vLayout->addLayout(hLayout1); this->setLayout(vLayout); }
void ECCacheBase::DumpStats(ECLogger *lpLogger) { std::string strName; strName = m_strCachename + " cache size:"; lpLogger->Log(EC_LOGLEVEL_FATAL, " %-30s %8lu (%8llu bytes) (usage %.02f%%)", strName.c_str(), ItemCount(), Size(), Size() / (double)MaxSize() * 100.0); strName = m_strCachename + " cache hits:"; lpLogger->Log(EC_LOGLEVEL_FATAL, " %-30s %8llu / %llu (%.02f%%)", strName.c_str(), ValidCount(), HitCount(), ValidCount() / (double)HitCount() * 100.0); }
unsigned int UsedUp() const {return (head==MaxSize());}
void CMemSpyEngineChunkEntry::ConstructL( const TMemSpyDriverChunkInfo& aInfo ) { // Copy info iInfo = new(ELeave) TMemSpyDriverChunkInfo(); *iInfo = aInfo; // Make caption TBuf<KMaxFullName+128> item; _LIT(KCaptionFormat, "\t%S\t\t%d"); item.Format( KCaptionFormat, &Name(), Size() ); iCaption = item.AllocL(); // Make other items iList = CMemSpyEngineOutputList::NewL(); _LIT( KEntry0, "Name"); iList->AddItemL( KEntry0, Name() ); _LIT( KEntryType, "Type" ); switch( aInfo.iType ) { default: case EMemSpyDriverChunkTypeUnknown: iList->AddItemL( KEntryType, _L("Unknown") ); break; case EMemSpyDriverChunkTypeHeap: iList->AddItemL( KEntryType, _L("Heap") ); break; case EMemSpyDriverChunkTypeHeapKernel: iList->AddItemL( KEntryType, _L("Kernel Heap") ); break; case EMemSpyDriverChunkTypeStackAndProcessGlobalData: iList->AddItemL( KEntryType, _L("Stack and Process Global Data") ); break; case EMemSpyDriverChunkTypeStackKernel: iList->AddItemL( KEntryType, _L("Kernel Stack") ); break; case EMemSpyDriverChunkTypeGlobalData: iList->AddItemL( KEntryType, _L("Global Data") ); break; case EMemSpyDriverChunkTypeCode: iList->AddItemL( KEntryType, _L("Code") ); break; case EMemSpyDriverChunkTypeCodeGlobal: iList->AddItemL( KEntryType, _L("Global Code") ); break; case EMemSpyDriverChunkTypeCodeSelfModifiable: iList->AddItemL( KEntryType, _L("Self Modifiable Code") ); break; case EMemSpyDriverChunkTypeLocal: iList->AddItemL( KEntryType, _L("Local") ); break; case EMemSpyDriverChunkTypeGlobal: iList->AddItemL( KEntryType, _L("Global") ); break; case EMemSpyDriverChunkTypeRamDrive: iList->AddItemL( KEntryType, _L("RAM Drive") ); break; } _LIT( KEntry1, "Owning Process"); OwnerName( item ); iList->AddItemL( KEntry1, item ); _LIT( KEntry2, "Address" ); _LIT( KEntry2Format, "0x%08x - 0x%08x" ); item.Format( KEntry2Format, BaseAddress(), UpperAddress() ); iList->AddItemL( KEntry2, item ); _LIT( KEntry3, "Size"); iList->AddItemL( KEntry3, Size() ); _LIT( KEntry4, "Max. Size"); iList->AddItemL( KEntry4, MaxSize() ); _LIT( KEntryAttributeFormat, "Attribute %d"); TInt attribNum = 0; // if ( aInfo.iAttributes & ENormal ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Normal") ); } if ( aInfo.iAttributes & EDoubleEnded ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Double Ended") ); } if ( aInfo.iAttributes & EDisconnected ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Disconnected") ); } if ( aInfo.iAttributes & EConstructed ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Constructed") ); } if ( aInfo.iAttributes & EMemoryNotOwned ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Memory Not Owned") ); } }
double Leaf::Occupancy(Stat *Stats) const { return actsize/(1.0*MaxSize(Stats)); }
be_sequence::be_sequence (AST_Expression *v, AST_Type *t) : AST_Decl ( AST_Decl::NT_sequence, new UTL_ScopedName (new Identifier ("sequence", 1, 0, I_FALSE), NULL) ), AST_Sequence(v, t), initialized (pbfalse), maxSize (0), anonymous (pbtrue), deferred (pbfalse), isPrimitiveSeq (pbfalse), isStringSeq (pbfalse), isInterfaceSeq (pbfalse), baseType (0) { // NOTE: BASE TYPE AND MAX SIZE ARE KNOWN assert(base_type()); assert(max_size()); static int sequence_count = 0; isAtModuleScope(pbfalse); idlType = this; if (base_type()) { baseType = be_Type::_narrow(base_type()); baseType = baseType->idlType; isStringSeq = baseType->IsStringType(); isInterfaceSeq = baseType->IsInterfaceType(); isValueSeq = baseType->IsValueType(); isPrimitiveSeq = (baseType->IsPrimitiveType() && baseType->IsFixedLength() // eliminates ANY, etc.. && !baseType->IsEnumeratedType()); // Sequence of Typecode mem leak fix eCPP896 be_predefined_type * pdt = be_predefined_type::_narrow(base_type()); if (pdt && (pdt->pt() == AST_PredefinedType::PT_typecode)) { isInterfaceSeq = TRUE; } } else { UTL_Error* oops = new UTL_Error; oops->error0(UTL_Error::EIDL_LOOKUP_ERROR); delete oops; } if (baseType->IsExceptionType()) { UTL_Error* oops = new UTL_Error; oops->error0(UTL_Error::EIDL_ILLEGAL_USE); delete oops; } maxSize = ExprToULong(max_size()); if (baseType) { be_Type * unaliasedBase = be_typedef::_beBase(base_type()); baseTypeName = baseType->SequenceMemberTypeName(); // // create type id (YO maybe should be the same as the equivalence id // localName = (DDS_StdString)"_s_" + baseType->TypeName() + "_"; localName += BE_Globals::int_to_string(MaxSize()); ColonToBar((char *)localName); // // create operational type equivalence id // m_any_op_id = (DDS_StdString)"_s_" + unaliasedBase->any_op_id() + "_"; m_any_op_id += BE_Globals::int_to_string(MaxSize()) + "_"; m_any_op_id += BE_Globals::int_to_string(sequence_count++); ColonToBar((char *)m_any_op_id); } // initialize typecode m_typecode->kind = DDS::tk_sequence; m_typecode->members.push_back(baseType->m_typecode); m_typecode->bounds = MaxSize(); m_typecode->length = 0; if (!IsBounded()) { m_typecode->bounds = 0; } if (isStringSeq) { m_typecode->id = "SEQ_DDS::String_" + BE_Globals::ulong_to_string(m_typecode->bounds); } init_type (enclosingScope, localName); }