Fix warnings and errors found by the new cppcheck provided static code analysis.
This commit is contained in:
1 parent
b762780343
commit
bb85d083a7
7 files changed
+23
-29
No files matched your search
@@ -801,6 +801,7 @@ int read_intel_hex(const char *filename)
|
||||
if (*buf) {
|
||||
if (parse_hex_line(buf) == 0) {
|
||||
//printf("Warning, parse error line %d\n", lineno);
|
||||
fclose(fp);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ EXCLUDE_LIST = HostLoaderApp/ FATFs/ PetiteFATFs/ uip/
|
||||
MESSAGE_TEMPLATE = "{file}({line}): {severity} ({id}): {message}"
|
||||
|
||||
all:
|
||||
cppcheck -q -f --error-exitcode=1 --template $(MESSAGE_TEMPLATE) --enable=style --suppress=variableScope $(EXCLUDE_LIST:%=-i%) $(LUFA_ROOT_PATH)
|
||||
cppcheck -q -f --error-exitcode=1 --inline-suppr --enable=style --suppress=variableScope --template $(MESSAGE_TEMPLATE) $(EXCLUDE_LIST:%=-i%) $(LUFA_ROOT_PATH)
|
||||
|
||||
%:
|
||||
@@ -473,8 +473,8 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
|
||||
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.ConnectionResponse);
|
||||
|
||||
/* Fill out the Connection Response in the response packet */
|
||||
ResponsePacket.ConnectionResponse.DestinationChannel = ChannelData->LocalNumber;
|
||||
ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
|
||||
ResponsePacket.ConnectionResponse.DestinationChannel = (ChannelData != NULL) ? ChannelData->LocalNumber : 0;
|
||||
ResponsePacket.ConnectionResponse.SourceChannel = (ChannelData != NULL) ? ChannelData->RemoteNumber : 0;
|
||||
ResponsePacket.ConnectionResponse.Result = ChannelStatus;
|
||||
ResponsePacket.ConnectionResponse.Status = 0x00;
|
||||
|
||||
@@ -576,7 +576,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
|
||||
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.ConfigurationResponse);
|
||||
|
||||
/* Fill out the Configuration Response in the response packet */
|
||||
ResponsePacket.ConfigurationResponse.SourceChannel = ChannelData->RemoteNumber;
|
||||
ResponsePacket.ConfigurationResponse.SourceChannel = (ChannelData != NULL) ? ChannelData->RemoteNumber : 0;
|
||||
ResponsePacket.ConfigurationResponse.Flags = 0x00;
|
||||
ResponsePacket.ConfigurationResponse.Result = (ChannelData != NULL) ? BT_CONFIGURATION_SUCCESSFUL : BT_CONFIGURATION_REJECTED;
|
||||
|
||||
@@ -681,8 +681,8 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
|
||||
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.DisconnectionResponse);
|
||||
|
||||
/* Fill out the Disconnection Response in the response packet */
|
||||
ResponsePacket.DisconnectionResponse.DestinationChannel = ChannelData->RemoteNumber;
|
||||
ResponsePacket.DisconnectionResponse.SourceChannel = ChannelData->LocalNumber;
|
||||
ResponsePacket.DisconnectionResponse.DestinationChannel = (ChannelData != NULL) ? ChannelData->RemoteNumber : 0;
|
||||
ResponsePacket.DisconnectionResponse.SourceChannel = (ChannelData != NULL) ? ChannelData->LocalNumber : 0;
|
||||
|
||||
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<Project name="LUFA"><Folder name="Demos"><Folder name="Device"><Folder name="ClassDriver"><Folder name="AudioInput"><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.c"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.h"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.txt"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioInput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioInput\makefile"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.aps"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioOutput\makefile"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.aps"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\makefile"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.aps"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.c"></File><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.h"></File><File path="Demos\Device\ClassDriver\GenericHID\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.c"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.h"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.txt"></File><File path="Demos\Device\ClassDriver\GenericHID\makefile"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.aps"></File></Folder><Folder name="Joystick"><File path="Demos\Device\ClassDriver\Joystick\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Joystick\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Joystick\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.c"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.h"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.txt"></File><File path="Demos\Device\ClassDriver\Joystick\makefile"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.aps"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.txt"></File><File path="Demos\Device\ClassDriver\Keyboard\makefile"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.aps"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\makefile"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.aps"></File></Folder><Folder name="KeyboardMouseMultiReport"><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.txt"></File><File path="Demos\DeLine truncated
|
||||
<Project name="LUFA"><Folder name="Demos"><Folder name="Device"><Folder name="ClassDriver"><Folder name="AudioInput"><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.c"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.h"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.txt"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioInput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioInput\makefile"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.aps"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioOutput\makefile"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.aps"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\makefile"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.aps"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.c"></File><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.h"></File><File path="Demos\Device\ClassDriver\GenericHID\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.c"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.h"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.txt"></File><File path="Demos\Device\ClassDriver\GenericHID\makefile"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.aps"></File></Folder><Folder name="Joystick"><File path="Demos\Device\ClassDriver\Joystick\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Joystick\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Joystick\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.c"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.h"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.txt"></File><File path="Demos\Device\ClassDriver\Joystick\makefile"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.aps"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.txt"></File><File path="Demos\Device\ClassDriver\Keyboard\makefile"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.aps"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\makefile"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.aps"></File></Folder><Folder name="KeyboardMouseMultiReport"><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouseMultiReport\KeyboardMouseMultiReport.txt"></File><File path="Demos\DeLine truncated
|
||||
@@ -40,7 +40,7 @@ struct
|
||||
|
||||
bool ProgrammerConfig_ProcessConfiguration(void)
|
||||
{
|
||||
memset(&ProgrammerConfig, sizeof(ProgrammerConfig), 0x00);
|
||||
memset(&ProgrammerConfig, 0x00, sizeof(ProgrammerConfig));
|
||||
|
||||
if (!(pf_open("CONF.txt") == FR_OK))
|
||||
{
|
||||
@@ -61,8 +61,8 @@ bool ProgrammerConfig_ProcessConfiguration(void)
|
||||
&ProgrammerConfig.SigBytes[1],
|
||||
&ProgrammerConfig.SigBytes[2],
|
||||
&ProgrammerConfig.SigBytes[3]);
|
||||
|
||||
sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
|
||||
|
||||
sscanf(CurrentLine, "SPEED = %08lu", &ProgrammerConfig.ProgrammingSpeed);
|
||||
}
|
||||
} while (CurrentLine);
|
||||
|
||||
|
||||
@@ -114,18 +114,15 @@ int main(void)
|
||||
{
|
||||
Programmer_Task();
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
if (USB_CurrentMode == USB_MODE_Host)
|
||||
{
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
DiskHost_USBTask();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
DiskDevice_USBTask();
|
||||
#endif
|
||||
}
|
||||
DiskHost_USBTask();
|
||||
#endif
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
if (USB_CurrentMode == USB_MODE_Device)
|
||||
DiskDevice_USBTask();
|
||||
#endif
|
||||
|
||||
USB_USBTask();
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
|
||||
bool DS1307_SetTimeDate(const TimeDate_t* NewTimeDate)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if !defined(DUMMY_RTC)
|
||||
DS1307_DateTimeRegs_t NewRegValues;
|
||||
const uint8_t WriteAddress = 0;
|
||||
|
||||
@@ -41,6 +38,7 @@ bool DS1307_SetTimeDate(const TimeDate_t* NewTimeDate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -55,10 +53,7 @@ bool DS1307_GetTimeDate(TimeDate_t* const TimeDate)
|
||||
TimeDate->Day = 1;
|
||||
TimeDate->Month = 1;
|
||||
TimeDate->Year = 1;
|
||||
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#else
|
||||
DS1307_DateTimeRegs_t CurrentRegValues;
|
||||
const uint8_t ReadAddress = 0;
|
||||
|
||||
@@ -78,6 +73,7 @@ bool DS1307_GetTimeDate(TimeDate_t* const TimeDate)
|
||||
TimeDate->Day = (CurrentRegValues.Byte5.Fields.TenDay * 10) + CurrentRegValues.Byte5.Fields.Day;
|
||||
TimeDate->Month = (CurrentRegValues.Byte6.Fields.TenMonth * 10) + CurrentRegValues.Byte6.Fields.Month;
|
||||
TimeDate->Year = (CurrentRegValues.Byte7.Fields.TenYear * 10) + CurrentRegValues.Byte7.Fields.Year;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user