Skip to content

Commit a09eec1

Browse files
authored
Merge pull request #2 from nanoframework/nfbot/clang-format-fix/d7be10ad-0310-4956-bd59-f669b6f7d3a9
Code style fixes for nanoframework/nf-interpreter PR#3023
2 parents 467b9c2 + 4cdfb12 commit a09eec1

File tree

1 file changed

+108
-108
lines changed

1 file changed

+108
-108
lines changed

targets/netcore/nanoFramework.nanoCLR/nanoCLR_native.cpp

+108-108
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ bool _wireProtocolStopProcess;
5555
/////////////////////////////////////////////////////////////////////////////
5656

5757
// All solutions are expected to provide an implementation of this
58-
bool Target_GetReleaseInfo (NFReleaseInfo &releaseInfo)
58+
bool Target_GetReleaseInfo(NFReleaseInfo &releaseInfo)
5959
{
60-
NFReleaseInfo::Init (
61-
releaseInfo,
62-
VERSION_MAJOR,
63-
VERSION_MINOR,
64-
VERSION_BUILD,
65-
VERSION_REVISION,
66-
OEMSYSTEMINFOSTRING,
67-
hal_strlen_s (OEMSYSTEMINFOSTRING),
68-
TARGETNAMESTRING,
69-
hal_strlen_s (TARGETNAMESTRING),
70-
PLATFORMNAMESTRING,
71-
hal_strlen_s (PLATFORMNAMESTRING));
72-
73-
return true; // alternatively, return false if you didn't initialize the releaseInfo structure.
60+
NFReleaseInfo::Init(
61+
releaseInfo,
62+
VERSION_MAJOR,
63+
VERSION_MINOR,
64+
VERSION_BUILD,
65+
VERSION_REVISION,
66+
OEMSYSTEMINFOSTRING,
67+
hal_strlen_s(OEMSYSTEMINFOSTRING),
68+
TARGETNAMESTRING,
69+
hal_strlen_s(TARGETNAMESTRING),
70+
PLATFORMNAMESTRING,
71+
hal_strlen_s(PLATFORMNAMESTRING));
72+
73+
return true; // alternatively, return false if you didn't initialize the releaseInfo structure.
7474
}
7575

7676
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -80,152 +80,152 @@ bool Target_GetReleaseInfo (NFReleaseInfo &releaseInfo)
8080
// and the declarations @ nanoCLR_native.h
8181
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
8282

83-
void nanoCLR_Run (NANO_CLR_SETTINGS nanoClrSettings)
83+
void nanoCLR_Run(NANO_CLR_SETTINGS nanoClrSettings)
8484
{
8585

8686
#if _DEBUG
87-
// only show this in debug build
88-
DWORD pid = GetCurrentProcessId ();
89-
CLR_Debug::Printf ("Process ID: %d\r\n", pid);
87+
// only show this in debug build
88+
DWORD pid = GetCurrentProcessId();
89+
CLR_Debug::Printf("Process ID: %d\r\n", pid);
9090
#endif
9191

92-
CLR_Debug::Printf (
93-
"\r\nLoading nanoCLR v%d.%d.%d.%d\r\n...",
94-
VERSION_MAJOR,
95-
VERSION_MINOR,
96-
VERSION_BUILD,
97-
VERSION_REVISION);
92+
CLR_Debug::Printf(
93+
"\r\nLoading nanoCLR v%d.%d.%d.%d\r\n...",
94+
VERSION_MAJOR,
95+
VERSION_MINOR,
96+
VERSION_BUILD,
97+
VERSION_REVISION);
9898

99-
// initialize nanoHAL
100-
nanoHAL_Initialize ();
99+
// initialize nanoHAL
100+
nanoHAL_Initialize();
101101

102-
// take care of block storage here as we are RAM based
103-
BlockStorageList_Initialize ();
104-
BlockStorage_AddDevices ();
105-
BlockStorageList_InitializeDevices ();
102+
// take care of block storage here as we are RAM based
103+
BlockStorageList_Initialize();
104+
BlockStorage_AddDevices();
105+
BlockStorageList_InitializeDevices();
106106

107-
CLR_SETTINGS clrSettings;
108-
ZeroMemory (&clrSettings, sizeof (CLR_SETTINGS));
107+
CLR_SETTINGS clrSettings;
108+
ZeroMemory(&clrSettings, sizeof(CLR_SETTINGS));
109109

110-
clrSettings.MaxContextSwitches = nanoClrSettings.MaxContextSwitches;
111-
clrSettings.WaitForDebugger = nanoClrSettings.WaitForDebugger;
112-
clrSettings.EnterDebuggerLoopAfterExit = nanoClrSettings.EnterDebuggerLoopAfterExit;
113-
clrSettings.PerformGarbageCollection = nanoClrSettings.PerformGarbageCollection;
114-
clrSettings.PerformHeapCompaction = nanoClrSettings.PerformHeapCompaction;
110+
clrSettings.MaxContextSwitches = nanoClrSettings.MaxContextSwitches;
111+
clrSettings.WaitForDebugger = nanoClrSettings.WaitForDebugger;
112+
clrSettings.EnterDebuggerLoopAfterExit = nanoClrSettings.EnterDebuggerLoopAfterExit;
113+
clrSettings.PerformGarbageCollection = nanoClrSettings.PerformGarbageCollection;
114+
clrSettings.PerformHeapCompaction = nanoClrSettings.PerformHeapCompaction;
115115

116-
ClrStartup (clrSettings);
116+
ClrStartup(clrSettings);
117117

118118
#if !defined(BUILD_RTM)
119-
CLR_Debug::Printf ("Exiting.\r\n");
119+
CLR_Debug::Printf("Exiting.\r\n");
120120
#endif
121121
}
122122

