示例#1
0
// time critical
zval* PHPQt::callPHPMethod(const zval* z_this_ptr, const char* methodName, const zend_uint param_count, zval** args)
{
    if(z_this_ptr == NULL){
        pError() << "could not call PHP method: no related PHP object found.";
    }

    zval *function_name;
    MAKE_STD_ZVAL(function_name);
    ZVAL_STRING(function_name,const_cast<char*>(methodName),1);

    zval* retval;
    ALLOC_INIT_ZVAL( retval );


    if(call_user_function( CG(function_table), const_cast<zval**>(&z_this_ptr), function_name, retval, param_count, args TSRMLS_CC ) == FAILURE){
        smokephp_object* o = PHPQt::getSmokePHPObjectFromZval(z_this_ptr);
        pError() << "could not call method " << o->ce_ptr()->name << "::" << methodName << "(...)";
    }

    // make sure we return the right object
    if(PHPQt::SmokePHPObjectExists(retval)){
        smokephp_object* o = PHPQt::getSmokePHPObjectFromZval(retval);
        retval = const_cast<zval*>(o->zval_ptr());
    }

    efree( function_name );
    return retval;
}
示例#2
0
void chkReg(long value, Vreg *v)
{
	if (value < 0 || value > 7)
	{
		pError("Invalid Register Value\n", v);
	}
}
示例#3
0
void main()
{
   char ch, file_name[25];
   //FILE *fp;
   int fd;
   int num_read;
 
   printf("Enter the name of file you wish to see\n");
   Gets(file_name);

   fd = open(file_name, O_RDONLY);
   if (fd < 0)
     {
       pError("Error while opening the file.\n");
       exit(EXIT_FAILURE);
     }
   printf("The contents of %s file are :\n", file_name);

   for (;;)
     {
       num_read = read(fd, &ch, sizeof(ch));
       if (num_read < '0')
	 {
	   perror("Error while reading the file.\n");
	   exit(EXIT_FAILURE);
	 }
       if (num_read == 0)
	 {
	   break;
	 }
       write(STDOUT_FILENO, ch, sizeof(ch));
     }
   return ch;
}
String ScriptEngine::GetErrorString()
{
	String ret = "";

	if (_ptr != NULL)
	{
		try{
			ComPtr<IScriptError> pError(_ptr->GetError());
			
			if (!pError.IsEmpty())
			{
				_bstr_t desc = _bstr_t("Error: ") + pError->GetDescription() + _bstr_t(", ");
				desc += pError->GetText() + _bstr_t("; in line ");
				desc += _bstr_t(pError->GetLine());
				ret = (LPCTSTR)desc;
				pError->Clear();
			}
		}
		catch (_com_error& e)
		{
			//TRACE((LPSTR)e.Description());
			//TRACE((LPSTR)"\n");
		}
	}
	return ret;
}
MI_Result
OMIInterface::Connect ()
{
    util::unique_ptr<MI_Instance, MI_Result (*)(MI_Instance*)> pError (
        NULL, MI_Instance_Delete);
    MI_Instance* pTemp = NULL;
    MI_Result result = MI_Application_Initialize (0, NULL, &pTemp, &m_App);
    pError.reset (pTemp);
    if (MI_RESULT_OK == result)
    {
        result = MI_Application_NewSession (
            &m_App, NULL, NULL, NULL, NULL, &pTemp, &m_Session);
        pError.reset (pTemp);
        if (MI_RESULT_OK == result)
        {
            result = MI_Application_NewOperationOptions (
                &m_App, MI_FALSE, &m_Options);
            if (MI_RESULT_OK == result)
            {
                MI_Interval timeoutInterval;
                memset (&timeoutInterval, 0, sizeof (MI_Interval));
                timeoutInterval.seconds = 30;
                timeoutInterval.minutes = 1;
                result = MI_OperationOptions_SetTimeout (
                    &m_Options, &timeoutInterval);
            }
        }
    }
    if (MI_RESULT_OK != result)
    {
        Disconnect ();
    }
    return result;
}
示例#6
0
void mov(char type, Vreg *v, InsElement ins)
{
	char OP1_TYPE = type & 0xf0;
	char OP2_TYPE = type & 0x0f;

	//printf("ins.operand1 : %ld\n", ins.operand1);
	//printf("ins.operand2 : %ld\n\n", ins.operand2);


	switch (OP1_TYPE)
	{
	case OP1_REG:
		chkReg(ins.operand1, v);
		v->reg[tmp] = v->reg[ins.operand1];
		break;
	case OP1_IMM:
		v->reg[tmp] = ins.operand1;
		break;
	case OP1_MEM:
		v->reg[tmp] = *(int *)ins.operand1;
		break;
	default:
		pError("mov::Invalid Operand type\n", v);
		break;
	}

	switch (OP2_TYPE)
	{
	case OP2_IMM:
		pError("mov::Invalid Operand type\n", v);
	case OP2_REG:
		chkReg(ins.operand2, v);
		v->reg[ins.operand2] = v->reg[tmp];
		break;
	case OP2_MEM:
		*(int *)ins.operand2 = v->reg[tmp];
		break;
	default:
		pError("mov::Invalid Operand type\n", v);
		break;
	}

	// sizeof (opcode + type + operand1 + operand2);
	v->eip += 10;
}
示例#7
0
// time critical
bool PHPQt::methodExists(const zend_class_entry* ce_ptr, const char* methodname)
{
    if(ce_ptr == NULL)
        pError() << "no class entry, could not check for message " << methodname;

    char* lcname = zend_str_tolower_dup(methodname, strlen(methodname));

    if(zend_hash_exists(const_cast<HashTable*>(&ce_ptr->function_table), lcname, strlen(methodname)+1)){
        return true;
    }

    efree(lcname);
    return false;
}
void AbstractMediaStream2Private::dataReady()
{
    Q_Q(AbstractMediaStream2);
    if (!eventDispatcher) {
        eventDispatcher = QAbstractEventDispatcher::instance(q->thread());
        if (!eventDispatcher) {
            pError() << "AbstractMediaStream2 needs to run in a thread with QEventLoop";
            return;
        } else {
            QObject::connect(eventDispatcher, SIGNAL(awake()), q, SLOT(_k_handleStreamEvent()), Qt::DirectConnection);
        }
    }
    eventDispatcher->wakeUp();
}
FactoryPrivate::~FactoryPrivate()
{
    for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
        mediaNodePrivateList.at(i)->deleteBackendObject();
    }
    if (objects.size() > 0) {
        pError() << "The backend objects are not deleted as was requested.";
        qDeleteAll(objects);
    }
    delete m_backendObject;
