HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *pPropertyBag, REFIID riid, LPVOID *ppvObject) { InstanceObjectFactory *pInstanceObjectFactory; HRESULT hr = E_FAIL; TRACE("(RegistryPropertyBag=%p, riid=%s, ppvObject=%p)\n", pPropertyBag, debugstr_guid(riid), ppvObject); pInstanceObjectFactory = shdocvw_alloc(sizeof(InstanceObjectFactory)); if (pInstanceObjectFactory) { pInstanceObjectFactory->lpIClassFactoryVtbl = &InstanceObjectFactory_IClassFactoryVtbl; pInstanceObjectFactory->m_cRef = 0; memcpy(&pInstanceObjectFactory->m_clsidInstance, rclsid, sizeof(CLSID)); pInstanceObjectFactory->m_pPropertyBag = pPropertyBag; IPropertyBag_AddRef(pPropertyBag); IClassFactory_AddRef(STATIC_CAST(IClassFactory, pInstanceObjectFactory)); hr = IClassFactory_QueryInterface(STATIC_CAST(IClassFactory, pInstanceObjectFactory), riid, ppvObject); IClassFactory_Release(STATIC_CAST(IClassFactory, pInstanceObjectFactory)); } return hr; }
void TAknNoteResData::ReadFromResource(TResourceReader& aResReader) { iResId = aResReader.ReadInt32(); iTimeout = STATIC_CAST(CAknNoteDialog::TTimeout, aResReader.ReadInt32()); iTone = STATIC_CAST(CAknNoteDialog::TTone, aResReader.ReadInt16()); iText = aResReader.ReadTPtrC(); }
// Writes entire DER encoding of this object into the given buffer EXPORT_C void CASN1EncBase::WriteDERL(TDes8& aBuf, TUint& aPos) const { __ASSERT_ALWAYS(aBuf.Length() - STATIC_CAST(TInt, aPos) >= STATIC_CAST(TInt, LengthDER()), Panic(KErrDescriptorTooShort)); WriteHelperL(aBuf, aPos, iTagLengthDER, &CASN1EncBase::WriteTagDERL); WriteHelperL(aBuf, aPos, iLengthLengthDER, &CASN1EncBase::WriteLengthDER); WriteHelperL(aBuf, aPos, iContentsLengthDER, &CASN1EncBase::WriteContentsDERL); }
void CSecureSocketReader::SuplMessageLength() { SUPLLOG(ELogP1, "CSecureSocketReader::SuplMessageLength() Begin\n"); // Get the first two bytes of iBuffer as a TInt and put it in iSuplMessageLength iCurrentMessageSize = STATIC_CAST(TUint8,iBuffer[0]); iCurrentMessageSize = iCurrentMessageSize << 8; iCurrentMessageSize |= STATIC_CAST(TUint8,iBuffer[1]); SUPLLOG(ELogP1, "CSecureSocketReader::SuplMessageLength() End\n"); }
//------------------------------------------------------------------------------------------------------------ TText CPerfDbCreator::RandomCharCode(TText aLowerBound,TText aUpperBound) { TText charCode=STATIC_CAST(TText,(Math::Rand(iSeed)%(aUpperBound-aLowerBound))+aLowerBound); ASSERT(charCode>=aLowerBound && charCode<=aUpperBound); iTextSeed.NumFixedWidthUC((TUint) iSeed, EHex,8); return charCode; }
LOCAL_C TInt ModifiersChangedEvent(const TWsEvent& aWsEvent) { TModifiersChangedEvent* modEvent = aWsEvent.ModifiersChanged(); TUint modstate = KMOD_NONE; if (modEvent->iModifiers & EModifierLeftShift) modstate |= KMOD_LSHIFT; if (modEvent->iModifiers & EModifierRightShift) modstate |= KMOD_RSHIFT; if (modEvent->iModifiers & EModifierLeftCtrl) modstate |= KMOD_LCTRL; if (modEvent->iModifiers & EModifierRightCtrl) modstate |= KMOD_RCTRL; if (modEvent->iModifiers & EModifierLeftAlt) modstate |= KMOD_LALT; if (modEvent->iModifiers & EModifierRightAlt) modstate |= KMOD_RALT; if (modEvent->iModifiers & EModifierLeftFunc) modstate |= KMOD_LMETA; if (modEvent->iModifiers & EModifierRightFunc) modstate |= KMOD_RMETA; if (modEvent->iModifiers & EModifierCapsLock) modstate |= KMOD_CAPS; SDL_SetModState(STATIC_CAST(SDLMod,(modstate | KMOD_LSHIFT))); return 0; }
static ALvoid ALflangerState_Destruct(ALflangerState *state) { al_free(state->SampleBuffer[0]); state->SampleBuffer[0] = NULL; state->SampleBuffer[1] = NULL; ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); }
EXPORT_C CAknNoteWrapper::CAknNoteWrapper(CAknNoteWrapper** aSelfPtr) : CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,aSelfPtr)) { iTimeoutInMicroseconds = -1; iTone = STATIC_CAST(TTone,-1); AKNTASHOOK_ADD( this, "CAknNoteWrapper" ); }
static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCnullBackend, ALCbackend, self); ATOMIC_INIT(&self->killNow, AL_TRUE); }
// --------------------------------------------------------- // CDdEng::CheckVersionL() // --------------------------------------------------------- // void CDdEng::CheckVersionL( const TDesC& aVersion ) const { TUint32 majorVer = 1; // If version is not specified, it defaults to 1.0. if( aVersion.Length() ) { // Version is specified, parse it to get get major version. TLex lex( aVersion ); TReal realVer; TInt32 intVer; if( lex.Val( realVer ) != KErrNone ) { // Could not parse version as a real number, this indicates that // the DD-Version is some rubbish string. User::Leave( KErrCodInvalidDescriptor ); } User::LeaveIfError( Math::Int( intVer, realVer ) ); if( intVer < 0 ) { // Negative DD-Version? User::Leave( KErrCodInvalidDescriptor ); } majorVer = STATIC_CAST( TUint32, intVer ); } // For code clarity, we always check major version (even if not given and // defaults to supported 1.0). if( majorVer > KDdSupportedMajorVersion ) { User::Leave( KErrCodUnsupportedVersion ); } }
static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self) { void *buffer = NULL; int i; /* Tell the processing thread to quit and wait for it to do so. */ if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) { PostThreadMessage(self->thread, WM_QUIT, 0, 0); althrd_join(self->thread, &i); /* Make sure capture is stopped and all pending buffers are flushed. */ waveInReset(self->InHdl); // Release the wave buffers for(i = 0;i < 4;i++) { waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); if(i == 0) buffer = self->WaveBuffer[i].lpData; self->WaveBuffer[i].lpData = NULL; } free(buffer); } ll_ringbuffer_free(self->Ring); self->Ring = NULL; // Close the Wave device if(self->InHdl) waveInClose(self->InHdl); self->InHdl = 0; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); }
static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ALbyte *BufferData; ALint BufferSize; ALuint i; ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwinmmPlayback_mixerProc, self) != althrd_success) return ALC_FALSE; InitRef(&self->WaveBuffersCommitted, 0); // Create 4 Buffers BufferSize = device->UpdateSize*device->NumUpdates / 4; BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); BufferData = calloc(4, BufferSize); for(i = 0;i < 4;i++) { memset(&self->WaveBuffer[i], 0, sizeof(WAVEHDR)); self->WaveBuffer[i].dwBufferLength = BufferSize; self->WaveBuffer[i].lpData = ((i==0) ? (CHAR*)BufferData : (self->WaveBuffer[i-1].lpData + self->WaveBuffer[i-1].dwBufferLength)); waveOutPrepareHeader(self->OutHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); waveOutWrite(self->OutHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); IncrementRef(&self->WaveBuffersCommitted); } return ALC_TRUE; }
void CProtocolKey::BindToL(CProtocolBase* aProtocol) /** * Bind requests protocols "below". * * The PFKEY allows here only cryptographic libraries, which are * recognized from their protocol number #KProtocolCrypto . * * @param aProtocol The Cryptographic library. */ { ASSERT(this != aProtocol); // Find out the ID of given protocol object TUint id; { TServerProtocolDesc info; aProtocol->Identify(&info); id = info.iProtocol; } if (id == STATIC_CAST(TUint, KProtocolCrypto)) iCrypto->AddLibraryL((CProtocolCrypto *)aProtocol); else User::Leave(KErrGeneral); // Only Crypto libraries can be bound to PFKEY! }
void CIntTestParameter::Construct(TDes& aValue) { TLex lexValue(aValue); if(aValue.Left(2) == _L("0x")) { // its a hex number TUint hexValue; TLex hexLex(aValue.Mid(2)); if(hexLex.Val(hexValue, EHex)!=KErrNone) return; // checks if hexLex is at end of string, if not there was garbage in the string // so throw it out else if(!hexLex.Eos()) return; iValue = STATIC_CAST(TInt,hexValue); } else if(lexValue.Val(iValue)!=KErrNone) return; // checks if lexValue is at end of string, if not there was garbage in the string // so throw it out else if(!lexValue.Eos()) return; iValid = ETrue; }
FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) { ALCwinmmPlayback *self = arg; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; WAVEHDR *WaveHdr; MSG msg; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); while(GetMessage(&msg, NULL, 0, 0)) { if(msg.message != WOM_DONE) continue; if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { if(ReadRef(&self->WaveBuffersCommitted) == 0) break; continue; } WaveHdr = ((WAVEHDR*)msg.lParam); ALCwinmmPlayback_lock(self); aluMixData(device, WaveHdr->lpData, WaveHdr->dwBufferLength / self->Format.nBlockAlign); ALCwinmmPlayback_unlock(self); // Send buffer back to play more data waveOutWrite(self->OutHdl, WaveHdr, sizeof(WAVEHDR)); IncrementRef(&self->WaveBuffersCommitted); } return 0; }
static void FSynth_setState(FSynth *self, ALenum state) { if(state == AL_PLAYING && self->FontID == FLUID_FAILED) FSynth_loadSoundfont(self, NULL); MidiSynth_setState(STATIC_CAST(MidiSynth, self), state); }
static void FSynth_setGain(FSynth *self, ALfloat gain) { /* Scale gain by an additional 0.2 (-14dB), to help keep the mix from clipping. */ fluid_settings_setnum(self->Settings, "synth.gain", 0.2 * gain); fluid_synth_set_gain(self->Synth, 0.2f * gain); MidiSynth_setGain(STATIC_CAST(MidiSynth, self), gain); }
TBool CMMFSwCodecUtility::RampAudio(CMMFDataBuffer* aBuffer) { TInt i=0; TInt length = aBuffer->Data().Length()>>1; TInt16* sample = REINTERPRET_CAST(TInt16*,&aBuffer->Data()[0]); TInt64 theResult(0); while ((i < length) && (iRampIncr < iRampSamples)) { theResult = sample[i]; theResult *= iRampIncr; theResult /= iRampSamples; sample[i] = STATIC_CAST(TInt16, I64LOW(theResult) ); if ((iChannels == 1) || (!iSkip)) { iRampIncr++; } iSkip = !iSkip; i++; } if (iRampIncr < iRampSamples) return ETrue; else return EFalse; }
TInt CIPv6Binder::DeleteContext(TDes8& aContextParameters) /** * Deletes a context. As the NIF is responsible for one primary context, * this is equivalent to closing down the NIF. * * @param aContextParameters Parameters of the context to delete * @return KErrArgument if an incorrect structure is passed, otherwise KErrNone */ { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_DELETECONTEXT_1, "CIPv6Binder::DeleteContext"); if (aContextParameters.Length() != sizeof(TContextParameters)) { return KErrArgument; } TUint8* ptr = CONST_CAST(TUint8*, aContextParameters.Ptr()); TContextParameters* params = REINTERPRET_CAST(TContextParameters*, ptr); if (params->iContextInfo.iContextId != STATIC_CAST(TInt8, GetFlow().GetBcaController()->Nsapi())) { params->iReasonCode = KErrBadName; } else { params->iReasonCode = KErrNone; GetFlow().Stop(KErrNone, MNifIfNotify::EDisconnect); } return KErrNone; }
static void ALCwinmmPlayback_Destruct(ALCwinmmPlayback *self) { if(self->OutHdl) waveOutClose(self->OutHdl); self->OutHdl = 0; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); }
/** * * Convert * @param aSrc * @param aDst * @param aSamples * Signed 16bit to Unsigned 8bit */ EXPORT_C void TMMFAudioS16ToU8PcmCodec::Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples) { while (aSamples--) { aSrc++; *aDst++ = STATIC_CAST( TUint8, (*aSrc++) - KMaskSign8bit); } }
// --------------------------------------------------------- // RFavouritesSrvTable::WapAp // --------------------------------------------------------- // TFavouritesWapAp RFavouritesSrvTable::WapAp() const { TFavouritesWapAp wapAp; wapAp.iApId = ColUint32 ( iColNoWapApId ); wapAp.iValueKind = STATIC_CAST ( TFavouritesWapAp::TValueKind, ColInt ( iColNoWapApValueKind ) ); return wapAp; }
static malValuePtr macroExpand(malValuePtr obj, malEnvPtr env) { while (const malLambda* macro = isMacroApplication(obj, env)) { const malSequence* seq = STATIC_CAST(malSequence, obj); obj = macro->apply(seq->begin() + 1, seq->end()); } return obj; }
void CStatusWindow::ChangePointerCursorMode() { TInt mode=(iMode+1)%(EPointerCursorLastMode+1); iMode=STATIC_CAST(TPointerCursorMode,mode); UpdateString2(); DoDraw(); iUpdateNeeded=ETrue; }
/** * Destroys the logger. This function is responsible to deallocate any * resources used by the logger. In particular, if buffering is internally * used, it needs to flush the buffer. */ static void FileLoggerDestroy(PLogger *self) { FileLogger *p = STATIC_CAST(self, FileLogger, base); pfflush(p->fp); if (p->fp != PSTDERR && p->fp != PSTDOUT) pfclose(p->fp); FREE(p); }
static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCsolarisBackend, ALCbackend, self); self->fd = -1; self->mix_data = NULL; ATOMIC_INIT(&self->killNow, AL_FALSE); }
/** @SYMTestCaseID GRAPHICS-WSERV-0021 @SYMDEF DEF081259 @SYMTestCaseDesc General PointerCursor Tests @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions Exercise the different pointercursor methods of a Window Server Session @SYMTestExpectedResults The methods are called without error */ void CTTSprite::GeneralPointerCursor() { if (!TestBase()->ConfigurationSupportsPointerEventTesting()) { INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); return; } TInt currentSMode=TheClient->iScreen->CurrentScreenMode(); TInt altSMode=-1; if (TheClient->iScreen->NumScreenModes()>1) altSMode=(currentSMode==1?0:1); RWsSession &ws=TheClient->iWs; TRect rect=ws.PointerCursorArea(); TRect testRect1(TPoint(rect.iBr.iX/4,rect.iBr.iY/4),TSize(rect.Width()/2,rect.Height()/2)); TRect testRect2(TPoint(rect.iBr.iX/3,rect.iBr.iY/3),TSize(2*rect.Width()/3,2*rect.Height()/3)); ws.SetPointerCursorArea(testRect1); TEST(ws.PointerCursorArea()==testRect1); TEST(ws.PointerCursorArea(currentSMode)==testRect1); ws.SetPointerCursorArea(currentSMode,testRect2); TEST(ws.PointerCursorArea()==testRect2); TEST(ws.PointerCursorArea(currentSMode)==testRect2); ws.SetPointerCursorArea(rect); TEST(ws.PointerCursorArea()==rect); if (altSMode>=0) { rect=ws.PointerCursorArea(altSMode); testRect1.iTl.iX=rect.iBr.iX/4; testRect1.iTl.iY=rect.iBr.iY/4; testRect1.SetWidth(rect.Width()/2); testRect1.SetHeight(rect.Height()/2); ws.SetPointerCursorArea(altSMode,testRect1); TEST(ws.PointerCursorArea(altSMode)==testRect1); ws.SetPointerCursorArea(altSMode,rect); TEST(ws.PointerCursorArea(altSMode)==rect); } TPointerCursorMode currentMode=ws.PointerCursorMode(); TInt ii; TInt err1; for(ii=EPointerCursorFirstMode;ii<=EPointerCursorLastMode;ii++) { ws.SetPointerCursorMode(STATIC_CAST(TPointerCursorMode,ii)); err1 = ws.PointerCursorMode(); TEST(ii==err1); if (ii!=err1) INFO_PRINTF3(_L("ws.PointerCursorMode() return value - Expected: %d, Actual: %d"), ii, err1); } ws.SetPointerCursorMode(currentMode); TEST(currentMode==ws.PointerCursorMode()); TPoint point1(10,12); TPoint point2(24,20); ws.PointerCursorPosition(); ws.SetPointerCursorPosition(point1); TEST(ws.PointerCursorPosition()==point1); ws.SetPointerCursorPosition(point2); TEST(ws.PointerCursorPosition()==point2); }
static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { aluMatrixf matrix; ALfloat cw, a; ALuint i; if(props->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) state->Process = ModulateSin; else if(props->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) state->Process = ModulateSaw; else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/ state->Process = ModulateSquare; state->step = fastf2u(props->Modulator.Frequency*WAVEFORM_FRACONE / Device->Frequency); if(state->step == 0) state->step = 1; /* Custom filter coeffs, which match the old version instead of a low-shelf. */ cw = cosf(F_TAU * props->Modulator.HighPassCutoff / Device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) { state->Filter[i].a1 = -a; state->Filter[i].a2 = 0.0f; state->Filter[i].b1 = -a; state->Filter[i].b2 = 0.0f; state->Filter[i].input_gain = a; state->Filter[i].process = ALfilterState_processC; } aluMatrixfSet(&matrix, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f ); STATIC_CAST(ALeffectState,state)->OutBuffer = Device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = Device->FOAOut.NumChannels; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) ComputeFirstOrderGains(Device->FOAOut, matrix.m[i], Slot->Params.Gain, state->Gain[i]); }
static ALCbackend* ALCwinmmBackendFactory_createBackend(ALCwinmmBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) { if(type == ALCbackend_Playback) { ALCwinmmPlayback *backend; NEW_OBJ(backend, ALCwinmmPlayback)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCwinmmCapture *backend; NEW_OBJ(backend, ALCwinmmCapture)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } return NULL; }
static void ALCwinmmCapture_Construct(ALCwinmmCapture *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCwinmmCapture, ALCbackend, self); InitRef(&self->WaveBuffersCommitted, 0); self->InHdl = NULL; ATOMIC_INIT(&self->killNow, AL_TRUE); }