123-
void nanoCLR_SetDebugPrintCallback (DebugPrintCallback debugPrintCallback)
123+
void nanoCLR_SetDebugPrintCallback(DebugPrintCallback debugPrintCallback)
124124
{
125-
gDebugPrintCallback = debugPrintCallback;
125+
gDebugPrintCallback = debugPrintCallback;
126126
}
127127

128-
void nanoCLR_SetWireProtocolReceiveCallback (WireReceiveCallback receiveCallback)
128+
void nanoCLR_SetWireProtocolReceiveCallback(WireReceiveCallback receiveCallback)
129129
{
130-
WireProtocolReceiveCallback = receiveCallback;
130+
WireProtocolReceiveCallback = receiveCallback;
131131
}
132132

133-
void nanoCLR_SetWireProtocolTransmitCallback (WireTransmitCallback transmitCallback)
133+
void nanoCLR_SetWireProtocolTransmitCallback(WireTransmitCallback transmitCallback)
134134
{
135-
WireProtocolTransmitCallback = transmitCallback;
135+
WireProtocolTransmitCallback = transmitCallback;
136136
}
137137

138-
void nanoCLR_WireProtocolProcess ()
138+
void nanoCLR_WireProtocolProcess()
139139
{
140-
while (!_wireProtocolStopProcess)
141-
{
142-
WP_Message_Process ();
143-
}
140+
while (!_wireProtocolStopProcess)
141+
{
142+
WP_Message_Process();
143+
}
144144
}
145145

146-
void nanoCLR_WireProtocolOpen ()
146+
void nanoCLR_WireProtocolOpen()
147147
{
148-
WP_Message_PrepareReception ();
148+
WP_Message_PrepareReception();
149149

150-
_wireProtocolStopProcess = false;
150+
_wireProtocolStopProcess = false;
151151
}
152152

153-
void nanoCLR_WireProtocolClose ()
153+
void nanoCLR_WireProtocolClose()
154154
{
155-
// request to stop
156-
_wireProtocolStopProcess = true;
155+
// request to stop
156+
_wireProtocolStopProcess = true;
157157
}
158158

