Issue 106389 - package: dubious && || in ZipPackageFolder.cxx
Summary: package: dubious && || in ZipPackageFolder.cxx
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: DEV300m63
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.3
Assignee: mikhail.voytenko
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2009-10-28 16:36 UTC by caolanm
Modified: 2017-05-20 10:24 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
keep logic (1.04 KB, patch)
2009-10-28 16:37 UTC, caolanm
no flags Details | Diff
change logic (935 bytes, patch)
2009-10-28 16:37 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2009-10-28 16:36:49 UTC
i.e. we have...

if ( !bUseNonSeekableAccess &&
 ( bRawStream || bTransportOwnEncrStreamAsRaw ||
  ( pStream->IsPackageMember()              && !bToBeEncrypted && 
    ( pStream->aEntry.nMethod == DEFLATED &&  bToBeCompressed ) ||
    ( pStream->aEntry.nMethod == STORED   && !bToBeCompressed ) ) ) )

which is parsed as

if ( !bUseNonSeekableAccess &&
 ( bRawStream || bTransportOwnEncrStreamAsRaw ||
  (( pStream->IsPackageMember()              && !bToBeEncrypted && 
    ( pStream->aEntry.nMethod == DEFLATED &&  bToBeCompressed )) ||
    ( pStream->aEntry.nMethod == STORED   && !bToBeCompressed ) ) ) )

which is a little suspicious, I suspect it might have been intended to be

if ( !bUseNonSeekableAccess &&
 ( bRawStream || bTransportOwnEncrStreamAsRaw ||
  ( pStream->IsPackageMember()              && !bToBeEncrypted && 
    (( pStream->aEntry.nMethod == DEFLATED &&  bToBeCompressed ) ||
    ( pStream->aEntry.nMethod == STORED   && !bToBeCompressed )) ) ) )

patch 1 keeps our current logic and silences warning, patch 2 changes the logic
to what might have been intended
Comment 1 caolanm 2009-10-28 16:37:28 UTC
Created attachment 65706 [details]
keep logic
Comment 2 caolanm 2009-10-28 16:37:45 UTC
Created attachment 65707 [details]
change logic
Comment 3 mikhail.voytenko 2009-10-29 08:15:28 UTC
mav->cmc: Thank you for the patch. You are completely right, generally speaking
the changed version is the correct one.

The interesting thing is that the source code functions correctly now, because
the stream has nMethod set only if it is a package member, and if the stream
should be encrypted it must be compressed as well. Anyway, the current
implementation works by luck and is not clear, so I will integrate the second
patch in the next 3.3 framework cws.
Comment 4 mikhail.voytenko 2009-10-29 08:16:20 UTC
Changing the component to framework.
Comment 5 mikhail.voytenko 2010-03-23 14:27:50 UTC
The fix is integrated in cws fwk138.
Comment 6 mikhail.voytenko 2010-04-16 13:57:45 UTC
Development issue, setting myself to verified.