[commit] r2221 - in trunk/GME: Core Mga
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed May 29 15:21:08 CDT 2013
Author: ksmyth
Date: Wed May 29 15:21:06 2013
New Revision: 2221
Log:
Fix ErrorInfo for read-only tx, some Mga usage errors
Modified:
trunk/GME/Core/CoreProject.cpp
trunk/GME/Mga/MgaTrukk.h
Modified: trunk/GME/Core/CoreProject.cpp
==============================================================================
--- trunk/GME/Core/CoreProject.cpp Wed May 29 10:10:41 2013 (r2220)
+++ trunk/GME/Core/CoreProject.cpp Wed May 29 15:21:06 2013 (r2221)
@@ -349,9 +349,13 @@
STDMETHODIMP CCoreProject::BeginTransaction(transtype_enum transtype)
{
- if( storage == NULL || (transtype & TRANSTYPE_ANY) == 0 ||
- (InTransaction() && (transtype & TRANSTYPE_NESTED) == 0) ||
- (InReadTransaction() && (transtype & TRANSTYPE_READ) == 0) )
+ if (InReadTransaction() && (transtype & TRANSTYPE_READ) == 0)
+ {
+ SetErrorInfo(L"Project is in read-only transaction and cannot be modified");
+ return E_INVALID_USAGE;
+ }
+ if (storage == NULL || (transtype & TRANSTYPE_ANY) == 0 ||
+ (InTransaction() && (transtype & TRANSTYPE_NESTED) == 0))
{
COMRETURN(E_INVALID_USAGE);
}
Modified: trunk/GME/Mga/MgaTrukk.h
==============================================================================
--- trunk/GME/Mga/MgaTrukk.h Wed May 29 10:10:41 2013 (r2220)
+++ trunk/GME/Mga/MgaTrukk.h Wed May 29 15:21:06 2013 (r2221)
@@ -257,9 +257,9 @@
CMgaProject *pr;
public:
HRESULT Begin(CMgaProject *ppr) {
- if(!ppr) return E_MGA_ZOMBIE_NOPROJECT;
- if(!ppr->opened) return E_MGA_ZOMBIE_CLOSED_PROJECT;
- if(!ppr->activeterr) return E_MGA_NOT_IN_TRANSACTION;
+ if(!ppr) { SetStandardOrGMEErrorInfo(E_MGA_ZOMBIE_NOPROJECT); return E_MGA_ZOMBIE_NOPROJECT; }
+ if(!ppr->opened) { SetStandardOrGMEErrorInfo(E_MGA_ZOMBIE_CLOSED_PROJECT); return E_MGA_ZOMBIE_CLOSED_PROJECT; }
+ if(!ppr->activeterr) { SetStandardOrGMEErrorInfo(E_MGA_NOT_IN_TRANSACTION); return E_MGA_NOT_IN_TRANSACTION; }
if(ppr->alreadynested()) {
pr = NULL;
return S_OK;
@@ -283,7 +283,7 @@
#define COMTRY_IN_TRANSACTION { \
Transaction ttt; \
HRESULT hr = ttt.Begin(mgaproject); \
- if(hr != S_OK) return hr; \
+ if(hr != S_OK) { return hr; } \
try
bool MgaSetErrorInfo(HRESULT hr);
@@ -327,7 +327,7 @@
Transaction ttt; \
if (!(this->mgaproject->preferences & MGAPREF_NO_NESTED_TX)) { \
HRESULT hr = ttt.Begin(mgaproject); \
- if (hr != S_OK) return hr; \
+ if (hr != S_OK) { return hr; } \
} \
try
More information about the gme-commit
mailing list