Skip to content

Commit

Permalink
Merge pull request #645 from JagMod/master
Browse files Browse the repository at this point in the history
cppcheck warnings, mostly class member initialization
  • Loading branch information
tschak909 authored Jul 27, 2023
2 parents 0af5aa7 + 3a84995 commit 822ad49
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 55 deletions.
10 changes: 5 additions & 5 deletions lib/ftp/fnFTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ class fnFTP
string hostname;

/* do STOR - file opened for write */
bool _stor;
bool _stor = false;

/* if to check control channel too while dealing with data channel */
bool _expect_control_response;
bool _expect_control_response = false;

/* FTP status code, taken from FTP server response */
int _statusCode;
Expand All @@ -137,12 +137,12 @@ class fnFTP
/**
* The fnTCP client used for control connection
*/
fnTcpClient *control;
fnTcpClient *control = nullptr;

/**
* The fnTCP client used for data connection
*/
fnTcpClient *data;
fnTcpClient *data = nullptr;

/**
* last response from control connection.
Expand All @@ -167,7 +167,7 @@ class fnFTP
/**
* The data port returned by EPSV
*/
unsigned short data_port;
unsigned short data_port = 0;

/**
* read and parse control response
Expand Down
2 changes: 1 addition & 1 deletion lib/hardware/fnUART.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UARTManager
private:
uart_port_t _uart_num;
QueueHandle_t _uart_q;
bool _initialized; // is UART ready?
bool _initialized = false; // is UART ready?

size_t _print_number(unsigned long n, uint8_t base);

Expand Down
16 changes: 8 additions & 8 deletions lib/http/fnHttpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ class fnHttpClient
typedef std::map<std::string,std::string> header_map_t;
typedef std::pair<std::string,std::string> header_entry_t;

char *_buffer; // Will be allocated to DEFAULT_HTTP_BUF_SIZE
int _buffer_pos;
int _buffer_len;
int _buffer_total_read;
char *_buffer = nullptr; // Will be allocated to DEFAULT_HTTP_BUF_SIZE
int _buffer_pos = 0;
int _buffer_len = 0;
int _buffer_total_read = 0;

TaskHandle_t _taskh_consumer = nullptr;
TaskHandle_t _taskh_subtask = nullptr;

bool _ignore_response_body = false;
bool _transaction_begin;
bool _transaction_done;
int _redirect_count;
int _max_redirects;
bool _transaction_begin = false;
bool _transaction_done = false;
int _redirect_count = 0;
int _max_redirects = 0;
bool connected = false;
esp_http_client_auth_type_t _auth_type;
esp_err_t _client_err;
Expand Down
6 changes: 3 additions & 3 deletions lib/meatloaf/device/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ friend class FlashIStream;
class FlashHandle {
public:
//int rc;
FILE* file_h;
FILE* file_h = nullptr;

FlashHandle()
{
Expand All @@ -110,7 +110,7 @@ class FlashHandle {
void dispose();

private:
int flags;
int flags = 0;
};


Expand Down Expand Up @@ -163,7 +163,7 @@ class FlashIStream: public MStream {
std::unique_ptr<FlashHandle> handle;

private:
size_t _size;
size_t _size = 0;
};


Expand Down
8 changes: 4 additions & 4 deletions lib/network-protocol/FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class NetworkProtocolFS : public NetworkProtocol
/**
* File size
*/
int fileSize;
int fileSize = 0;

/**
* Directory buffer
Expand All @@ -158,17 +158,17 @@ class NetworkProtocolFS : public NetworkProtocol
/**
* Is open file a directory?
*/
bool is_directory;
bool is_directory = false;

/**
* The mode of the open file
*/
uint16_t mode;
uint16_t mode = 0;

/**
* Is open file locked?
*/
bool is_locked;
bool is_locked = false;

/**
* @brief Open a file via path.
Expand Down
6 changes: 3 additions & 3 deletions lib/network-protocol/HTTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class NetworkProtocolHTTP : public NetworkProtocolFS
/**
* result code returned by an HTTP verb
*/
int resultCode;
int resultCode = 0;

/**
* Array of up to 32 headers
Expand All @@ -194,7 +194,7 @@ class NetworkProtocolHTTP : public NetworkProtocolFS
/**
* Collected headers count
*/
size_t collect_headers_count;
size_t collect_headers_count = 0;

/**
* Returned headers
Expand All @@ -209,7 +209,7 @@ class NetworkProtocolHTTP : public NetworkProtocolFS
/**
* Body size (fileSize is reset with this when DATA is engaged)
*/
int bodySize;
int bodySize = 0;

