[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Tue Jan 11 08:44:24 CET 2005
CVS commit by staikos:
add an abort() and do some very minor cleanups in prep for kstrvector reworkings
M +29 -30 kstrvector.cpp 1.69
M +2 -0 kstvector.cpp 1.91
--- kdeextragear-2/kst/kst/kstrvector.cpp #1.68:1.69
@@ -30,5 +30,4 @@
#include "kstrvector.h"
-//
// ReqNF <=0 means read from ReqF0 to end of File
// ReqF0 < means start at EndOfFile-ReqNF.
@@ -40,5 +39,4 @@
// > 1 < 0 read the last ReqNF frames from the file
// > 1 >=0 Read ReqNF frames starting at frame ReqF0
-//
/** Create a KstRVector: raw data from a file */
@@ -367,14 +386,10 @@ void KstRVector::checkIntegrity() {
}
- //
// if it looks like we have a new file, reset
- //
if (_file && (SPF != _file->samplesPerFrame(_field) || _file->frameCount(_field) < NF)) {
reset();
}
- //
- // check for illeagal NF and F0 values
- //
+ // check for illegal NF and F0 values
if (ReqNF < 1 && ReqF0 < 0) {
ReqF0 = 0; // for this illegal case, read the whole file
@@ -418,7 +433,5 @@ KstObject::UpdateType KstRVector::doUpda
}
- //
// set new_nf and new_f0
- //
int fc = _file->frameCount(_field);
if (ReqNF < 1) { // read to end of file
@@ -443,7 +456,5 @@ KstObject::UpdateType KstRVector::doUpda
if (DoSkip) {
- //
// change new_f0 and new_nf so they both lie on skip boundaries
- //
tmp_fn = ((new_f0+new_nf)/Skip) * Skip;
new_f0 = (((new_f0-1)/Skip)+1) * Skip;
@@ -455,7 +466,5 @@ KstObject::UpdateType KstRVector::doUpda
}
- //
// shift vector if necessary
- //
if (new_f0 < F0 || new_f0 >= F0 + NF) { // No useful data around.
reset();
@@ -477,7 +486,5 @@ KstObject::UpdateType KstRVector::doUpda
if (DoSkip) {
- //
// reallocate V if necessary
- //
if (new_nf / Skip != _size) {
bool rc = resize(new_nf/Skip);
@@ -511,7 +518,5 @@ KstObject::UpdateType KstRVector::doUpda
}
} else {
- //
// reallocate V if necessary
- //
if ((new_nf - 1)*SPF + 1 != _size) {
bool rc = resize((new_nf - 1)*SPF + 1);
@@ -525,7 +530,5 @@ KstObject::UpdateType KstRVector::doUpda
}
- //
// read the new data from file
- //
if (_file->samplesPerFrame(_field) > 1) {
n_read = _file->readField(_v+NF*SPF, _field, new_f0 + NF, new_nf - NF - 1);
@@ -541,5 +544,4 @@ KstObject::UpdateType KstRVector::doUpda
_numSamples += n_read;
- //
// if for some reason (eg, realtime reading an nfs mounted
// dirfile) not all of the data was read, the data will never
@@ -549,5 +551,4 @@ KstObject::UpdateType KstRVector::doUpda
// to add blocking w/ timeout to KstFile.
// As a first fix, mount all nsf mounted dirfiles with "-o noac"
- //
_dirty = false;
if (_numSamples != _size && !(_numSamples == 0 && _size == 1)) {
@@ -600,13 +604,7 @@ void KstRVector::reload() {
if (_file) {
_file->writeLock();
- if (_file->reset()) {
- //
- // try the efficient way first
- //
+ if (_file->reset()) { // try the efficient way first
reset();
- } else {
- //
- // the inefficient way
- //
+ } else { // the inefficient way
KstDataSourcePtr newsrc = KstDataSource::loadSource(_file->fileName(), _file->fileType());
assert(newsrc != _file);
--- kdeextragear-2/kst/kst/kstvector.cpp #1.90:1.91
@@ -245,4 +245,6 @@ bool KstVector::resize(int sz, bool rein
#endif
}
+#else
+ abort(); // avoid unpleasant surprises
#endif
_size = sz;
More information about the Kst
mailing list