159-
const char *nanoCLR_GetVersion ()
159+
const char *nanoCLR_GetVersion()
160160
{
161-
char buffer[128];
161+
char buffer[128];
162162

163-
char *pszVersion = nullptr;
164-
pszVersion = (char *)CoTaskMemAlloc (std::size (buffer));
163+
char *pszVersion = nullptr;
164+
pszVersion = (char *)CoTaskMemAlloc(std::size(buffer));
165165

166-
if (pszVersion != nullptr)
167-
{
168-
const auto result = std::format_to_n (
169-
buffer,
170-
std::size (buffer) - 1,
171-
"{}.{}.{}.{}",
172-
VERSION_MAJOR,
173-
VERSION_MINOR,
174-
VERSION_BUILD,
175-
VERSION_REVISION);
176-
*result.out = '\0';
166+
if (pszVersion != nullptr)
167+
{
168+
const auto result = std::format_to_n(
169+
buffer,
170+
std::size(buffer) - 1,
171+
"{}.{}.{}.{}",
172+
VERSION_MAJOR,
173+
VERSION_MINOR,
174+
VERSION_BUILD,
175+
VERSION_REVISION);
176+
*result.out = '\0';
177177

178-
const std::string_view str{ buffer, result.out };
178+
const std::string_view str{buffer, result.out};
179179

180-
std::memcpy (pszVersion, buffer, result.size);
181-
}
180+
std::memcpy(pszVersion, buffer, result.size);
181+
}
182182

183-
return pszVersion;
183+
return pszVersion;
184184
}
185185

186-
uint16_t nanoCLR_GetNativeAssemblyCount ()
186+
uint16_t nanoCLR_GetNativeAssemblyCount()
187187
{
188-
return g_CLR_InteropAssembliesCount;
188+
return g_CLR_InteropAssembliesCount;
189189
}
190190

191-
bool nanoCLR_GetNativeAssemblyInformation (const CLR_UINT8 *data, size_t size)
191+
bool nanoCLR_GetNativeAssemblyInformation(const CLR_UINT8 *data, size_t size)
192192
{
193-
if (data == nullptr)
194-
{
195-
return false;
196-
}
193+
if (data == nullptr)
194+
{
195+
return false;
196+
}
197197

198-
const size_t requiredSize = g_CLR_InteropAssembliesCount * (5 * sizeof (CLR_UINT16) + 128);
199-
if (size < requiredSize)
200-
{
201-
// Buffer too small
202-
return false;
203-
}
198+
const size_t requiredSize = g_CLR_InteropAssembliesCount * (5 * sizeof(CLR_UINT16) + 128);
199+
if (size < requiredSize)
200+
{
201+
// Buffer too small
202+
return false;
203+
}
204204

205-
// clear buffer memory
206-
memset ((void *)data, 0, size);
205+
// clear buffer memory
206+
memset((void *)data, 0, size);
207207

208-
// fill the array
209-
for (uint32_t i = 0; i < g_CLR_InteropAssembliesCount; i++)
210-
{
211-
memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_checkSum, sizeof (CLR_UINT32));
212-
data += sizeof (CLR_UINT32);
208+
// fill the array
209+
for (uint32_t i = 0; i < g_CLR_InteropAssembliesCount; i++)
210+
{
211+
memcpy((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_checkSum, sizeof(CLR_UINT32));
212+
data += sizeof(CLR_UINT32);
213213

214-
memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iMajorVersion, sizeof (CLR_UINT16));
215-
data += sizeof (CLR_UINT16);
214+
memcpy((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iMajorVersion, sizeof(CLR_UINT16));
215+
data += sizeof(CLR_UINT16);
216216

217-
memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iMinorVersion, sizeof (CLR_UINT16));
218-
data += sizeof (CLR_UINT16);
217+
memcpy((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iMinorVersion, sizeof(CLR_UINT16));
218+
data += sizeof(CLR_UINT16);
219219

220-
memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iBuildNumber, sizeof (CLR_UINT16));
221-
data += sizeof (CLR_UINT16);
220+
memcpy((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iBuildNumber, sizeof(CLR_UINT16));
221+
data += sizeof(CLR_UINT16);
222222

223-
memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iRevisionNumber, sizeof (CLR_UINT16));
224-
data += sizeof (CLR_UINT16);
223+
memcpy((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version.iRevisionNumber, sizeof(CLR_UINT16));
224+
data += sizeof(CLR_UINT16);
225225

226-
hal_strcpy_s ((char *)data, 128, g_CLR_InteropAssembliesNativeData[i]->m_szAssemblyName);
227-
data += 128;
228-
}
226+
hal_strcpy_s((char *)data, 128, g_CLR_InteropAssembliesNativeData[i]->m_szAssemblyName);
227+
data += 128;
228+
}
229229

230-
return true; // Success
230+
return true; // Success
231231
}

0 commit comments

Comments
 (0)