Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HID: Zero-initialize pointer members #19

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/HID/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ bool HID_::setup(USBSetup& setup)
return false;
}

HID_::HID_(void) : PluggableUSBModule(2, 1, epType),
rootNode(NULL), descriptorSize(0),
protocol(HID_REPORT_PROTOCOL), idle(1)
HID_::HID_(void) : PluggableUSBModule(2, 1, epType)
{
epType[0] = EP_TYPE_INTERRUPT_IN;
epType[1] = EP_TYPE_INTERRUPT_OUT;
Expand Down
15 changes: 7 additions & 8 deletions src/HID/HID.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,19 @@ class HID_ : public PluggableUSBModule
private:
uint8_t epType[2];

HIDSubDescriptor* rootNode;
uint16_t descriptorSize;
HIDSubDescriptor* rootNode = nullptr;
uint16_t descriptorSize = 0;

uint8_t protocol;
uint8_t idle;
uint8_t protocol = HID_REPORT_PROTOCOL;
uint8_t idle = 1;

// Buffer pointer to hold the feature data
HIDReport* rootReport;
HIDReport* rootReport = nullptr;
uint16_t reportCount;

Serial_ *dbg;

const char *serial;
Serial_ *dbg = nullptr;

const char *serial = nullptr;
};

// Replacement for global singleton.
Expand Down