Ejemplo n.º 1
0
bool FCrashUpload::SendCheckReportRequest()
{
	FString XMLString;

	UE_LOG(CrashReportClientLog, Log, TEXT("Sending HTTP request (checking report)"));
	auto Request = CreateHttpRequest();
	if (State == EUploadState::CheckingReport)
	{
		AssignReportIdToPostDataBuffer();
		Request->SetURL(UrlPrefix / TEXT("CheckReport"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=us-ascii"));
	}
	else
	{
		// This part is Windows-specific on the server
		ErrorReport.LoadWindowsReportXmlFile( XMLString );

		// Convert the XMLString into the UTF-8.
		FTCHARToUTF8 Converter( (const TCHAR*)*XMLString, XMLString.Len() );
		const int32 Length = Converter.Length();
		PostData.Reset( Length );
		PostData.AddUninitialized( Length );
		CopyAssignItems( (ANSICHAR*)PostData.GetData(), Converter.Get(), Length );

		Request->SetURL(UrlPrefix / TEXT("CheckReportDetail"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("text/plain; charset=utf-8"));
	}

	UE_LOG( CrashReportClientLog, Log, TEXT( "PostData Num: %i" ), PostData.Num() );
	Request->SetVerb(TEXT("POST"));
	Request->SetContent(PostData);

	return Request->ProcessRequest();
}
Ejemplo n.º 2
0
TBool HPingHeader::VerifyNonEcho(TInt aId)
//
// Verify header which is not echo reply
// 
	{
	
	// Fill TInet6HeaderICMP_Echo from packet data
	TBool ret = SetHeader();

	// Look at IP version
	if(ret && iIPVersion == KAfInet)	// IP4
		{
		switch(Type())
			{
		case KIPv4PingTypeUnreachable:
		case KIPv4PingTypeSourceQuench:
		case KIPv4PingTypeRedirect:
		case KIPv4PingTypeTimeExceeded:
		case KIPv4PingTypeBadParameter:
			break;
		default:
			ret = EFalse;
			}
	
		if(ret && (DataLength() < (TInt)KIcmpHeaderSize))
			{
		    	ret = EFalse;
			}

		if(ret)
			{
			ret = SetHeader(KIcmpHeaderSize + KMinIpHeaderSize);
			if(ret && (Type() != KIPv4PingTypeEchoRequest || Identifier() != aId))
				{
				ret = EFalse;
				}
			}
		}
	else
		{				// IP6
		switch(Type())
			{
		case KIPv6PingTypeUnreachable:
		case KIPv6PingTypePacketTooBig:
		case KIPv6PingTypeTimeExeeded:
		case KIPv6PingTypeParamProblem:
			break;
		default:
			ret = EFalse;
			}
		}

	return ret;
	}
Ejemplo n.º 3
0
void FCrashUpload::UploadNextFile()
{
	UE_LOG(CrashReportClientLog, Log, TEXT("UploadNextFile: have %d pending files"), PendingFiles.Num());

	// Loop to keep trying files until a send succeeds or we run out of files
	while (PendingFiles.Num() != 0)
	{
		FString PathOfFileToUpload = PendingFiles.Pop();
		// Remember if there was already a diagnostics file in the report, so we don't send it twice
		if (PathOfFileToUpload.EndsWith(GDiagnosticsFilename))
		{
			bDiagnosticsFileSent = true;
		}
		
		if (FPlatformFileManager::Get().GetPlatformFile().FileSize(*PathOfFileToUpload) > MaxFileSizeToUpload)
		{
			UE_LOG(CrashReportClientLog, Warning, TEXT("Skipping large crash report file"));
			continue;
		}

		if (!FFileHelper::LoadFileToArray(PostData, *PathOfFileToUpload))
		{
			UE_LOG(CrashReportClientLog, Warning, TEXT("Failed to load crash report file"));
			continue;
		}

		UE_LOG(CrashReportClientLog, Log, TEXT("UploadNextFile: uploading %d bytes ('%s')"), PostData.Num(), *PathOfFileToUpload);
		FString Filename = FPaths::GetCleanFilename(PathOfFileToUpload);
		if (Filename == "diagnostics.txt")
		{
			// Ensure diagnostics file is capitalized for server
			Filename[0] = 'D';
		}

		// Set up request for upload
		UE_LOG(CrashReportClientLog, Log, TEXT("Sending HTTP request (posting file)"));
		auto Request = CreateHttpRequest();
		Request->SetVerb(TEXT("POST"));
		Request->SetHeader(TEXT("Content-Type"), TEXT("application/octet-stream"));
		Request->SetURL(UrlPrefix / TEXT("UploadReportFile"));
		Request->SetContent(PostData);
		Request->SetHeader(TEXT("DirectoryName"), *ErrorReport.GetReportDirectoryLeafName());
		Request->SetHeader(TEXT("FileName"), Filename);
		Request->SetHeader(TEXT("FileLength"), FString::FromInt(PostData.Num()));

		if (Request->ProcessRequest())
		{
			return;
		}

		UE_LOG(CrashReportClientLog, Warning, TEXT("Failed to send file upload request"));
	}
	PostReportComplete();
}
Ejemplo n.º 4
0
/*--------------------------------------------------------------------------
 * Resampling Wave for Sinc
 */
void Wave::ResamplingSinc(const uint16_t resampling, const int sincLengthHarf) {
    if (flag == false) {
        std::cerr << "Please Create or Input Wave." << std::endl;
    } else {
        double pitch;
        int sincLength;
        double t;
        int offset;
        int n, m;
        std::vector<double> mono;
        std::vector<double> stereoL, stereoR;

        pitch = (double)samplesPerSec / (double)resampling;
        sincLength = sincLengthHarf * 2;

        if (channels == 1) {
            mono.resize(monodata.size() / pitch);

            for (n = 0; n < mono.size(); n++) {
                t = pitch * n;
                offset = (int)t;
                for (m = offset - (sincLength / 2); m <= offset + (sincLength / 2); m++) {
                    if (m >= 0 && m < monodata.size()) {
                        mono[n] += monodata[m] * Sinc(M_PI * (t - m));
                    }
                }
            }
            monodata = mono;
            samplesPerSec = resampling;
            sizeOfData = mono.size() * wavfhdr.wavfmt.blockAlign;
            SetHeader();
        } else if (channels == 2) {
            stereoL.resize(ldata.size() / pitch);
            stereoR.resize(rdata.size() / pitch);

            for (n = 0; n < stereoL.size(); n++) {
                t = pitch * n;
                offset = (int)t;
                for (m = offset - (sincLength / 2); m <= offset + (sincLength / 2); m++) {
                    if (m >= 0 && m < ldata.size()) {
                        stereoL[n] += ldata[m] * Sinc(M_PI * (offset - m));
                        stereoR[n] += rdata[m] * Sinc(M_PI * (offset - m));
                    }
                }
            }
            ldata = stereoL;
            rdata = stereoR;
            samplesPerSec = resampling;
            sizeOfData = ldata.size() * wavfhdr.wavfmt.blockAlign;
            SetHeader();
        }
    }
}
Ejemplo n.º 5
0
/// Creates and sends a valid HTTP 1.0 or 1.1 response, based on the given request.
/// The headers must be set before this call is made.
/// This call sets up chunked transfer encoding if the request was protocol HTTP/1.1, otherwise uses a zero-content-length HTTP/1.0 response.
/// \param code The HTTP response code. Usually you want 200.
/// \param message The HTTP response message. Usually you want "OK".
/// \param request The HTTP request to respond to.
/// \param conn The connection to send over.
void HTTP::Parser::StartResponse(std::string code, std::string message, HTTP::Parser & request, Socket::Connection & conn, bool bufferAllChunks) {
  std::string prot = request.protocol;
  sendingChunks = (!bufferAllChunks && protocol == "HTTP/1.1" && request.GetHeader("Connection")!="close");
  CleanPreserveHeaders();
  protocol = prot;
  if (sendingChunks){
    SetHeader("Transfer-Encoding", "chunked");
  } else {
    SetHeader("Connection", "close");
  }
  bufferChunks = bufferAllChunks;
  if (!bufferAllChunks){
    SendResponse(code, message, conn);
  }
}
Ejemplo n.º 6
0
CWizard::CWizard(HWND hWndParent) :
	m_fCentered(FALSE),
	m_pgIntro(hWndParent, &m_wizData),
	m_pgBindType(hWndParent, &m_wizData),
	m_pgSelectDisk(hWndParent, &m_wizData),
	m_pgComplete(hWndParent, &m_wizData),
	CPropertySheetImpl<CWizard>(IDS_BNZ_TITLE, 0, hWndParent)
{
	SetWizardMode();
	m_psh.dwFlags |= PSH_WIZARD97 | PSH_USEPAGELANG;
	SetWatermark(MAKEINTRESOURCE(IDB_WATERMARK256));
	SetHeader(MAKEINTRESOURCE(IDB_BANNER256));

	// StretchWatermark(true);
	AddPage(m_pgIntro);
	AddPage(m_pgBindType);
	AddPage(m_pgSelectDisk);
	AddPage(m_pgComplete);

//	::ZeroMemory(
//		&m_wizData, 
//		sizeof(WIZARD_DATA));
	m_wizData.ppsh = this;
	m_wizData.ppspComplete = &m_pgComplete;

	m_wizData.m_nBindType = NMT_AGGREGATE;
	m_wizData.m_nDiskCount = 2;
}
Ejemplo n.º 7
0
TreeViewItem::TreeViewItem()
    : _showDotLine(false)
    , _internalIndent(0)
{
    SetClassName(_T("TreeViewItem"));

    WriteFlag(CoreFlags::IsSupportMouseOver, true);

    SetHorizontalContentAlignment(HoriContentAlignment::Left);
    SetVerticalContentAlignment(VertContentAlignment::Center);

    SetPadding(suic::Rect(2,0,0,0));

    _check.SetAutoDelete(false);
    _icon.SetAutoDelete(false);

    _expand = new TreeButton();

    _check.SetVerticalAlignment(VertAlignment::Center);
    _icon.SetVerticalAlignment(VertAlignment::Center);    
    _expand->SetVerticalAlignment(VertAlignment::Center);

    _headerHost->AddChild(_expand.get());
    _headerHost->AddChild(&_check);
    _headerHost->AddChild(&_icon);

    SetHeader(new ui::Label());
    _header->SetMinHeight(16);
}
Ejemplo n.º 8
0
void UPhilipsHueBridge::AquireUserID(bool FromFile)
{

	if (FromFile&&GetUserIDFromLocalFile())
	{
		// Test if the User ID stored local is authorized
		auto HttpRequest1 = FHttpModule::Get().CreateRequest();
		{
			HttpRequest1->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleUserIDTestRequestComplete);
			HttpRequest1->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api/") + ConnectedUser);
			HttpRequest1->SetVerb(TEXT("GET"));
			HttpRequest1->ProcessRequest();
		}
		return;
	}

	auto HttpRequest = FHttpModule::Get().CreateRequest();
	{
		HttpRequest->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleUserIDRequestComplete);
		HttpRequest->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api"));
		HttpRequest->SetHeader("Content-Type", "application/json");
		HttpRequest->SetVerb(TEXT("POST"));
		HttpRequest->SetContentAsString(UserRequestJson());
		HttpRequest->ProcessRequest();
	}
}
Ejemplo n.º 9
0
char * const MemoryManager::CoalesceWithPreviousBlock(char * const ptr)
{
	if (IsPreviousBlockFree(ptr) && IsValidAddress(GetPreviousBlock(ptr)))
	{

		//	Remove previous block from free blocks
		freeBlocks.remove((Node*)GetPreviousBlock(ptr));


		//	Little trick:
		//		Set the pointer to point to the previous free block
		(char*)ptr = GetPreviousBlock(ptr);

		//Update header
		size_t newHeaderData = GetHeader(ptr) + GetHeader(GetNextBlock(ptr));
		SetHeader(ptr, newHeaderData);
		//Update footer
		SetFooter(ptr, newHeaderData);

		return ptr;
	}
	else
	{
		return ptr;
	}
}
Ejemplo n.º 10
0
void FCrashUpload::PostReportComplete()
{
	if (PauseState == EUploadState::PostingReportComplete)
	{
		// Wait for confirmation
		SetCurrentState(EUploadState::WaitingToPostReportComplete);
		return;
	}

	AssignReportIdToPostDataBuffer();

	
	auto Request = CreateHttpRequest();
	Request->SetVerb( TEXT( "POST" ) );
	Request->SetURL(UrlPrefix / TEXT("UploadComplete"));
	Request->SetHeader( TEXT( "Content-Type" ), TEXT( "text/plain; charset=us-ascii" ) );
	Request->SetContent(PostData);
	UE_LOG( CrashReportClientLog, Log, TEXT( "Sending HTTP request: %s" ), *Request->GetURL() );

	if (Request->ProcessRequest())
	{
		SetCurrentState(EUploadState::PostingReportComplete);
	}
	else
	{
		CheckPendingReportsForFilesToUpload();
	}
}
Ejemplo n.º 11
0
    void RequestHeaders::FixContentThings(/*int length*/)
    {
        std::map<std::string, std::string>::iterator it;
		
		bool haveContentType=false;

		it=fHeaders.begin();
		
		while(it!=fHeaders.end())
		{
			XBOX::VString header(it->first.c_str());
			
			header.ToLowerCase();

			if(header=="content-length")
			{	
				fHeaders.erase(it++);
				continue;
			}
			
			if(header=="content-type")
			{
				haveContentType=true;
			}
			
			++it;
		}
		
		if(!haveContentType)
			SetHeader("Content-Type", "text/plain; charset=utf-8");
		
        //curl_easy_setopt(fHandle, CURLOPT_POSTFIELDSIZE, length);
    }
Ejemplo n.º 12
0
/// Sends a string in chunked format if protocol is HTTP/1.1, sends as-is otherwise.
/// \param data The data to send.
/// \param size The size of the data to send.
/// \param conn The connection to use for sending.
void HTTP::Parser::Chunkify(const char * data, unsigned int size, Socket::Connection & conn) {
  static char hexa[] = "0123456789abcdef";
  if (bufferChunks){
    if (size){
      body.append(data, size);
    }else{
      SetHeader("Content-Length", body.length());
      SendResponse("200", "OK", conn);
      Clean();
    }
    return;
  }
  if (sendingChunks) {
    //prepend the chunk size and \r\n
    if (!size){
      conn.SendNow("0\r\n\r\n\r\n", 7);
    }
    size_t offset = 8;
    unsigned int t_size = size;
    char len[] = "\000\000\000\000\000\000\0000\r\n";
    while (t_size && offset < 9){
      len[--offset] = hexa[t_size & 0xf];
      t_size >>= 4;
    }
    conn.SendNow(len+offset, 10-offset);
    //send the chunk itself
    conn.SendNow(data, size);
    //append \r\n
    conn.SendNow("\r\n", 2);
  } else {
Ejemplo n.º 13
0
SipResponse::SipResponse( const int statusCode, const string& reasonPhrase, const SipRequest& request ) throw( SipResponseException )
	: SipMessage( MT_RESPONSE ), m_statusCode( statusCode ), m_reasonPhrase( reasonPhrase )
{ //See RFC 3261, 8.2.6.2
	try
	{
		SetHeader( "via", request.GetHeaderValues( "via" ) );
		SetHeader( "from", request.GetHeaderValues( "from" ) );
		SetHeader( "call-id", request.GetHeaderValues( "call-id" ) );
		SetHeader( "cseq", request.GetHeaderValues( "cseq" ) );
		SetHeader( "to", request.GetHeaderValues( "to" ) );
	}
	catch( SipRequestException&e )
	{
		throw SipResponseException( "Malformed SIP request; cannot form response." );
	}

}
void HttpContext::SetContent(const std::string &content) {
    _content = content;

    int contentLength = _content.size();
    if ( contentLength > 0 ) {
        SetHeader("Content-Length", itos(contentLength));
    }
}
Ejemplo n.º 15
0
void MemoryManager::MarkBlockAsAllocated(char * const ptr)
{
	size_t header = (((GetHeader(ptr) ^ (1 << (4 * sizeof(size_t)-1)))));
	SetHeader(ptr, header);

	size_t footer = (((GetFooter(ptr) ^ (1 << (4 * sizeof(size_t)-1)))));
	SetFooter(ptr, footer);
}
Ejemplo n.º 16
0
/// Sets the neccesary headers to allow Cross Origin Resource Sharing with all domains.
void HTTP::Parser::setCORSHeaders(){
  SetHeader("Access-Control-Allow-Origin", "*");
  SetHeader("Access-Control-Allow-Credentials", "true");
  SetHeader("Access-Control-Expose-Headers", "*");
  SetHeader("Access-Control-Max-Age", "600");
  SetHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD");
  SetHeader("Access-Control-Allow-Headers", "*");
  SetHeader("Access-Control-Request-Method", "GET");
  SetHeader("Access-Control-Request-Headers", "*");  
}
Ejemplo n.º 17
0
KCalls::KCalls(KConnection *newmainwin, QWidget *newframe) : KTabListBox(newframe)
{
	mainwin = newmainwin;
	frame = newframe;
	setNumCols(CALLS_COLS);
	setNumRows(0);

	SetHeader();
}
Ejemplo n.º 18
0
void CMainFrame::HandleHeaderUpdate( const CHeaderManager& manager,const JID& jid )
{
	if(!m_pBuddyList)
		return;
	auto buddy=m_pBuddyList->FindBuddyItem(jid);
	if(!buddy)
		return;
	buddy->SetHeader(manager.GetHeader(jid,buddy->IsOnline()));
}
int HttpResponseX::SendRedirection(const char* url){
    if(m_header_sended){
        return -1;  //  头部已经发送,则报错。
    }
    SetHeader("Location", url);
    Printf("Status: 302 Found\r\n\r\n"
           "<html><head><title>302 Found</title></head><body>302 Found<br><a href=\"%s\">%s</a></body></html>", url, url);
    return 0;
}
Ejemplo n.º 20
0
nsresult
nsHttpHeaderArray::ParseHeaderLine(const char *line,
                                   nsHttpAtom *hdr,
                                   char **val)
{
    //
    // BNF from section 4.2 of RFC 2616:
    //
    //   message-header = field-name ":" [ field-value ]
    //   field-name     = token
    //   field-value    = *( field-content | LWS )
    //   field-content  = <the OCTETs making up the field-value
    //                     and consisting of either *TEXT or combinations
    //                     of token, separators, and quoted-string>
    //
    
    // We skip over mal-formed headers in the hope that we'll still be able to
    // do something useful with the response.

    char *p = (char *) strchr(line, ':');
    if (!p) {
        LOG(("malformed header [%s]: no colon\n", line));
        return NS_OK;
    }

    // make sure we have a valid token for the field-name
    if (!nsHttp::IsValidToken(line, p)) {
        LOG(("malformed header [%s]: field-name not a token\n", line));
        return NS_OK;
    }
    
    *p = 0; // null terminate field-name

    nsHttpAtom atom = nsHttp::ResolveAtom(line);
    if (!atom) {
        LOG(("failed to resolve atom [%s]\n", line));
        return NS_OK;
    }

    // skip over whitespace
    p = net_FindCharNotInSet(++p, HTTP_LWS);

    // trim trailing whitespace - bug 86608
    char *p2 = net_RFindCharNotInSet(p, HTTP_LWS);

    *++p2 = 0; // null terminate header value; if all chars starting at |p|
               // consisted of LWS, then p2 would have pointed at |p-1|, so
               // the prefix increment is always valid.

    // assign return values
    if (hdr) *hdr = atom;
    if (val) *val = p;

    // assign response header
    return SetHeader(atom, nsDependentCString(p, p2 - p), PR_TRUE);
}
Ejemplo n.º 21
0
void HeaderedContentControl::AddLogicalChild(suic::Element* child)
{
    if (child->GetWrapper().Equals(_T("Header")))
    {
        SetHeader(child);
    }
    else
    {
        __super::AddLogicalChild(child);
    }
}
Ejemplo n.º 22
0
/*
	Window生成ルーチン
*/
BOOL THistDlg::Create(HINSTANCE hI)
{
	if (!TDlg::Create(hI)) return	FALSE;

	histListView.AttachWnd(GetDlgItem(HISTORY_LIST));
	histListHeader.AttachWnd((HWND)histListView.SendMessage(LVM_GETHEADER, 0, 0));

	SetFont();
	SetHeader(); // dummy for reflect font
	SetAllData();

	return	TRUE;
}
Ejemplo n.º 23
0
Archivo: OAUTH.cpp Proyecto: tiku/test
bool Oauth::Send(const wchar_t* cmd,const wchar_t* url,PairDataArray content,wstring* res){
	int status;
	PairDataArray pd;

	SetHeader(cmd,url);
	GetData(&pd);
	inet.Request(cmd,url,pd,PairDataArray());
	status=inet.Response(res);
	if(status!=200){
		return false;
	}
	return true;
}
Ejemplo n.º 24
0
void UPhilipsHueBridge::SetLightStateByLightIDRaw(const int32 LightID, const FString StateJson)
{
	if (!Connected)return;
	auto HttpRequest = FHttpModule::Get().CreateRequest();
	{
		FString LightIDStr = FString::FromInt(LightID);
		HttpRequest->OnProcessRequestComplete().BindUObject(this, &UPhilipsHueBridge::HandleLightStateRequestComplete);
		HttpRequest->SetURL(FString(TEXT("http://")) + Configuration.IpAddress + TEXT("/api/") + ConnectedUser + TEXT("/lights/") + LightIDStr + TEXT("/state"));
		HttpRequest->SetHeader("Content-Type", "application/json");
		HttpRequest->SetVerb(TEXT("PUT"));
		HttpRequest->SetContentAsString(StateJson);
		HttpRequest->ProcessRequest();
	}
}
nsresult
nsHttpResponseHead::UpdateHeaders(nsHttpHeaderArray &headers)
{
    LOG(("nsHttpResponseHead::UpdateHeaders [this=%x]\n", this));

    PRUint32 i, count = headers.Count();
    for (i=0; i<count; ++i) {
        nsHttpAtom header;
        const char *val = headers.PeekHeaderAt(i, header);

        if (!val) {
            NS_NOTREACHED("null header value");
            continue;
        }

        // Ignore any hop-by-hop headers...
        if (header == nsHttp::Connection          ||
            header == nsHttp::Proxy_Connection    ||
            header == nsHttp::Keep_Alive          ||
            header == nsHttp::Proxy_Authenticate  ||
            header == nsHttp::Proxy_Authorization || // not a response header!
            header == nsHttp::TE                  ||
            header == nsHttp::Trailer             ||
            header == nsHttp::Transfer_Encoding   ||
            header == nsHttp::Upgrade             ||
        // Ignore any non-modifiable headers...
            header == nsHttp::Content_Location    ||
            header == nsHttp::Content_MD5         ||
            header == nsHttp::ETag                ||
        // Assume Cache-Control: "no-transform"
            header == nsHttp::Content_Encoding    ||
            header == nsHttp::Content_Range       ||
            header == nsHttp::Content_Type        ||
        // Ignore wacky headers too...
            // this one is for MS servers that send "Content-Length: 0"
            // on 304 responses
            header == nsHttp::Content_Length) {
            LOG(("ignoring response header [%s: %s]\n", header.get(), val));
        }
        else {
            LOG(("new response header [%s: %s]\n", header.get(), val));

            // overwrite the current header value with the new value...
            SetHeader(header, nsDependentCString(val));
        }
    }

    return NS_OK;
}
Ejemplo n.º 26
0
		void CustomNetworkReply::SetContent (const QByteArray& content)
		{
			Content_ = content;
			Offset_ = 0;

			open (ReadOnly | Unbuffered);

			SetHeader (QNetworkRequest::ContentLengthHeader, QVariant (Content_.size ()));

			QTimer::singleShot (0,
					this,
					SIGNAL (readyRead ()));
			QTimer::singleShot (0,
					this,
					SIGNAL (finished ()));
		}
Ejemplo n.º 27
0
int Wave::InputWave(const std::string filename) {
    if (filename.compare(filename.size() - 4, 4, ".wav") == 0) {
        ldata.clear();
        rdata.clear();
        monodata.clear();

        wavename = filename;
        WavHdrRead();
        DumpData();
        SetHeader();
        flag = true;
    } else {
        std::cerr << "error .wav" << std::endl;
        return -1;
    }
    return 0;
}
Ejemplo n.º 28
0
void THistDlg::SetAllData()
{
	histListView.DeleteAllItems();
	SetHeader();
	SetTitle();

	if (openedMode) {
		for (HistObj *obj = histHash.LruEnd(); obj; obj = obj->lruPrior) {
			SetData(obj);
		}
	}
	else {
		for (HistObj *obj = histHash.End(); obj; obj = obj->prior) {
			if (!*obj->odate) SetData(obj);
		}
	}
}
Ejemplo n.º 29
0
/*--------------------------------------------------------------------------
 * Stereo to Mono
 */
void Wave::StereoToMono() {
    if (flag == false) {
        std::cerr << "Please Create or Input Wave." << std::endl;
    } else {
        if (channels == 1) {
            std::cout << "モノラルデータです." << std::endl;
        } else {
            monodata.resize(ldata.size());
            std::cout << "Stereo to Monoral." << std::endl;
            for (int i = 0; i < ldata.size(); i++) {
                monodata[i] = (ldata[i] + rdata[i]) / 2;
            }
            channels = 1;
            sizeOfData /= 2;
            ldata.clear();
            rdata.clear();
            SetHeader();
        }
    }
}
Ejemplo n.º 30
0
char * const MemoryManager::CoalesceWithNextBlock(char * const ptr)
{
	if (IsNextBlockFree(ptr) && IsValidAddress(GetNextBlock(ptr)))
	{
		//Remove next block from free blocks
		freeBlocks.remove((Node*)GetNextBlock(ptr));
		
		ForwardIteratationOverFreeBlocks();

		//Update header
		size_t newHeaderData = GetHeader(ptr) + GetHeader(GetNextBlock(ptr));
		SetHeader(ptr, newHeaderData);
		//Update footer
		SetFooter(ptr, newHeaderData);
		return ptr;
	}
	else
	{
		return ptr;
	}
}