bool ArgumentDecoder::alignBufferPosition(unsigned alignment, size_t size) { uint8_t* buffer = roundUpToAlignment(m_bufferPos, alignment); if (static_cast<size_t>(m_bufferEnd - buffer) < size) { // We've walked off the end of this buffer. markInvalid(); return false; } m_bufferPos = buffer; return true; }
bool ArgumentDecoder::alignBufferPosition(unsigned alignment, size_t size) { uint8_t* alignedPosition = roundUpToAlignment(m_bufferPos, alignment); if (!alignedBufferIsLargeEnoughToContain(alignedPosition, m_bufferEnd, size)) { // We've walked off the end of this buffer. markInvalid(); return false; } m_bufferPos = alignedPosition; return true; }
void VolumeGLProcessor::inportChanged() { markInvalid(); afterInportChanged(); }
void testDirectoryRemove2() { root->removeNode("bar"); markBroken("/bar"); markInvalid("/"); }
void testDirectoryRemove() { root->removeNode("foo"); markBroken("/foo"); markInvalid("/"); }
void testDirectoryCreate2() { root->createNode("bar", true); markInvalid("/"); }
void DateTimeEditor::validate() { for (GroupInfo& g : m_groups) { g.invalid = false; } int hours = getNumber(HOUR); int minutes = getNumber(MINUTE); int seconds = getNumber(SECOND); if (hours < 0 || hours > 23) { hours = -1; markInvalid(HOUR); } if (minutes < 0 || minutes > 59) { minutes = -1; markInvalid(MINUTE); } if (seconds < 0 || seconds > 59) { seconds = -1; markInvalid(SECOND); } int years = getNumber(YEAR); int months = getNumber(MONTH); int days = getNumber(DAY); if (years < 0 || years == 0) { years = -1; markInvalid(YEAR); } if (months <= 0 || months > 12) { months = -1; markInvalid(MONTH); } if (days <= 0 || days > 31 ) { days = -1; markInvalid(DAY); } if (months != -1 && days != -1) { if ((months == 2) && days > 29) { days = -1; months = -1; } else if ((months == 4 || months == 6 || months == 9 || months == 11) && days > 30) { days = -1; months = -1; } if (days == -1) { markInvalid(DAY); markInvalid(MONTH); } } if (years != -1 && months != -1 && days != -1) { if (!QDate(years, months, days).isValid()) { years = -1; months = -1; days = -1; markInvalid(YEAR); markInvalid(MONTH); markInvalid(DAY); } } m_groups[YEAR].setValue(years); m_groups[MONTH].setValue(months); m_groups[DAY].setValue(days); m_groups[HOUR].setValue(hours); m_groups[MINUTE].setValue(minutes); m_groups[SECOND].setValue(seconds); if (years != -1 && months != -1 && days != -1 && hours != -1 && minutes != -1 && seconds != -1) { m_dateTime = QDateTime(QDate(years, months, days), QTime(hours, minutes, seconds), Qt::UTC); } else { m_dateTime = QDateTime(); } emit dateTimeChanged(m_dateTime); update(); }