diff --git a/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c b/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c index decbea91..bd906a85 100644 --- a/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c +++ b/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c @@ -13,7 +13,7 @@ static void FindHeaderBlock(const NHTTPResponseInfo* response, s32 position, NHT } } -static s8 ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST** block, s32* offset) { +static int ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST** block, s32* offset) { if(!*block) { if(*offset<1024) return (s8)response->hdrBufFirst[(*offset)++]; *block=response->hdrBufBlock_p; @@ -30,30 +30,31 @@ static int LowerCase(int character) { s32 NHTTPi_findNextLineHdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, s32* colon, s32* newlineLength) { NHTTPi_HDRBUFLIST* block; s32 offset; - s32 next=-1; - BOOL carriage=FALSE; if(colon) *colon=-1; - if(position>=limit) return -1; - FindHeaderBlock(response,position,&block,&offset); - for(; position=limit) return -1; - FindHeaderBlock(response,position,&block,&offset); - for(; positionresponse->headerLen) return FALSE; - if(length) { - if(position<1024) { - amount=length; - if(length>1024-position) amount=1024-position; - NHTTPi_memcpy(destination,response->hdrBufFirst+position,amount); - position+=amount; length-=amount; destination+=amount; - } + if (position + length <= response->headerLen) { if(length) { - s32 blocks; - position-=1024; - block=response->hdrBufBlock_p; - blocks=position>>9; - position&=511; - while(blocks--) block=block->next_p; - while(length) { + if(position<1024) { amount=length; - if(length>512-position) amount=512-position; - NHTTPi_memcpy(destination,block->block+position,amount); - position=(position+amount)&511; - block=block->next_p; - length-=amount; destination+=amount; + if(length>1024-position) amount=1024-position; + NHTTPi_memcpy(destination,response->hdrBufFirst+position,amount); + position+=amount; length-=amount; destination+=amount; + } + if(length) { + s32 blocks; + position-=1024; + block=response->hdrBufBlock_p; + blocks=position>>9; + position&=511; + while(blocks--) block=block->next_p; + while(length) { + amount=length; + if(length>512-position) amount=512-position; + NHTTPi_memcpy(destination,block->block+position,amount); + position+=amount; + position&=511; + block=block->next_p; + length-=amount; destination+=amount; + } } } + return TRUE; } - return TRUE; + return FALSE; } BOOL NHTTPi_isRecvBufFull(NHTTPResponseInfo* response, u32 length) { return length>=response->recvBufLen; } diff --git a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp index 1b7bf210..f416f08c 100644 --- a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp +++ b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp @@ -225,8 +225,7 @@ void SDChannelTitle::create() { comment->SetString(System::getMessage(0xad)); iplSDChannelTitle_rebuildBannerLayout(this); mpFade = new math::HermiteIntp(); - static f32 fadeRange[2] = {0.0f, 255.0f}; - mpFade->init(fadeRange[0], fadeRange[1], 28.0f, 0.0f, 0.0f); + mpFade->init(0.0f, 255.0f, 28.0f, 0.0f, 0.0f); mpFade->setAnmType(ANIM_TYPE_FORWARD); mpScreenCapture = new (System::getTreasureHeap(), 32) utility::Capture(System::getTreasureHeap(), 0, 0, System::getRenderModeObj()->fbWidth, System::getRenderModeObj()->efbHeight, GX_TF_RGB565); @@ -1016,8 +1015,7 @@ extern "C" void iplSDChannelTitle_preparePageRestart(SDChannelTitle* scene) { if (!scene->mScriptEnabled || scene->mScriptState == 4) { if (scene->mpChannelSelect->prepareRestarting(scene->mPage)) { scene->mpChannelSelect->startPageTransition(scene->mPage, scene->mIndex); - static f32 fadeRange[2] = {0.0f, 255.0f}; - scene->mpFade->init(fadeRange[0], fadeRange[1], 28.0f, 0.0f, 0.0f); + scene->mpFade->init(0.0f, 255.0f, 28.0f, 0.0f, 0.0f); scene->mpFade->setAnmType(ANIM_TYPE_BACKWARD); scene->mpFade->play(); scene->mState = 6;