Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/property.cpp

Issue 29329159: Issue #1185 - Fix formatting in installer-lib and its tests (Closed)
Patch Set: Created Oct. 15, 2015, 7:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/src/installer-lib/property.h ('k') | installer/src/installer-lib/record.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « installer/src/installer-lib/property.h ('k') | installer/src/installer-lib/record.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld