Index: installer/src/installer-lib/property.cpp |
=================================================================== |
--- a/installer/src/installer-lib/property.cpp |
+++ b/installer/src/installer-lib/property.cpp |
@@ -11,9 +11,9 @@ |
//----------------------------------------------------------------------------------------- |
// Property |
//----------------------------------------------------------------------------------------- |
-Property::Property( Session & session, std::wstring name ) |
+Property::Property(Session& session, std::wstring name) |
// VSE 2012 shows an IntelliSense error here. Ignore it. The compiler properly sees the 'friend' declaration. |
- : handle( session.handle ), name( name ) |
+ : handle(session.handle), name(name) |
{} |
/** |
@@ -28,30 +28,30 @@ |
* We use only a modest fixed-size buffer for the first step, because we handle arbitrary-length property values in a second step. |
*/ |
// This buffer allocates on the stack, so we don't want it too large; 64 characters is enough for most properties anyway. |
- WCHAR buffer1[ 64 ] = { L'\0' } ; |
- DWORD length = sizeof( buffer1 ) / sizeof( WCHAR ) ; |
- UINT x = MsiGetPropertyW( handle, name.c_str(), buffer1, & length ) ; |
- switch ( x ) |
+ WCHAR buffer1[64] = { L'\0' }; |
+ DWORD length = sizeof(buffer1) / sizeof(WCHAR); |
+ UINT x = MsiGetPropertyW(handle, name.c_str(), buffer1, & length); |
+ switch (x) |
{ |
- case ERROR_SUCCESS: |
- // This call might succeed, which means the return value was short enough to fit into the buffer. |
- return std::wstring( buffer1, length ) ; |
- case ERROR_MORE_DATA: |
- // Do nothing yet. |
- break ; |
- default: |
- throw WindowsApiError( "MsiGetPropertyW", x, "fixed buffer" ) ; |
+ case ERROR_SUCCESS: |
+ // This call might succeed, which means the return value was short enough to fit into the buffer. |
+ return std::wstring(buffer1, length); |
+ case ERROR_MORE_DATA: |
+ // Do nothing yet. |
+ break; |
+ default: |
+ throw WindowsApiError("MsiGetPropertyW", x, "fixed buffer"); |
} |
// Assert we received ERROR_MORE_DATA |
// unique_ptr handles deallocation transparently |
- std::unique_ptr< WCHAR[] > buffer2( new WCHAR[ length ] ) ; |
- x = MsiGetPropertyW( handle, name.c_str(), buffer2.get(), & length ) ; |
- switch ( x ) |
+ std::unique_ptr<WCHAR[]> buffer2(new WCHAR[length]); |
+ x = MsiGetPropertyW(handle, name.c_str(), buffer2.get(), & length); |
+ switch (x) |
{ |
- case ERROR_SUCCESS: |
- return std::wstring( buffer2.get(), length ) ; |
- default: |
- throw WindowsApiError( "MsiGetPropertyW", x, "allocated buffer" ) ; |
+ case ERROR_SUCCESS: |
+ return std::wstring(buffer2.get(), length); |
+ default: |
+ throw WindowsApiError("MsiGetPropertyW", x, "allocated buffer"); |
} |
} |
@@ -59,11 +59,11 @@ |
* \par Implementation |
* The center of the implementation is the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa370391%28v=vs.85%29.aspx">MsiSetProperty function</a>. |
*/ |
-void Property::operator=( const std::wstring & value ) |
+void Property::operator=(const std::wstring& value) |
{ |
- UINT x = MsiSetPropertyW( handle, name.c_str(), value.c_str() ) ; |
- if ( x != ERROR_SUCCESS ) |
+ UINT x = MsiSetPropertyW(handle, name.c_str(), value.c_str()); |
+ if (x != ERROR_SUCCESS) |
{ |
- throw WindowsApiError( "MsiSetPropertyW", x ) ; |
+ throw WindowsApiError("MsiSetPropertyW", x); |
} |
} |