#ifndef QT_NO_PHONON_PLATFORMPLUGIN
    delete m_platformPlugin;
#endif //QT_NO_PHONON_PLATFORMPLUGIN
}
示例#10
0
bool Disk::Intersect(const Ray &r, Float *tHit,
                     SurfaceInteraction *isect) const {
    // Transform _Ray_ to object space
    Vector3f oErr, dErr;
    Ray ray = (*WorldToObject)(r, &oErr, &dErr);

    // Compute plane intersection for disk

    // Reject disk intersections for rays parallel to the disk's plane
    if (ray.d.z == 0) return false;
    Float tShapeHit = (height - ray.o.z) / ray.d.z;
    if (tShapeHit <= 0 || tShapeHit >= ray.tMax) return false;

    // See if hit point is inside disk radii and $\phimax$
    Point3f pHit = ray(tShapeHit);
    Float dist2 = pHit.x * pHit.x + pHit.y * pHit.y;
    if (dist2 > radius * radius || dist2 < innerRadius * innerRadius)
        return false;

    // Refine disk intersection point
    pHit.z = height;

    // Test disk $\phi$ value against $\phimax$
    Float phi = std::atan2(pHit.y, pHit.x);
    if (phi < 0) phi += 2 * Pi;
    if (phi > phiMax) return false;

    // Find parametric representation of disk hit
    Float u = phi / phiMax;
    Float rHit = std::sqrt(dist2);
    Float oneMinusV = ((rHit - innerRadius) / (radius - innerRadius));
    Float v = 1 - oneMinusV;
    Vector3f dpdu(-phiMax * pHit.y, phiMax * pHit.x, 0.);
    Vector3f dpdv =
        Vector3f(pHit.x, pHit.y, 0.) * (innerRadius - radius) / rHit;
    Normal3f dndu(0, 0, 0), dndv(0, 0, 0);

    // Compute error bounds for disk intersection
    Vector3f pError(0., 0., 0.);

    // Initialize _SurfaceInteraction_ from parametric information
    *isect = (*ObjectToWorld)(SurfaceInteraction(pHit, pError, Point2f(u, v),
                                                 -ray.d, dpdu, dpdv, dndu, dndv,
                                                 ray.time, this));

    // Update _tHit_ for quadric intersection
    *tHit = (Float)tShapeHit;
    return true;
}
示例#11
0
void CGroupPrice::GetGroupPrice(const _QuoteUpdateParams& Params)
{
	try
	{
		_SetDbKey(Params);

		long nResult = _GetOptions(Params);
		if(DBA_ERR_NO_ERROR == nResult)
		{
			if(m_bIsGotOptions && !m_bIsGotError)
			{
				CDBARecordPtr pRec = CDBARecordPtr(new DBA_RECORD_3);
				if(pRec != NULL)
				{
					ZeroMemory(pRec.get(), sizeof(DBA_RECORD_3));
					PublicLastQuote(&Params, pRec);
				}
			}
			else if(!m_bIsGotOptions && !m_bIsGotError) 
			{
				CErrorResponsePtr pError(new CErrorResponse());
				pError->m_enRequestType = enRequestLastQuote;
				const_cast<_QuoteUpdateParams&>(Params).CopyTo(pError->m_vtRequest);			
				pError->m_bstrDescription = L"Couldn't get options prices for underlying. Unknown symbol.";
				pError->m_Error = enNoDataAvailableForSymbol;
				CResponseBasePtr pErrorPtr = boost::shared_dynamic_cast<CResponseBase>(pError);
				PublicResponse(pErrorPtr);
			}
		}
		else
		{
			if(DBA_TERMINATED != nResult)
			{
				CErrorResponsePtr pError(new CErrorResponse());

				pError->m_enRequestType = enRequestLastQuote;
				const_cast<_QuoteUpdateParams&>(Params).CopyTo(pError->m_vtRequest);			
				if(nResult == DBA_ERR_KEY_NOT_FOUND)
				{
					pError->m_bstrDescription = L"Couldn't get options prices for underlying. Unknown symbol.";
					pError->m_Error = enNoDataAvailableForSymbol;
				}
				else if(nResult == DBA_TERMINATED)
				{
					pError->m_bstrDescription = L"Operation canceled by user.";
					pError->m_Error = enInternalError;
				}
				else
				{
					_bstr_t bs =  L"Couldn't get options prices for underlying. Error: ";
					bs += EtGetMessage(DBA_ERROR,nResult);
					bs += L" (";
					bs += _bstr_t(nResult);
					bs += L")";
					pError->m_bstrDescription = bs;
					pError->m_Error = enProviderInternalError;
				}
				CResponseBasePtr pErrorPtr = boost::shared_dynamic_cast<CResponseBase>(pError);
				PublicResponse(pErrorPtr);
			}
		}
	}
	catch (...) 
	{
	}
	m_vtRequest.Clear();
}
示例#12
0
long CGroupPrice::_OptionsProc(ULONG ulFunction, DBA_KEY *pDbaKey, DBA_OPTIONS_FILTER_RECORD *pDbaRec, DWORD dwStatus) 
{
	if (ulFunction == DBA_TERMINATE_STREAM_FUNCTION || m_bTerminate)
	{
		SetEvent(m_hTerminateGroupOption);
		return TRUE;
	}

	if (dwStatus == DBA_ERR_NO_ERROR)
	{
#ifdef __PERFMON
		if(m_spGlobalPerfCounter!=NULL)
			m_spGlobalPerfCounter->AddGroupRequestResponce();
		if(m_pPerfMon)
			m_pPerfMon->AddGroupRequestResponce();
#endif // __PERFMON


		if(_IsOurOptionExchange(pDbaKey->exchangeCode[0]))
		{
			_QuoteUpdateParams Params;
			ParamFromKey(*pDbaKey, enOPT, Params);

			CHahedKeyStringPtr pHashedKey = CHahedKeyStringPtr(new CHahedKeyString(pDbaKey));


			if(enGroupRequestLastQuote != m_enRequestType)
				EgLib::CEgLibTraceManager::Trace(LogSubsExt, __FUNCTION__, _T("[%s]\t Group Option Subscribe %s"), m_strUserName.c_str(), pHashedKey->GetKeyString().c_str()); 
			else
				EgLib::CEgLibTraceManager::Trace(LogSubsExt, __FUNCTION__, _T("[%s]\t Group Option Get %s"), m_strUserName.c_str(), pHashedKey->GetKeyString().c_str()); 

			//StoreClosePrice(pHashedKey, );
			//EgLib::CEgLibTraceManager::Trace(LogCustom, __FUNCTION__, _T("[%s]\t Group Option Close Price Set %s"), m_strUserName.c_str(), pHashedKey->GetKeyString().c_str()); 

			m_bIsGotOptions = true;

			if(enGroupRequestLastQuote != m_enRequestType)
			{
				if(m_bsUndSymbol.length())
				{
					CAutoLock lk(m_csGroupSubscript);
					m_mapGroupSubscript[m_bsUndSymbol].insert(pHashedKey);
				}

				CSubscriptionInfoPtr pSubscription = AddSubscription(pHashedKey, enOPT);
				pSubscription->SetClosePrice(pDbaRec->priceRec.dbaRec.close.price);

				if(enGroupRequestAllNotify == m_enRequestType)
				{
					CSubscribedResponsePtr pResponse = CSubscribedResponsePtr(new CSubscribedResponse(Params));
					PublicResponse(boost::shared_dynamic_cast<CResponseBase>(pResponse));
				}
				CDBARecordPtr pRecData =  CDBARecordPtr(new DBA_RECORD_3);
				memcpy(pRecData.get(), &pDbaRec->priceRec.dbaRec, sizeof(DBA_RECORD_3));

				pSubscription->AssignData(pRecData);
				PostIntoRealtimeMessageProcessor(pSubscription);

				pRecData = pSubscription->GetData();
				PublicLastQuote(&Params, pRecData);
			}
			
			if(enGroupRequestSubscribe != m_enRequestType && enGroupRequestAllNotify != m_enRequestType)
			{
				CDBARecordPtr pRec = CDBARecordPtr(new DBA_RECORD_3);
				if(pRec!=NULL)
				{
					memcpy(pRec.get(), &pDbaRec->priceRec.dbaRec, sizeof(DBA_RECORD_3));
					PublicLastQuote(&Params, pRec);
				}
			}
		}
		else
		{
			if(enGroupRequestLastQuote != m_enRequestType)
				m_NeedToUnsubscribe.push_back(CHahedKeyStringPtr(new CHahedKeyString(pDbaKey)));
		}
		return FALSE;
	}
	else 
	{
		CErrorResponsePtr pError(new CErrorResponse());
		pError->m_vtRequest = m_vtRequest;			
		if(enGroupRequestLastQuote != m_enRequestType)
		{
			pError->m_enRequestType = enSubscribeQuote;
			if(dwStatus == DBA_ERR_KEY_NOT_FOUND)
			{
				pError->m_bstrDescription = L"Unable to subscribe underlying options.";
				pError->m_Error = enNoDataAvailableForSymbol;
			}
			else if(dwStatus == DBA_ERR_INTEREST)
			{
				pError->m_bstrDescription = L"HyperFeed server subscription list is full";
				pError->m_Error = enProviderInternalError;
			}
			else
			{
				_bstr_t bs =  "Unable to get underlying options. Error: ";
				bs += EtGetMessage(DBA_ERROR,dwStatus);
				TCHAR buffer[0x100] = {0};				
				_ltot(dwStatus,buffer,10);
				bs += " (";
				bs += buffer;
				bs += ")";
				pError->m_bstrDescription = bs;
				pError->m_Error = enProviderInternalError;
			}
			EgLib::CEgLibTraceManager::Trace(LogError, __FUNCTION__ , _T("[%s]\t %s"), m_strUserName.c_str(), (LPCSTR)pError->m_bstrDescription);

		}
		else
		{
			pError->m_enRequestType = enRequestLastQuote;
			if(dwStatus == DBA_ERR_KEY_NOT_FOUND)
			{
				pError->m_bstrDescription = L"Couldn't get options prices for underlying. Unknown symbol.";
				pError->m_Error = enNoDataAvailableForSymbol;
			}
			else
			{
				_bstr_t bs =  "Couldn't get options prices for underlying. Error: ";
				bs += EtGetMessage(DBA_ERROR,dwStatus);
				TCHAR buffer[0x100] = {0};				
				_ltot(dwStatus,buffer,10);
				bs += " (";
				bs += buffer;
				bs += ")";
				pError->m_bstrDescription = bs;
				pError->m_Error = enProviderInternalError;
			}
		}
		CResponseBasePtr pErrorPtr = boost::shared_dynamic_cast<CResponseBase>(pError);
		PublicResponse(pErrorPtr);
		m_bIsGotError = true;
		EgLib::CEgLibTraceManager::Trace(LogError, __FUNCTION__ , _T("[%s]\t %s"), m_strUserName.c_str(), (LPCSTR)pError->m_bstrDescription);

	}

	return FALSE;
}
示例#13
0
文件: curve.cpp 项目: fseraph/pbrt-v3
bool Curve::recursiveIntersect(const Ray &ray, Float *tHit,
                               SurfaceInteraction *isect, const Point3f cp[4],
                               const Transform &rayToObject, Float u0, Float u1,
                               int depth) const {
    // Try to cull curve segment versus ray

    // Compute bounding box of curve segment, _curveBounds_
    Bounds3f curveBounds =
        Union(Bounds3f(cp[0], cp[1]), Bounds3f(cp[2], cp[3]));
    Float maxWidth = std::max(Lerp(u0, common->width[0], common->width[1]),
                              Lerp(u1, common->width[0], common->width[1]));
    curveBounds = Expand(curveBounds, 0.5 * maxWidth);

    // Compute bounding box of ray, _rayBounds_
    Float rayLength = ray.d.Length();
    Float zMax = rayLength * ray.tMax;
    Bounds3f rayBounds(Point3f(0, 0, 0), Point3f(0, 0, zMax));
    if (Overlaps(curveBounds, rayBounds) == false) return false;
    if (depth > 0) {
        // Split curve segment into sub-segments and test for intersection
        Float uMid = 0.5f * (u0 + u1);
        Point3f cpSplit[7];
        SubdivideBezier(cp, cpSplit);
        return (recursiveIntersect(ray, tHit, isect, &cpSplit[0], rayToObject,
                                   u0, uMid, depth - 1) ||
                recursiveIntersect(ray, tHit, isect, &cpSplit[3], rayToObject,
                                   uMid, u1, depth - 1));
    } else {
        // Intersect ray with curve segment

        // Test ray against segment endpoint boundaries
        Vector2f segmentDirection = Point2f(cp[3]) - Point2f(cp[0]);

        // Test sample point against tangent perpendicular at curve start
        Float edge =
            (cp[1].y - cp[0].y) * -cp[0].y + cp[0].x * (cp[0].x - cp[1].x);
        if (edge < 0) return false;

        // Test sample point against tangent perpendicular at curve end
        // TODO: update to match the starting test.
        Vector2f endTangent = Point2f(cp[2]) - Point2f(cp[3]);
        if (Dot(segmentDirection, endTangent) < 0) endTangent = -endTangent;
        if (Dot(endTangent, Vector2f(cp[3])) < 0) return false;

        // Compute line $w$ that gives minimum distance to sample point
        Float denom = Dot(segmentDirection, segmentDirection);
        if (denom == 0) return false;
        Float w = Dot(-Vector2f(cp[0]), segmentDirection) / denom;

        // Compute $u$ coordinate of curve intersection point and _hitWidth_
        Float u = Clamp(Lerp(w, u0, u1), u0, u1);
        Float hitWidth = Lerp(u, common->width[0], common->width[1]);
        Normal3f nHit;
        if (common->type == CurveType::Ribbon) {
            // Scale _hitWidth_ based on ribbon orientation
            Float sin0 = std::sin((1 - u) * common->normalAngle) *
                         common->invSinNormalAngle;
            Float sin1 =
                std::sin(u * common->normalAngle) * common->invSinNormalAngle;
            nHit = sin0 * common->n[0] + sin1 * common->n[1];
            hitWidth *= AbsDot(nHit, -ray.d / rayLength);
        }

        // Test intersection point against curve width
        Vector3f dpcdw;
        Point3f pc = EvalBezier(cp, Clamp(w, 0, 1), &dpcdw);
        Float ptCurveDist2 = pc.x * pc.x + pc.y * pc.y;
        if (ptCurveDist2 > hitWidth * hitWidth * .25) return false;
        if (pc.z < 0 || pc.z > zMax) return false;

        // Compute $v$ coordinate of curve intersection point
        Float ptCurveDist = std::sqrt(ptCurveDist2);
        Float edgeFunc = dpcdw.x * -pc.y + pc.x * dpcdw.y;
        Float v = (edgeFunc > 0.) ? 0.5f + ptCurveDist / hitWidth
                                  : 0.5f - ptCurveDist / hitWidth;

        // Compute hit _t_ and partial derivatives for curve intersection
        if (tHit != nullptr) {
            // FIXME: this tHit isn't quite right for ribbons...
            *tHit = pc.z / rayLength;
            // Compute error bounds for curve intersection
            Vector3f pError(2 * hitWidth, 2 * hitWidth, 2 * hitWidth);

            // Compute $\dpdu$ and $\dpdv$ for curve intersection
            Vector3f dpdu, dpdv;
            EvalBezier(common->cpObj, u, &dpdu);
            if (common->type == CurveType::Ribbon)
                dpdv = Normalize(Cross(nHit, dpdu)) * hitWidth;
            else {
                // Compute curve $\dpdv$ for flat and cylinder curves
                Vector3f dpduPlane = (Inverse(rayToObject))(dpdu);
                Vector3f dpdvPlane =
                    Normalize(Vector3f(-dpduPlane.y, dpduPlane.x, 0)) *
                    hitWidth;
                if (common->type == CurveType::Cylinder) {
                    // Rotate _dpdvPlane_ to give cylindrical appearance
                    Float theta = Lerp(v, -90., 90.);
                    Transform rot = Rotate(-theta, dpduPlane);
                    dpdvPlane = rot(dpdvPlane);
                }
                dpdv = rayToObject(dpdvPlane);
            }
            *isect = (*ObjectToWorld)(SurfaceInteraction(
                ray(pc.z), pError, Point2f(u, v), -ray.d, dpdu, dpdv,
                Normal3f(0, 0, 0), Normal3f(0, 0, 0), ray.time, this));
        }
        ++nHits;
        return true;
    }
}
示例#14
0
void MediaObjectPrivate::_k_stateChanged(Phonon::State newstate, Phonon::State oldstate)
{
    Q_Q(MediaObject);
    if (mediaSource.type() != MediaSource::Url) {
        // special handling only necessary for URLs because of the fallback
        emit q->stateChanged(newstate, oldstate);
        return;
    }

    if (errorOverride) {
        errorOverride = false;
        if (newstate == ErrorState) {
            return;
        }
        oldstate = ErrorState;
    }

    // backend MediaObject reached ErrorState, try a KioMediaSource
    if (newstate == Phonon::ErrorState && !kiofallback) {
        kiofallback = Platform::createMediaStream(mediaSource.url(), q);
        if (!kiofallback) {
            pDebug() << "backend MediaObject reached ErrorState, no KIO fallback available";
            emit q->stateChanged(newstate, oldstate);
            return;
        }
        pDebug() << "backend MediaObject reached ErrorState, trying Platform::createMediaStream now";
        ignoreLoadingToBufferingStateChange = false;
        ignoreErrorToLoadingStateChange = false;
        switch (oldstate) {
        case Phonon::BufferingState:
            // play() has already been called, we need to make sure it is called
            // on the backend with the KioMediaStream MediaSource now, too
            ignoreLoadingToBufferingStateChange = true;
            break;
        case Phonon::LoadingState:
            ignoreErrorToLoadingStateChange = true;
            // no extras
            break;
        default:
            pError() << "backend MediaObject reached ErrorState after " << oldstate
                << ". It seems a KioMediaStream will not help here, trying anyway.";
            emit q->stateChanged(Phonon::LoadingState, oldstate);
            break;
        }
        kiofallback->d_func()->setMediaObjectPrivate(this);
        MediaSource mediaSource(kiofallback);
        mediaSource.setAutoDelete(true);
        pINTERFACE_CALL(setSource(mediaSource));
        if (oldstate == Phonon::BufferingState) {
            q->play();
        }
        return;
    } else if (ignoreLoadingToBufferingStateChange &&
            kiofallback &&
            oldstate == Phonon::LoadingState) {
        if (newstate != Phonon::BufferingState) {
            emit q->stateChanged(newstate, Phonon::BufferingState);
        }
        return;
    } else if (ignoreErrorToLoadingStateChange && kiofallback && oldstate == ErrorState) {
        if (newstate != LoadingState) {
            emit q->stateChanged(newstate, Phonon::LoadingState);
        }
        return;
    }

    emit q->stateChanged(newstate, oldstate);
}