summaryrefslogtreecommitdiffstats
path: root/libmsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-11-30 23:54:39 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:30:31 +0100
commit3c15be137db96a604c90e5c850092e49abea4511 (patch)
tree4b76cf2455d15533e608ce3ee5641c1eaba04e62 /libmsi
parenta10f8ef403ca688bdf506db1bed79734437ae75e (diff)
downloadmsitools-3c15be137db96a604c90e5c850092e49abea4511.tar.gz
msitools-3c15be137db96a604c90e5c850092e49abea4511.tar.xz
msitools-3c15be137db96a604c90e5c850092e49abea4511.zip
eliminate LIBMSI_DB_OPEN_DIRECT
It is not supported by libgsf
Diffstat (limited to 'libmsi')
-rw-r--r--libmsi/database.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/libmsi/database.c b/libmsi/database.c
index a3bc8da..1f8fc3e 100644
--- a/libmsi/database.c
+++ b/libmsi/database.c
@@ -52,7 +52,8 @@
* Any binary data in a table is a reference to a stream.
*/
-#define IS_INTMSIDBOPEN(x) (((uintptr_t)(x) >> 16) == 0)
+#define IS_INTMSIDBOPEN(x) \
+ ((x) >= LIBMSI_DB_OPEN_READONLY && (x) <= LIBMSI_DB_OPEN_CREATE)
typedef struct LibmsiTransform {
struct list entry;
@@ -313,8 +314,7 @@ LibmsiResult libmsi_database_open(const char *szDBPath, const char *szPersist, L
if( !pdb )
return LIBMSI_RESULT_INVALID_PARAMETER;
- if (szPersist - LIBMSI_DB_OPEN_PATCHFILE >= LIBMSI_DB_OPEN_READONLY &&
- szPersist - LIBMSI_DB_OPEN_PATCHFILE <= LIBMSI_DB_OPEN_CREATEDIRECT)
+ if (IS_INTMSIDBOPEN(szPersist - LIBMSI_DB_OPEN_PATCHFILE))
{
TRACE("Database is a patch\n");
szPersist -= LIBMSI_DB_OPEN_PATCHFILE;
@@ -347,25 +347,11 @@ LibmsiResult libmsi_database_open(const char *szDBPath, const char *szPersist, L
r = db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase );
created = true;
}
- else if( szPersist == LIBMSI_DB_OPEN_CREATEDIRECT )
- {
- r = StgCreateDocfile( szwDBPath,
- STGM_CREATE|STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg );
-
- if( SUCCEEDED(r) )
- r = db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase );
- created = true;
- }
else if( szPersist == LIBMSI_DB_OPEN_TRANSACT )
{
r = StgOpenStorage( szwDBPath, NULL,
STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
}
- else if( szPersist == LIBMSI_DB_OPEN_DIRECT )
- {
- r = StgOpenStorage( szwDBPath, NULL,
- STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
- }
else
{
ERR("unknown flag %p\n",szPersist);