// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ SkipPString Static // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ void UStreamBits::SkipPString(LStream &inStream) { unsigned char length; inStream >> length; Skip(inStream,length); }
int TrimCommand :: Execute( ALib::CommandLine & cmd ) { GetSkipOptions( cmd ); if ( cmd.HasFlag( FLAG_TRLEAD ) || cmd.HasFlag( FLAG_TRTRAIL ) ) { mTrimLead = cmd.HasFlag( FLAG_TRLEAD ); mTrimTrail = cmd.HasFlag( FLAG_TRTRAIL ); } else { mTrimLead = mTrimTrail = true; } if ( cmd.HasFlag( FLAG_WIDTH ) ) { GetWidths( cmd.GetValue( FLAG_WIDTH ) ); } ALib::CommaList cl( cmd.GetValue( FLAG_COLS, "" ) ); CommaListToIndex( cl, mFields ); IOManager io( cmd ); CSVRow row; while( io.ReadCSV( row ) ) { if ( Skip( row ) ) { continue; } if ( ! Pass( row ) ) { Trim( row ); } io.WriteRow( row ); } return 0; }
const char *GetNext() { assert(!IsEmpty()); const char *p = args.front(); Skip(); return p; }
void CInArchive::ReadDirRecord2(CDirRecord &r, Byte len) { r.ExtendedAttributeRecordLen = ReadByte(); if (r.ExtendedAttributeRecordLen != 0) throw 1; r.ExtentLocation = ReadUInt32(); r.DataLength = ReadUInt32(); ReadRecordingDateTime(r.DateTime); r.FileFlags = ReadByte(); r.FileUnitSize = ReadByte(); r.InterleaveGapSize = ReadByte(); r.VolSequenceNumber = ReadUInt16(); Byte idLen = ReadByte(); r.FileId.SetCapacity(idLen); ReadBytes((Byte *)r.FileId, idLen); int padSize = 1 - (idLen & 1); // SkipZeros(1 - (idLen & 1)); Skip(1 - (idLen & 1)); // it's bug in some cd's. Must be zeros int curPos = 33 + idLen + padSize; if (curPos > len) throw 1; int rem = len - curPos; r.SystemUse.SetCapacity(rem); ReadBytes((Byte *)r.SystemUse, rem); }
void MP4SoundAtom::Read() { MP4Atom *parent = GetParentAtom(); if (ATOMID(parent->GetType()) != ATOMID("stsd")) { // Quicktime has an interesting thing - they'll put an mp4a atom // which is blank inside a wave atom, which is inside an mp4a atom // we have a mp4a inside an wave inside an mp4a - delete all properties m_pProperties.Delete(8); m_pProperties.Delete(7); m_pProperties.Delete(6); m_pProperties.Delete(5); m_pProperties.Delete(4); m_pProperties.Delete(3); m_pProperties.Delete(2); m_pProperties.Delete(1); m_pProperties.Delete(0); if (ATOMID(GetType()) == ATOMID("alac")) { AddProperty(new MP4BytesProperty("decoderConfig", m_size)); ReadProperties(); } if (m_pChildAtomInfos.Size() > 0) { ReadChildAtoms(); } } else { ReadProperties(0, 3); // read first 3 properties AddProperties(((MP4IntegerProperty *)m_pProperties[2])->GetValue()); ReadProperties(3); // continue if (m_pChildAtomInfos.Size() > 0) { ReadChildAtoms(); } } Skip(); }
//------------------------------------------------------------ // Helper function to see if the next/prev node should be skipped void nsFilteredContentIterator::CheckAdvNode(nsIDOMNode* aNode, bool& aDidSkip, eDirectionType aDir) { aDidSkip = false; mIsOutOfRange = false; if (aNode && mFilter) { nsCOMPtr<nsIDOMNode> currentNode = aNode; bool skipIt; while (1) { nsresult rv = mFilter->Skip(aNode, &skipIt); if (NS_SUCCEEDED(rv) && skipIt) { aDidSkip = true; // Get the next/prev node and then // see if we should skip that nsCOMPtr<nsIDOMNode> advNode; rv = AdvanceNode(aNode, *getter_AddRefs(advNode), aDir); if (NS_SUCCEEDED(rv) && advNode) { aNode = advNode; } else { return; // fell out of range } } else { if (aNode != currentNode) { nsCOMPtr<nsIContent> content(do_QueryInterface(aNode)); mCurrentIterator->PositionAt(content); } return; // found something } } } }
size_t ByteQueue::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) { if (blocking) { lword bytesLeft = transferBytes; for (ByteQueueNode *current=m_head; bytesLeft && current; current=current->next) bytesLeft -= current->TransferTo(target, bytesLeft, channel); CleanupUsedNodes(); size_t len = (size_t)STDMIN(bytesLeft, (lword)m_lazyLength); if (len) { if (m_lazyStringModifiable) target.ChannelPutModifiable(channel, m_lazyString, len); else target.ChannelPut(channel, m_lazyString, len); m_lazyString += len; m_lazyLength -= len; bytesLeft -= len; } transferBytes -= bytesLeft; return 0; } else { Walker walker(*this); size_t blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking); Skip(transferBytes); return blockedBytes; } }
const char* CSvnProp::ReadSingle(const char* data, const char* dataEnd) { //name std::string name; for(;data != dataEnd && !IsSkip(*data); ++data) name += *data; Skip(&data, dataEnd); std::string value; for(;data != dataEnd && !IsEnd(*data); ++data) value += *data; Skip(&data, dataEnd); m_NameVal[name].swap(value); return data; }
int TemplateCommand :: Execute( ALib::CommandLine & cmd ) { GetSkipOptions( cmd ); ReadTemplate( cmd ); if ( cmd.HasFlag( FLAG_FNAMES ) ) { mFileTemplate = cmd.GetValue( FLAG_FNAMES ); } IOManager io( cmd ); CSVRow row; while( io.ReadCSV( row ) ) { if ( Skip( row ) ) { continue; } if ( mFileTemplate.empty() ) { io.Out() << ReplaceColumns( mTemplate, row ); } else { FileOut( row ); } } return 0; }
void LWOReader::ReadPTAG( UInt32 pChunkSize ) { UInt32 dataRead = 0; LWIndex index; LWIndex val; UInt32 tagType; dataRead += ReadID4( tagType ); if( tagType != ID_SURF && tagType != ID_PART && tagType != ID_SMGP ) { Skip( pChunkSize - dataRead ); return; } while( dataRead < pChunkSize ) { dataRead += ReadVX( index ); dataRead += ReadVX( val ); switch( tagType ) { case ID_SURF: GetCurrentLayer()->mPolygonList.mPolygons[index]->mSurfaceIndex = val; break; case ID_PART: GetCurrentLayer()->mPolygonList.mPolygons[index]->mPartIndex = val; break; case ID_SMGP: GetCurrentLayer()->mPolygonList.mPolygons[index]->mSmoothingGroupIndex = val; break; } } }
// Parse a 'TILE' chunk and any image bearing chunks that immediately follow. // 'tile_chunk_size' is the previously validated, padded chunk size. static ParseStatus ParseTile(WebPDemuxer* const dmux, uint32_t tile_chunk_size) { const int has_tiles = !!(dmux->feature_flags_ & TILE_FLAG); const uint32_t min_size = tile_chunk_size + CHUNK_HEADER_SIZE; int added_tile = 0; MemBuffer* const mem = &dmux->mem_; Frame* frame; ParseStatus status = NewFrame(mem, min_size, TILE_CHUNK_SIZE, tile_chunk_size, &frame); if (status != PARSE_OK) return status; frame->is_tile_ = 1; frame->x_offset_ = 2 * GetLE24s(mem); frame->y_offset_ = 2 * GetLE24s(mem); Skip(mem, tile_chunk_size - TILE_CHUNK_SIZE); // skip any trailing data. // Store a (potentially partial) tile only if the tile flag is set // and the tile contains some data. status = StoreFrame(dmux->num_frames_, mem, frame); if (status != PARSE_ERROR && has_tiles && frame->frame_num_ > 0) { // Note num_frames_ is incremented only when all tiles have been consumed. added_tile = AddFrame(dmux, frame); if (!added_tile) status = PARSE_ERROR; } if (!added_tile) free(frame); return status; }
int Buffer::SkipLineCRLF() { int after_next_line = OffsetToAfterNextCRLF(); if (after_next_line < 0) return after_next_line; else { Skip(after_next_line); return after_next_line - 2; } }
void CSVLine::Read(char *dest, size_t size) { const char *src = data; size_t length = Skip(); if (length >= size) length = size - 1; *std::copy_n(src, length, dest) = '\0'; }
bool Compare(BufferedLineReader &other) { if (Peek(0) != other.Peek(0)) { return false; } Skip(1); other.Skip(1); return true; }
//////////////////////////////////////////////////////////////////////////////// // LexString: Lex a quoted string // Return value: // RegularExprToken::Type The type of the matched token. // // Note: May throw an integer to indicate error. //////////////////////////////////////////////////////////////////////////////// RegularExprToken::Type RegularExprLexerChar::LexString() { if (current != '"') { // Will be caught by NextToken() throw 1; } // Skip opening " Skip(); //The next character can't be a ". They need to escape it with a '\' if that's //what they intend if (current == '"') { throw 1; } while (current != '"' && current > 0) { // Check for the escaped quote and backslash here if (current == '\\') { // Skip the backslash Skip(); if (current != '"' && current != '\\') { // whoops, it wasn't an escaped character after all. Put the backslash back in! tokenText += '\\'; } else { // It is an escaped character. Consume it here so the following code doesn't end // the token with no text Consume(); } } else { // Consume our one character Consume(); } } // Must end with a ' if (current != '"') { throw 1; } // Skip closing " Skip(); return RegularExprToken::String; }
void LWOReader::ReadHEAD( LWSurfaceBlock* pSurfaceBlock, UInt32 pChunkSize ) { UInt32 dataRead = 0; UInt16 subChunkSize; UInt32 subChunkTag; UInt32 bytesHold; LWIndex env; dataRead += ReadS0( pSurfaceBlock->mOrdinalString ); while( dataRead < pChunkSize ) { subChunkTag = ReadSubChunk(subChunkSize,2); dataRead += sizeof(subChunkTag); // Subchunk tag. dataRead += sizeof(subChunkSize); // Subchunk size. bytesHold = dataRead; switch( subChunkTag ) { case ID_CHAN: dataRead += ReadID4( pSurfaceBlock->mTextureChannel ); break; case ID_ENAB: dataRead += ReadU2( pSurfaceBlock->mEnableState ); break; case ID_OPAC: dataRead += ReadU2( pSurfaceBlock->mOpacityType ); dataRead += ReadFP4( pSurfaceBlock->mOpacity ); dataRead += ReadVX( env ); break; default: dataRead += Skip( subChunkSize ); break; } // Make sure we've read all subchunk bytes (given by the size). if( (subChunkSize - dataRead + bytesHold) > 0 ) dataRead += Skip( subChunkSize - dataRead + bytesHold ); } }
void OsmAnd::ObfPoiSectionReader_P::readAmenities( const std::unique_ptr<ObfReader_P>& reader, const std::shared_ptr<const ObfPoiSectionInfo>& section, QSet<uint32_t>* desiredCategories, QList< std::shared_ptr<const Model::Amenity> >* amenitiesOut, const ZoomLevel& zoom, uint32_t zoomDepth, const AreaI* bbox31, std::function<bool (const std::shared_ptr<const Model::Amenity>&)> visitor, IQueryController* controller) { auto cis = reader->_codedInputStream.get(); QList< std::shared_ptr<Tile> > tiles; for(;;) { auto tag = cis->ReadTag(); switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: return; case OBF::OsmAndPoiIndex::kBoxesFieldNumber: { auto length = ObfReaderUtilities::readBigEndianInt(cis); auto oldLimit = cis->PushLimit(length); readTile(reader, section, tiles, nullptr, desiredCategories, zoom, zoomDepth, bbox31, controller, nullptr); cis->PopLimit(oldLimit); if(controller && controller->isAborted()) return; } break; case OBF::OsmAndPoiIndex::kPoiDataFieldNumber: { // Sort tiles byte data offset, to all cache-friendly with I/O system qSort(tiles.begin(), tiles.end(), [](const std::shared_ptr<Tile>& l, const std::shared_ptr<Tile>& r) -> bool { return l->_hash < r->_hash; }); for(auto itTile = tiles.begin(); itTile != tiles.end(); ++itTile) { const auto& tile = *itTile; cis->Seek(section->_offset + tile->_offset); auto length = ObfReaderUtilities::readBigEndianInt(cis); auto oldLimit = cis->PushLimit(length); readAmenitiesFromTile(reader, section, tile.get(), desiredCategories, amenitiesOut, zoom, zoomDepth, bbox31, visitor, controller, nullptr); cis->PopLimit(oldLimit); if(controller && controller->isAborted()) return; } cis->Skip(cis->BytesUntilLimit()); } return; default: ObfReaderUtilities::skipUnknownField(cis, tag); break; } } }
bool ParseConversation() { const PClass *type = NULL; int dlgid = -1; unsigned int startpos = StrifeDialogues.Size(); while (!sc.CheckToken('}')) { bool block = false; FName key = ParseKey(true, &block); if (!block) { switch(key) { case NAME_Actor: type = CheckActorType(key); if (namespace_bits == St) { dlgid = CheckInt(key); } break; case NAME_Id: if (namespace_bits == Zd) { dlgid = CheckInt(key); } break; } } else { switch(key) { case NAME_Page: if (!ParsePage()) return false; break; default: sc.UnGet(); Skip(); } } } if (type == NULL && dlgid == 0) { sc.ScriptMessage("No valid actor type defined in conversation."); return false; } SetConversation(dlgid, type, startpos); for(;startpos < StrifeDialogues.Size(); startpos++) { StrifeDialogues[startpos]->SpeakerType = type; } return true; }
void CSVLine::Read(char *dest, size_t size) { const char *src = data; size_t length = Skip(); if (length >= size) length = size - 1; strncpy(dest, src, length); dest[length] = '\0'; }
int Buffer::TakeLineCRLF(std::string *dest) { int after_next_line = OffsetToAfterNextCRLF(); if (after_next_line < 0) return after_next_line; else { Take(after_next_line - 2, dest); Skip(2); // Skip the CRLF return after_next_line - 2; } }
// ----------------------------------------------------------------------- // // // ROUTINE: CLTDialogueWnd::OnRButtonDown // // PURPOSE: Right mouse button handler // // ----------------------------------------------------------------------- // BOOL CLTDialogueWnd::OnRButtonDown(int xPos, int yPos) { // If the window isn't enabled, just return if(!m_bEnabled || !m_bVisible) return FALSE; if (!m_bDecisions) Skip(); return TRUE; }
void BufferedTransformation::SkipAll() { if (AttachedTransformation()) AttachedTransformation()->SkipAll(); else { while (SkipMessages()) {} while (Skip()) {} } }
static BOOL ParseIT8(LPIT8 it8) { InSymbol(it8); if (it8->sy == SIDENT) { strncpy(it8->SheetType, it8->id, MAXSTR-1); InSymbol(it8); /* if (!AddAvailableProperty(it8, it8 -> id)) return false; */ /* cmsxIT8SetProperty((LCMSHANDLE) it8, it8->id, NULL); */ } Skip(it8, SEOLN); while (it8-> sy != SEOF && it8-> sy != SSYNERROR) { switch (it8 -> sy) { case SBEGIN_DATA_FORMAT: if (!DataFormatSection(it8)) return false; break; case SBEGIN_DATA: if (!DataSection(it8)) return false; break; case SEOLN: Skip(it8, SEOLN); break; default: if (!HeaderSection(it8)) return false; } } return true; }
bool Parse(int lumpnum, FileReader *lump, int lumplen) { char *buffer = new char[lumplen]; lump->Read(buffer, lumplen); sc.OpenMem(Wads.GetLumpFullName(lumpnum), buffer, lumplen); delete [] buffer; sc.SetCMode(true); // Namespace must be the first field because everything else depends on it. if (sc.CheckString("namespace")) { sc.MustGetToken('='); sc.MustGetToken(TK_StringConst); namespc = sc.String; switch(namespc) { case NAME_ZDoom: namespace_bits = Zd; break; case NAME_Strife: namespace_bits = St; break; default: sc.ScriptMessage("Unknown namespace %s. Ignoring dialogue lump.\n", sc.String); return false; } sc.MustGetToken(';'); } else { sc.ScriptMessage("Map does not define a namespace.\n"); return false; } while (sc.GetString()) { if (sc.Compare("conversation")) { sc.MustGetToken('{'); if (!ParseConversation()) return false; } else if (sc.Compare("include")) { sc.MustGetToken('='); sc.MustGetToken(TK_StringConst); LoadScriptFile(sc.String, true); sc.MustGetToken(';'); } else { Skip(); } } return true; }
void Query31(uint cwIn, uchar cbOut) { uchar bCrc = MakeCrc8Bit31OutBuff(1, cbOut-2); InitPush(0); Skip(cbOut-1); PushChar(bCrc); Query(cwIn,cbOut,1); }
void Control::Grab() { Event e; do { Read(e); e.target->Handle(e); if (e.target == this && e.eventType == LeaveEvent) { Skip(); break; } } while (state_->Active()); }
// Skip To Limit // Skip to the end of the current limit. // This happens when we bag the rest of the current token bool trpgReadBuffer::SkipToLimit() { int len=0; if (limits.size() != 0) len = limits[limits.size()-1]; if (len > 0) return Skip(len); return true; }
void BaseUnitTest() { bool baseOk = false; SetConsoleTitle("Unit-Test: base.c/ base.h"); printf("\n\t\t\tTEST BEGINN"); baseOk = BaseInit("G:\\Coding\\buildcfg\\unittest\\base"); if(!baseOk){ printf("\aDatei konnte nicht geoeffnnet werden\n\n"); return; } printf("Test der Zeichen-Funktonen:\n\n"); printf("\t Erstes Zeichen, mit Cur(): %c, Pos: %ld [ \'a\' erwartet, Pos: 0 (\'a\') ]\n", Cur(), ftell( base->datei ) ); printf("\t Zweites Zeichen mit Next(): %c, Pos: %ld[ \'z\' erwartet, Pos: 0 (\'a\') ]\n", Next(), ftell( base->datei ) ); printf("\t Zweites Zeichen mit Fwd(): %c, Pos: %ld [\'z\' erwartet, Pos: 0 (\'z\') ]\n", Fwd(), ftell( base->datei) ); printf("\t Erstes Zeichen mit Last(): %c, Pos: %ld [\'a\' erwartet, Pos: 1 (\'z\') ]\n", Last(), ftell( base->datei) ); printf("\t Erstes Zeichen mit Rwd(): %c, Pos: %ld [\'a\' erwartet, Pos: 1 (\'a\') ]\n", Rwd(), ftell( base->datei ) ); printf("\t Erstes Zeichen mit Cur(): %c, Pos: %ld [\'a\' erwartet, Pos: 0 (\'a\') ]\n", Cur(), ftell( base->datei ) ); printf(" Skip(): "); printf("\n\tIn Zeile 2 wechseln.\n\n"); while( Cur() != '\n'){ Fwd(); } Fwd(); printf("\n\tSchleife beendet!"); Skip(); printf("\n\n\t naechtes Zeichen: %c, Zeile (F erwartet, in Zeile 13 oder so)\n\n", Cur()); printf(" GetLineCount():\n\n"); printf("\n\n\t\t200 Zeichen weiter...\n\n"); for(int i = 0; i < 200; i++) Fwd(); printf("\t\tDatei-Position vorher: %ld\n\n", ftell( base->datei )); printf("\t\tDas sollte Zeile: %d sein.\n\n", GetLineCount()); printf("\t\tUnd das die Position nachher: %ld", ftell( base->datei )); printf("\nBaseClose():\n\n"); BaseClose(); if( base ){ printf("\t\nBaseClose fehlgeschlagen!\n"); return; }else{ printf("\t\nBaseClose erfolgreich!\n"); } printf("\n\n\t\t\tTEST ABGESCHLOSSEN\n\n"); }
PictSelection::PictSelection (Graphic* gs) : (gs) { valid = true; } // PictSelection knows it's the outermost PictSelection because it was // called with a FILE* pointer, so it must read a version number, skip // over its name, read its graphic state and children, and scale // itself back to screen coordinates when it's finished. PictSelection::PictSelection (FILE* stream, State* state) : (nil) { int fd = fileno(stream); istream from(fd); ReadVersion(from); ReadGridSpacing(from); if (versionnumber < 3) { Skip(from); } ReadPictGS(from, state); ReadChildren(from, state); ScaleToScreenCoords(); valid = from.good(); } // Copy returns a copy of the PictSelection. Graphic* PictSelection::Copy () { Selection* copy = new PictSelection(this); for (First(); !AtEnd(); Next()) { copy->Append(GetCurrent()->Copy()); } return copy; } // HasChildren returns true so Idraw can ungroup this Picture. boolean PictSelection::HasChildren () { return Picture::HasChildren(); } // Propagate must preserve the PictSelection's transformation matrix // if it has any. void PictSelection::Propagate () { Transformer* original = GetTransformer(); if (original != nil) { original->Reference(); Selection::Propagate(); SetTransformer(original); delete original; } else { Selection::Propagate(); } }
static BOOL DataFormatSection(LPIT8 it8) { int iField = 0; BOOL Ignoring = false; InSymbol(it8); /* Eats "BEGIN_DATA_FORMAT" */ CheckEOLN(it8); while (it8->sy != SEND_DATA_FORMAT && it8->sy != SEOLN && it8->sy != SEOF && it8->sy != SSYNERROR) { if (it8->sy != SIDENT) { cmsSignalError(LCMS_ERRC_ABORTED, "Sample type expected"); it8->sy = SSYNERROR; return false; } if (!Ignoring && iField > it8->nSamples) { cmsSignalError(LCMS_ERRC_WARNING, "More than NUMBER_OF_FIELDS fields. Extra is ignored\n"); Ignoring = true; } else { if (!SetDataFormat(it8, iField, it8->id)) return false; iField++; } InSymbol(it8); Skip(it8, SEOLN); } Skip(it8, SEOLN); Skip(it8, SEND_DATA_FORMAT); Skip(it8, SEOLN); return true; }