Andrew Talbot wrote:
Changelog: avifil32: Fix some memory leaks.
- if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1)
return AVIERR_FILEWRITE;
- if (mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK)
return AVIERR_FILEWRITE;
- if (mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize)
return AVIERR_FILEWRITE;
- if (mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
- if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET) == -1 ||
mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK ||
mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize ||
mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
- {
Doesn't this mean that every one of those 4 mmio-calls are executed? In the previous logic we would bail out after one failure.
Paul Vriens wrote:
Doesn't this mean that every one of those 4 mmio-calls are executed? In the previous logic we would bail out after one failure.
My reasoning is that short-circuit evaluation ensures that expressions are evaluated from left to right, and as soon as one evaluates as true, the whole "if" clause must be true, so the remaining statements are discarded.
Andrew Talbot wrote:
Paul Vriens wrote:
Doesn't this mean that every one of those 4 mmio-calls are executed? In the previous logic we would bail out after one failure.
My reasoning is that short-circuit evaluation ensures that expressions are evaluated from left to right, and as soon as one evaluates as true, the whole "if" clause must be true, so the remaining statements are discarded.
Yes I see now, sorry about the noise (there was something wrong with my own logic).
On Wednesday 12 September 2007, Paul Vriens wrote:
Andrew Talbot wrote:
Changelog: avifil32: Fix some memory leaks.
- if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET)
== -1) - return AVIERR_FILEWRITE;
- if (mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK)
return AVIERR_FILEWRITE;
- if (mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) !=
ck.cksize) - return AVIERR_FILEWRITE;
- if (mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
- if (mmioSeek(This->paf->hmmio, This->paf->dwNextFramePos, SEEK_SET)
== -1 || + mmioCreateChunk(This->paf->hmmio, &ck, 0) != S_OK ||
mmioWrite(This->paf->hmmio, (HPSTR)lppc, ck.cksize) != ck.cksize
|| + mmioAscend(This->paf->hmmio, &ck, 0) != S_OK)
- {
Doesn't this mean that every one of those 4 mmio-calls are executed? In the previous logic we would bail out after one failure.
No. They are evaluated left-to-right, and evaluation stops on the first one returning true.
Cheers, Kuba