From 5b1dd49a93eee9d99fde440a0ef4b18a57695281 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Wed, 31 May 2017 09:04:26 -0700 Subject: [PATCH] Add more code style requirements --- CONTRIBUTING.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 211472e04..bb1897066 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,7 @@ * When breaking on binary operators, put the operator at the beginning of the new line. * Do not use aligned indentation. Indentation should always be block indentation. * Always use spaces for indentation. +* Blank spaces should be avoided except around the import section at the top. ## Imports @@ -53,17 +54,19 @@ FN!{stdcall DRAWSTATEPROC( lData: LPARAM, wData: WPARAM, cx: c_int, - cy: c_int + cy: c_int, ) -> BOOL} FN!{stdcall NAMEENUMPROCA( LPSTR, - LPARAM + LPARAM, ) -> BOOL} ``` ## Constants * Convert macro constants to Rust constants. +* Numeric values should be formatted identically to how they are in the source file (don't convert + hex values to decimal, preserve capitalization of hex values, etc.) * The type of the constant should depend on where the constant is used. MSDN may help for this. ```C @@ -75,6 +78,9 @@ pub const CLSCTX_INPROC: CLSCTX = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER; ## GUIDs +* Numeric values should be formatted identically to how they are in the source file (don't convert + hex values to decimal, preserve capitalization of hex values, etc.) + ```Rust DEFINE_GUID!{GUID_DEVCLASS_SENSOR, 0x5175d334, 0xc371, 0x4806, 0xb3, 0xba, 0x71, 0xfd, 0x53, 0xc9, 0x25, 0x8d} @@ -137,20 +143,22 @@ interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtb fragmentStart: *mut *const c_void, fileOffset: UINT64, fragmentSize: UINT64, - fragmentContext: *mut *mut c_void + fragmentContext: *mut *mut c_void, ) -> HRESULT, fn ReleaseFileFragment( - fragmentContext: *mut c_void + fragmentContext: *mut c_void, ) -> (), fn GetFileSize( - fileSize: *mut UINT64 + fileSize: *mut UINT64, ) -> HRESULT, fn GetLastWriteTime( - lastWriteTime: *mut UINT64 + lastWriteTime: *mut UINT64, ) -> HRESULT }} ``` +For COM interfaces without a UUID, a UUID of all-zeroes should be used. + ## Organization of code * All definitions go into the source file that directly maps to the header the definition is from.