/**
* POST or PUT Data to send.
Expand Down
8 changes: 4 additions & 4 deletions lib/network-protocol/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NetworkProtocol
/**
* Pointer to passed in URL
*/
EdUrlParser *opened_url;
EdUrlParser *opened_url = nullptr;

/**
* ctor - Initialize network protocol object.
Expand All @@ -51,17 +51,17 @@ class NetworkProtocol
/**
* @brief number of bytes waiting
*/
unsigned short bytesWaiting;
unsigned short bytesWaiting = 0;

/**
* @brief Error code to return in status
*/
unsigned char error;
unsigned char error = 0;

/**
* Translation mode: 0=NONE, 1=CR, 2=LF, 3=CR/LF
*/
unsigned char translation_mode;
unsigned char translation_mode = 0;

/**
* Is this being called from inside an interrupt?
Expand Down
14 changes: 7 additions & 7 deletions lib/network-protocol/SMB.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,37 +189,37 @@ class NetworkProtocolSMB : public NetworkProtocolFS
/**
* SMB2 context
*/
struct smb2_context *smb;
struct smb2_context *smb = nullptr;

/**
* SMB2 URL
*/
struct smb2_url *smb_url;
struct smb2_url *smb_url = nullptr;

/**
* SMB2 directory handle
*/
struct smb2dir *smb_dir;
struct smb2dir *smb_dir = nullptr;

/**
* SMB2 directory entry
*/
struct smb2dirent *ent;
struct smb2dirent *ent = nullptr;

/**
* Last SMB error
*/
int smb_error;
int smb_error = 0;

/**
* The resulting file handle of open file.
*/
struct smb2fh *fh;
struct smb2fh *fh = nullptr;

/**
* Offset through file
*/
uint64_t offset;
uint64_t offset = 0;

/**
* @brief get status of file, filling in filesize. mount() must have already been called.
Expand Down
6 changes: 3 additions & 3 deletions lib/network-protocol/SSH.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ class NetworkProtocolSSH : public NetworkProtocol
/**
* Host Key Fingerprint
*/
unsigned char *fingerprint;
unsigned char *fingerprint = nullptr;

/**
* User Auth list
*/
const char *userauthlist;
const char *userauthlist = nullptr;

/**
* Intermediate RX buffer
*/
char *rxbuf;
char *rxbuf = nullptr;

/**
* Return if bytes available by injecting into RX buffer.
Expand Down
6 changes: 3 additions & 3 deletions lib/network-protocol/TNFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,17 @@ class NetworkProtocolTNFS : public NetworkProtocolFS
/**
* Last TNFS error
*/
int tnfs_error;
int tnfs_error = 0;

/**
* The create permissions of the open file
*/
uint16_t perms;
uint16_t perms = 0;

/**
* The resulting file handle of open file.
*/
int16_t fd;
int16_t fd = 0;

/**
* The TNFS filestat of the currently open file.
Expand Down
4 changes: 2 additions & 2 deletions lib/network-protocol/UDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ class NetworkProtocolUDP : public NetworkProtocol
/**
* UDP destination port
*/
unsigned short port;
unsigned short port = 0;

/**
* Do multicast write?
*/
bool multicast_write;
bool multicast_write = false;

/**
* @brief Set destination address
Expand Down
24 changes: 12 additions & 12 deletions lib/printer-emulator/pdf_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ class pdfPrinter : public printer_emu
{
protected:
// PDF THINGS
double pageWidth;
double pageHeight;
double leftMargin;
double pageWidth = 0.0;
double pageHeight = 0.0;
double leftMargin = 0.0;
double topMargin = 0.0;
double bottomMargin;
double printWidth;
double lineHeight;
double charWidth;
uint8_t fontNumber;
double fontSize;
double bottomMargin = 0.0;
double printWidth = 0.0;
double lineHeight = 0.0;
double charWidth = 0.0;
uint8_t fontNumber = 0;
double fontSize = 0.0;
uint8_t fontHorizScale = 100;
std::string shortname;
bool fontUsed[MAXFONTS] = {true}; // initialize first one to true, always use default font
Expand Down Expand Up @@ -64,9 +64,9 @@ class pdfPrinter : public printer_emu
void pdf_font_resource();
void pdf_xref();

size_t idx_stream_length; // file location of stream length indictor
size_t idx_stream_start; // file location of start of stream
size_t idx_stream_stop; // file location of end of stream
size_t idx_stream_length = 0; // file location of stream length indictor
size_t idx_stream_start = 0; // file location of start of stream
size_t idx_stream_stop = 0; // file location of end of stream

virtual void pdf_clear_modes() = 0;
virtual void pdf_handle_char(uint16_t c, uint8_t aux1, uint8_t aux2) = 0;
Expand Down

0 comments on commit 822ad49

Please sign in to comment.