Skip to content

Commit 46bbf83

Browse files
author
Alrik Vidstrom
committed
Add a few const and update header guard
1 parent 2d922fa commit 46bbf83

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Arduino_POSIXStorage.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
388388
}
389389
// <--
390390

391-
int mountOrFormatReturn = mountOrFormatFileSystemOnDevice(DEV_SDCARD, &sdcard, fileSystem, "sdcard", mountOrFormat);
391+
const int mountOrFormatReturn = mountOrFormatFileSystemOnDevice(DEV_SDCARD, &sdcard, fileSystem, "sdcard", mountOrFormat);
392392
if (0 != mountOrFormatReturn)
393393
{
394394
delete sdcard.device;
@@ -453,7 +453,7 @@ int mountOrFormatUSBDevice(const enum FileSystems fileSystem,
453453
return ENOTBLK;
454454
}
455455
}
456-
int mountOrFormatReturn = mountOrFormatFileSystemOnDevice(DEV_USB, &usb, fileSystem, "usb", mountOrFormat);
456+
const int mountOrFormatReturn = mountOrFormatFileSystemOnDevice(DEV_USB, &usb, fileSystem, "usb", mountOrFormat);
457457
if (0 != mountOrFormatReturn)
458458
{
459459
// Only delete if the object was created by this function
@@ -510,7 +510,7 @@ int mount(const enum DeviceNames deviceName,
510510
errno = ENOTSUP;
511511
return -1;
512512
}
513-
int mountOrFormatReturn = mountOrFormat(deviceName, fileSystem, ACTION_MOUNT);
513+
const int mountOrFormatReturn = mountOrFormat(deviceName, fileSystem, ACTION_MOUNT);
514514
if (0 != mountOrFormatReturn)
515515
{
516516
errno = mountOrFormatReturn;
@@ -521,7 +521,7 @@ int mount(const enum DeviceNames deviceName,
521521

522522
int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem)
523523
{
524-
int mountOrFormatReturn = mountOrFormat(deviceName, fileSystem, ACTION_FORMAT);
524+
const int mountOrFormatReturn = mountOrFormat(deviceName, fileSystem, ACTION_FORMAT);
525525
if (0 != mountOrFormatReturn)
526526
{
527527
errno = mountOrFormatReturn;
@@ -532,7 +532,7 @@ int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem)
532532

533533
int umount(const enum DeviceNames deviceName)
534534
{
535-
struct DeviceFileSystemCombination *deviceFileSystemCombination;
535+
struct DeviceFileSystemCombination *deviceFileSystemCombination = nullptr;
536536

537537
switch (deviceName)
538538
{

src/Arduino_POSIXStorage.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
*********************************************************************************************************
4747
*/
4848

49-
#ifndef POSIXStorage_H
50-
#define POSIXStorage_H
49+
#ifndef Arduino_POSIXStorage_H
50+
#define Arduino_POSIXStorage_H
5151

5252
/*
5353
*********************************************************************************************************
@@ -152,4 +152,4 @@ int deregister_hotplug_callback(const enum DeviceNames deviceName);
152152
*/
153153
int mkfs(const enum DeviceNames deviceName, const enum FileSystems fileSystem);
154154

155-
#endif // POSIXStorage_H
155+
#endif // Arduino_POSIXStorage_H

0 commit comments

Comments
 (0)