void wxStreamBuffer::PutChar(char c) { wxOutputStream *outStream = GetOutputStream(); wxCHECK_RET( outStream, _T("should have a stream in wxStreamBuffer") ); // if we don't have buffer at all, just forward this call to the stream, if ( !HasBuffer() ) { outStream->OnSysWrite(&c, sizeof(c)); } else { // otherwise check we have enough space left if ( !GetDataLeft() && !FlushBuffer() ) { // we don't SetError(wxSTREAM_WRITE_ERROR); } else { PutToBuffer(&c, sizeof(c)); m_stream->m_lastcount = 1; } } }
void PushBuffer(WCHAR c) { if (shifted && c >= FIRST_G1 && c <= LAST_G1) c = G1[c - FIRST_G1]; ChBuffer[nCharInBuffer] = c; if (++nCharInBuffer == BUFFER_SIZE) FlushBuffer(); }
NS_IMETHODIMP nsEncoderSupport::Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength, char * aDest, PRInt32 * aDestLength) { // we do all operations using pointers internally const PRUnichar * src = aSrc; const PRUnichar * srcEnd = aSrc + *aSrcLength; char * dest = aDest; char * destEnd = aDest + *aDestLength; PRInt32 bcr, bcw; // byte counts for read & write; nsresult res; res = FlushBuffer(&dest, destEnd); if (res == NS_OK_UENC_MOREOUTPUT) goto final; bcr = srcEnd - src; bcw = destEnd - dest; res = ConvertNoBuff(src, &bcr, dest, &bcw); src += bcr; dest += bcw; if ((res == NS_OK_UENC_MOREOUTPUT) && (dest < destEnd)) { // convert exactly one character into the internal buffer // at this point, there should be at least a char in the input for (;;) { bcr = 1; bcw = mBufferCapacity; res = ConvertNoBuff(src, &bcr, mBuffer, &bcw); if (res == NS_OK_UENC_MOREOUTPUT) { delete [] mBuffer; mBufferCapacity *= 2; mBuffer = new char [mBufferCapacity]; } else { src += bcr; mBufferStart = mBufferEnd = mBuffer; mBufferEnd += bcw; break; } } res = FlushBuffer(&dest, destEnd); } final:
void BufferedEmailParser::End() { m_endOfStream = true; if (!m_paused) { FlushBuffer(); } }
void ImmutableIndexWriter::Add(Buffer key, Buffer value) { ASSERT_TRUE(key.isValidData() && !key.isEmpty()); ASSERT_TRUE(value.isValidData()); record_buffer.push_back(std::pair<Buffer,Buffer>(key,value)); data_in_buffer++; if(data_in_buffer >= chunk_size) FlushBuffer(); }
// Invoked before starting printing GHCi output for a command VOID RtfWindowStartNextOutput() { RtfWindowPutS(TEXT("\n")); FlushBuffer(TRUE);; BufFormat = DefFormat; NowFormat = DefFormat; BackSpaces = 0; StartOfOutput = RtfWindowTextLength(); }
// Destructor BufferedFile::~BufferedFile() { // Flush in case there's data if (pFile) FlushBuffer(); // Get rid of buffer if (pBuffer) OVR_FREE(pBuffer); }
void CObjectOStream::DefaultFlush(void) { if ( GetFlags() & fFlagNoAutoFlush ) { FlushBuffer(); } else { Flush(); } }
void BFTimeCtrl::TextCtrl::ApplyIncrement (bool bPositiv) { UpdatePosition(); SelectPart(); UpdateBuffer(); Increment(bPositiv); FlushBuffer(); SelectPart(); }
void CFileStream::Close(void) { if (m_hFile != INVALID_HANDLE_VALUE) { FlushBuffer(); CloseHandle(m_hFile); ResetFile(GetLastError()); } }
void tPiqueteC_Timer() { bool NuevaA; /* ' Dim NuevoL As Boolean */ int GI; int i; for (i = (1); i <= (LastUser); i++) { if (UserList[i].flags.UserLogged) { if (MapData[UserList[i].Pos.Map][UserList[i].Pos.X][UserList[i].Pos.Y].trigger == eTrigger_ANTIPIQUETE) { if (UserList[i].flags.Muerto == 0) { UserList[i].Counters.PiqueteC = UserList[i].Counters.PiqueteC + 1; WriteConsoleMsg(i, "¡¡¡Estás obstruyendo la vía pública, muévete o serás encarcelado!!!", FontTypeNames_FONTTYPE_INFO); if (UserList[i].Counters.PiqueteC > 23) { UserList[i].Counters.PiqueteC = 0; Encarcelar(i, TIEMPO_CARCEL_PIQUETE); } } else { UserList[i].Counters.PiqueteC = 0; } } else { UserList[i].Counters.PiqueteC = 0; } /* 'ustedes se preguntaran que hace esto aca? */ /* 'bueno la respuesta es simple: el codigo de AO es una mierda y encontrar */ /* 'todos los puntos en los cuales la alineacion puede cambiar es un dolor de */ /* 'huevos, asi que lo controlo aca, cada 6 segundos, lo cual es razonable */ GI = UserList[i].GuildIndex; if (GI > 0) { NuevaA = false; /* ' NuevoL = False */ if (!m_ValidarPermanencia(i, true, NuevaA)) { WriteConsoleMsg(i, "Has sido expulsado del clan. ¡El clan ha sumado un punto de antifacción!", FontTypeNames_FONTTYPE_GUILD); } if (NuevaA) { SendData(SendTarget_ToGuildMembers, GI, dakara::protocol::server::BuildConsoleMsg( "¡El clan ha pasado a tener alineación " + GuildAlignment(GI) + "!", FontTypeNames_FONTTYPE_GUILD)); LogClanes("¡El clan cambio de alineación!"); } /* ' If NuevoL Then */ /* ' Call SendData(SendTarget.ToGuildMembers, GI, PrepareMessageConsoleMsg("¡El clan tiene un nuevo líder!", FontTypeNames.FONTTYPE_GUILD)) */ /* ' Call LogClanes("¡El clan tiene nuevo lider!") */ /* ' End If */ } FlushBuffer(i); } } }
void c4_SaveContext::StoreValue(t4_i32 v_) { if (_walk == 0) return ; if (_curr + 10 >= _limit) FlushBuffer(); d4_assert(_curr + 10 < _limit); c4_Column::PushValue(_curr, v_); }
void CConsole::SetBuffer(const wchar_t* szMessage) { int oldBufferPos = m_iBufferPos; // remember since FlushBuffer will set it to 0 FlushBuffer(); wcsncpy(m_szBuffer, szMessage, CONSOLE_BUFFER_SIZE); m_iBufferLength = (int)wcslen(m_szBuffer); m_iBufferPos = std::min(oldBufferPos, m_iBufferLength); }
/** * @brief close one logging session * * Writes the buffered data to file after filtering it through addr2line. */ void CLogger::CloseSession() { boost::mutex::scoped_lock scoped_lock(logmutex); if (logfile || !buffer.empty()) { FlushBuffer(); fclose(logfile); logfile = NULL; } }
/** * @param nBufferSize - buffer size. */ void CFileStream::SetBufferSize(int nBufferSize) { if (m_nBufferSize != nBufferSize) { if (! FlushBuffer()) return; delete[] m_pBuffer; InitBuffer(nBufferSize); } }
void CHTRichEditCtrl::Add(LPCTSTR pszMsg, int iLen) { if (m_hWnd == NULL){ CString strLine(pszMsg); m_astrBuff.Add(strLine); } else{ FlushBuffer(); AddLine(pszMsg, iLen); } }
void BufferedEmailParser::Unpause() { if (m_paused) { m_paused = false; FlushBuffer(); if (!m_paused) { m_readySignal.call(); } } }
static PGPError BufferSizeAdvise(PGPPipeline *myself, unsigned long size) { AddHdrContext *context; PGPError error; int i; pgpAssert(myself); pgpAssert(myself->magic == ADDHEADERMAGIC); context = (AddHdrContext *)myself->priv; pgpAssert(context); pgpAssert(context->tail); pgpAssert(context->buffer); /* Do not pass non-zero sizeAdvise -- I can't do that! */ if (size || context->scope_depth) return( kPGPError_NoErr ); /* Okay, we're at end of input. */ if (context->buflen) { /* We have a bug when file length is zero; we get here without having * flushed the header. We can't easily distinguish between a zero * length file and the EOF sizeadvise, but we don't need to. */ error = FlushHeader(context); if (error) return error; if (context->dowrite) { error = FlushBuffer(context); } else if (context->midflush) { error = ForceFlush(context); } else { i = context->buflen; if (PKTLEN_ONE_BYTE(i)) { context->bufptr--; context->buflen++; context->bufptr[0] = PKTLEN_1BYTE(i); } else { context->bufptr -= 2; context->buflen += 2; context->bufptr[0] = PKTLEN_BYTE0(i); context->bufptr[1] = PKTLEN_BYTE1(i); } context->midflush = context->buflen; error = ForceFlush(context); } if (error) return error; } return context->tail->sizeAdvise(context->tail, 0); }
void CHTRichEditCtrl::AddEntry(LPCTSTR pszMsg) { CString strLine(pszMsg); strLine += _T("\n"); if (m_hWnd == NULL){ m_astrBuff.Add(strLine); } else{ FlushBuffer(); AddLine(strLine, strLine.GetLength()); } }
void ecRunTestsDialog::OnIdle(wxIdleEvent& event) { FlushBuffer(); if (m_testsAreComplete) { m_testsAreComplete = FALSE; SubmitTests(); } event.Skip(); }
void FlushStdUnit( void ) { //====================== ftnfile *fcb; for( fcb = Files; fcb != NULL; fcb = fcb->link ) { if( fcb->fileptr == FStdOut ) { FlushBuffer( FStdOut ); break; } } }
void IO_ProfileSimResults::WriteOneCase(const ProfileSimCaseResults& caseRes, int& nextRec) { BufferReset(nextRec); WriteString(caseRes.caseID, ProfileSimCaseResults::caseIDLen); WriteDouble(caseRes.staticPressure); WriteBool(caseRes.caseDataIsExtended); WriteInt(caseRes.caseValues.Size()); for (int i = 0; i < caseRes.caseValues.Size(); i++) WriteDouble(caseRes.caseValues[i]); if (!caseRes.caseDataIsExtended) { const DC_GridData& currGrid = caseRes.caseData; WriteString(currGrid.gridID, DC_GridData::gridIDLen); WriteString(currGrid.xData.dataID, DC_DataCoord::dataIDLen); WriteString(currGrid.yData.dataID, DC_DataCoord::dataIDLen); WriteBool(currGrid.xData.dataIsLog); WriteBool(currGrid.yData.dataIsLog); WriteInt(currGrid.xData.Size()); WriteInt(currGrid.yData.Size()); WriteDoubleArray(currGrid.xData); WriteDoubleArray(currGrid.yData); for (int i = 0; i < currGrid.Size(); i++) WriteDouble(currGrid[i]); } else { const ExtendedProfile& currPro = caseRes.extendedCaseData; WriteInt(currPro.ntotalVert); WriteInt(currPro.nradial); WriteInt(currPro.nconstantVert); WriteInt(currPro.nvariableVert); // WriteDouble(currPro.constantVertThick); // v1 WriteDoubleArray(currPro.constantVertZPos); WriteDoubleArray(currPro.nodeRadii); WriteInt(currPro.Size()); for (int i = 0; i < currPro.Size(); i++) { const ExtendedProfileTimeData& currSing = currPro[i]; WriteDouble(currSing.profileTime); if (currPro.nvariableVert > 0) WriteDoubleArray(currSing.waterTablePos); WriteDoubleMatrix(currSing.nodalPressures); } } FlushBuffer(nextRec); }
void Player::Update() { m_inventory->SendUpdate( shared_from_this() ); FlushBuffer(); HandleSocketData(); ObjectPtr agent( m_agent.lock() ); if( !agent ) { LogConsole( "Player agent deleted, deleting player." ); Delete(); return; } }
static void DoReplace( void ) /***************************/ // this supports concatenated object decks and libraries (PageLen != 0) { FlushBuffer(); if( PageLen != 0 ) { // NYI - spawning WLIB every time is close( OutFile ); // rather slow. Replace this somehow?? OutFile = NOFILE; if( spawnlp( P_WAIT, WLIB_EXE, WLIB_EXE, TEMP_LIB_NAME, "-b", "+" TEMP_OBJ_NAME, NULL ) != 0 ) { Error( "problem with temporary library" ); } QRemove( TEMP_OBJ_NAME ); } }
bool BufferedEmailParser::FeedChar(char c) { m_buffer.push_back(c); if (!m_isMimeStream) { if (!m_paused && m_buffer.size() >= 4096) { FlushBuffer(); } } else { if (!m_paused) { if (c == '\n' || m_seenCR) { // complete line available FlushBuffer(); } else if (c == '\r') { m_seenCR = true; // might be \r or \r\n } m_seenCR = false; } } return !m_paused; }
UInt32 Write(const Byte* to,UInt32 s) { UInt32 rdd = 0; while (s) { if (bufSize==size) FlushBuffer(); UInt32 cpy = size - bufSize; if (cpy>s) cpy=s; if (cpy) ::memcpy(buffer+bufSize,to+rdd,cpy); s-=cpy; bufSize+=cpy; rdd+=cpy; } return rdd; }
bool BinaryOutFile::Write(uint8_t *data, size_t size) { bool rval = true; uint32_t bytes_left_in_buffer = OUT_FILE_BUFFER_SIZE - mPosition; if (size > bytes_left_in_buffer) { // First, writes the buffer to file FlushBuffer(); // Write direct to file mOS.write((char *)data, size); } else { std::memcpy(mData+mPosition, data, size); mPosition += size; if (mPosition == mBufferSize) { FlushBuffer(); } } return rval; }
void CallUserAttention() { /* '************************************************* */ /* 'Author: Unknown */ /* 'Last modified: 03/10/2010 */ /* 'Makes noise and FX to call the user's attention. */ /* '03/10/2010: ZaMa - Adaptado para que funcione mas de un centinela en paralelo. */ /* '************************************************* */ /* 'Esta el sistema habilitado? */ if (!centinelaActivado) { return; } int index; int UserIndex; int TActual; TActual = (vb6::GetTickCount()); /* ' Chequea todos los centinelas */ for (index = (1); index <= (NRO_CENTINELA); index++) { /* ' Centinela activo? */ if (Centinela[index].Activo) { UserIndex = Centinela[index].RevisandoUserIndex; /* ' Esta revisando un usuario? */ if (UserIndex != 0) { if (getInterval(TActual, Centinela[index].SpawnTime) >= 5000) { if (!UserList[UserIndex].flags.CentinelaOK) { WritePlayWave(UserIndex, SND_WARP, Npclist[Centinela[index].NpcIndex].Pos.X, Npclist[Centinela[index].NpcIndex].Pos.Y); WriteCreateFX(UserIndex, Npclist[Centinela[index].NpcIndex].Char.CharIndex, FXIDs_FXWARP, 0); /* 'Resend the key */ CentinelaSendClave(UserIndex, index); FlushBuffer(UserIndex); } } } } } }
VOID WinGHCiHyperlink(LPCTSTR msg) { CHARFORMAT2 cf2; FlushBuffer(TRUE); cf2.cbSize = sizeof(cf2); cf2.dwMask = CFM_LINK; cf2.dwEffects = CFE_LINK; SendMessage(hWndRtf, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf2); SendMessage(hWndRtf, EM_REPLACESEL, FALSE, (LPARAM) msg); StartOfInput += StringLen(msg); cf2.dwEffects = 0; SendMessage(hWndRtf, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf2); }
void CHTRichEditCtrl::AddTyped(LPCTSTR pszMsg, int iLen, UINT eMsgType) { if (m_hWnd == NULL) { CString strLine; strLine = (TCHAR)(eMsgType & LOGMSGTYPEMASK); strLine += pszMsg; m_astrBuff.Add(strLine); } else { FlushBuffer(); AddLine(pszMsg, iLen, false, GetLogLineColor(eMsgType & LOGMSGTYPEMASK)); } }