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

Unified Diff: installer/src/installer-lib/record.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/record.h ('k') | installer/src/installer-lib/session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/src/installer-lib/record.cpp
===================================================================
--- a/installer/src/installer-lib/record.cpp
+++ b/installer/src/installer-lib/record.cpp
@@ -9,74 +9,74 @@
//-----------------------------------------------------------------------------------------
// Record
//-----------------------------------------------------------------------------------------
-Record::Record( unsigned int nFields )
+Record::Record(unsigned int nFields)
{
- handle = MsiCreateRecord( nFields ) ;
- if ( ! handle )
+ handle = MsiCreateRecord(nFields);
+ if (! handle)
{
- throw WindowsApiError( "MsiCreateRecord", 0 ) ;
+ throw WindowsApiError("MsiCreateRecord", 0);
}
}
Record::~Record()
{
- if ( handle != 0 )
+ if (handle != 0)
{
- MsiCloseHandle( handle ) ;
+ MsiCloseHandle(handle);
}
}
void Record::OnlyNonNull()
{
- if ( handle == 0 )
+ if (handle == 0)
{
- throw std::runtime_error( "Operation only permitted for non-null objects" ) ;
+ throw std::runtime_error("Operation only permitted for non-null objects");
}
}
-void Record::AssignString( unsigned int fieldIndex, const char *value )
+void Record::AssignString(unsigned int fieldIndex, const char* value)
{
- OnlyNonNull() ;
- MsiRecordSetStringA( handle, fieldIndex, value ) ;
+ OnlyNonNull();
+ MsiRecordSetStringA(handle, fieldIndex, value);
}
-void Record::AssignString( unsigned int fieldIndex, const wchar_t *value )
+void Record::AssignString(unsigned int fieldIndex, const wchar_t* value)
{
- OnlyNonNull() ;
- MsiRecordSetStringW( handle, fieldIndex, value ) ;
+ OnlyNonNull();
+ MsiRecordSetStringW(handle, fieldIndex, value);
}
/**
* \par Implementation
* - MSDN [MsiRecordGetString](http://msdn.microsoft.com/en-us/library/aa370368%28v=vs.85%29.aspx)
*/
-std::wstring Record::ValueString( unsigned int fieldIndex )
+std::wstring Record::ValueString(unsigned int fieldIndex)
{
- static wchar_t initialBuffer[ 1024 ] = L"" ;
+ static wchar_t initialBuffer[1024] = L"";
DWORD length = 1023 ; // one less than the buffer length to hold a terminating null character
- UINT x = MsiRecordGetStringW( handle, fieldIndex, initialBuffer, & length ) ;
- if ( x == ERROR_SUCCESS )
+ UINT x = MsiRecordGetStringW(handle, fieldIndex, initialBuffer, & length);
+ if (x == ERROR_SUCCESS)
{
- return std::wstring( initialBuffer ) ;
+ return std::wstring(initialBuffer);
}
- if ( x == ERROR_MORE_DATA )
+ if (x == ERROR_MORE_DATA)
{
// Future: handle longer strings.
/*
* The present custom action only uses this function for strings that appear in dialog boxes.
* A thousand characters is about a dozen lines of text, which is far more than enough.
*/
- throw NotYetSupported( "retrieving string values longer than 1023 from a record" ) ;
+ throw NotYetSupported("retrieving string values longer than 1023 from a record");
}
- throw WindowsApiError( "MsiRecordGetStringW", x ) ;
+ throw WindowsApiError("MsiRecordGetStringW", x);
}
size_t Record::NumberOfFields() const
{
- unsigned int x = MsiRecordGetFieldCount( handle ) ;
- if ( x == 0xFFFFFFFF )
+ unsigned int x = MsiRecordGetFieldCount(handle);
+ if (x == 0xFFFFFFFF)
{
- throw WindowsApiError( "MsiRecordGetFieldCount", x, "invalid handle" ) ;
+ throw WindowsApiError("MsiRecordGetFieldCount", x, "invalid handle");
}
- return x ;
+ return x;
}
« no previous file with comments | « installer/src/installer-lib/record.h ('k') | installer/src/installer-lib/session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld