Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit 4bb985d

Browse files
committedJun 21, 2018
Fix a bunch of cppcheck warnings
1 parent 68fc436 commit 4bb985d

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed
 

‎libapicore/httpServer.h

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class httpServer
77
{
88
public:
9+
httpServer() {};
910
void run(unsigned short port, dev::eth::Farm* farm, bool show_hwmonitors, bool show_power);
1011
void run_thread();
1112
void getstat1(stringstream& ss);

‎libdevcore/Exceptions.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace dev
3434
/// Base class for all exceptions.
3535
struct Exception: virtual std::exception, virtual boost::exception
3636
{
37-
Exception(std::string _message = std::string()): m_message(std::move(_message)) {}
37+
Exception(const std::string& _message = std::string()): m_message(std::move(_message)) {}
3838
const char* what() const noexcept override { return m_message.empty() ? std::exception::what() : m_message.c_str(); }
3939

4040
private:
@@ -44,7 +44,7 @@ struct Exception: virtual std::exception, virtual boost::exception
4444
#define DEV_SIMPLE_EXCEPTION(X) struct X: virtual Exception { const char* what() const noexcept override { return #X; } }
4545

4646
/// Base class for all RLP exceptions.
47-
struct RLPException: virtual Exception { RLPException(std::string _message = std::string()): Exception(_message) {} };
47+
struct RLPException: virtual Exception { RLPException(const std::string& _message = std::string()): Exception(_message) {} };
4848
#define DEV_SIMPLE_EXCEPTION_RLP(X) struct X: virtual RLPException { const char* what() const noexcept override { return #X; } }
4949

5050
DEV_SIMPLE_EXCEPTION_RLP(BadCast);
@@ -54,7 +54,7 @@ DEV_SIMPLE_EXCEPTION_RLP(UndersizeRLP);
5454

5555
DEV_SIMPLE_EXCEPTION(BadHexCharacter);
5656

57-
struct ExternalFunctionFailure: virtual Exception { public: ExternalFunctionFailure(std::string _f): Exception("Function " + _f + "() failed.") {} };
57+
struct ExternalFunctionFailure: virtual Exception { public: ExternalFunctionFailure(const std::string& _f): Exception("Function " + _f + "() failed.") {} };
5858

5959
// error information to be added to exceptions
6060
using errinfo_invalidSymbol = boost::error_info<struct tag_invalidSymbol, char>;

‎libethash-cl/CLMiner.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,11 @@ bool CLMiner::init(int epoch)
663663
try
664664
{
665665
program.build({device}, options);
666-
cwarn << "OpenCL kernel build log:\n"
667-
<< program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device);
668666
}
669667
catch (cl::BuildError const& buildErr)
670668
{
669+
cwarn << "OpenCL kernel build log:\n"
670+
<< program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device);
671671
cwarn << "OpenCL kernel build error (" << buildErr.err() << "):\n" << buildErr.what();
672672
return false;
673673
}

‎libethash-cuda/ethash_cuda_miner_kernel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void ethash_generate_dag(
8080

8181
struct cuda_runtime_error : public virtual std::runtime_error
8282
{
83-
cuda_runtime_error( std::string msg ) : std::runtime_error(msg) {}
83+
cuda_runtime_error( const std::string &msg ) : std::runtime_error(msg) {}
8484
};
8585

8686
#define CUDA_SAFE_CALL(call) \

‎libhwmon/wrapamdsysfs.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ wrap_amdsysfs_handle * wrap_amdsysfs_create()
110110

111111
// search hwmon
112112
errno = 0;
113-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/hwmon", sysfsIdx);
113+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/hwmon", sysfsIdx);
114114
DIR* dirp = opendir(dbuf);
115115
if (dirp == nullptr) {
116116
free(sysfsh);
@@ -179,7 +179,7 @@ wrap_amdsysfs_handle * wrap_amdsysfs_create()
179179

180180
int gpuindex = sysfsh->card_sysfs_device_id[i];
181181
char dbuf[120];
182-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/uevent", gpuindex);
182+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/uevent", gpuindex);
183183
std::ifstream ifs(dbuf, std::ios::binary);
184184
std::string line;
185185
int iBus = 0, iDevice = 0, iFunction = 0;
@@ -259,7 +259,7 @@ int wrap_amdsysfs_get_gpu_pci_id(wrap_amdsysfs_handle *sysfsh, int index, char *
259259
return -1;
260260

261261
char dbuf[120];
262-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/uevent", gpuindex);
262+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/uevent", gpuindex);
263263

264264
std::ifstream ifs(dbuf, std::ios::binary);
265265
std::string line;
@@ -287,7 +287,7 @@ int wrap_amdsysfs_get_tempC(wrap_amdsysfs_handle *sysfsh, int index, unsigned in
287287
return -1;
288288

289289
char dbuf[120];
290-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/hwmon/hwmon%u/temp1_input",
290+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/hwmon/hwmon%d/temp1_input",
291291
gpuindex, hwmonindex);
292292

293293
unsigned int temp = 0;
@@ -312,15 +312,15 @@ int wrap_amdsysfs_get_fanpcnt(wrap_amdsysfs_handle *sysfsh, int index, unsigned
312312
unsigned int pwm = 0, pwmMax = 255, pwmMin = 0;
313313

314314
char dbuf[120];
315-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/hwmon/hwmon%u/pwm1",
315+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/hwmon/hwmon%d/pwm1",
316316
gpuindex, hwmonindex);
317317
getFileContentValue(dbuf, pwm);
318318

319-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/hwmon/hwmon%u/pwm1_max",
319+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/hwmon/hwmon%d/pwm1_max",
320320
gpuindex, hwmonindex);
321321
getFileContentValue(dbuf, pwmMax);
322322

323-
snprintf(dbuf, 120, "/sys/class/drm/card%u/device/hwmon/hwmon%u/pwm1_min",
323+
snprintf(dbuf, 120, "/sys/class/drm/card%d/device/hwmon/hwmon%d/pwm1_min",
324324
gpuindex, hwmonindex);
325325
getFileContentValue(dbuf, pwmMin);
326326

@@ -337,7 +337,7 @@ int wrap_amdsysfs_get_power_usage(wrap_amdsysfs_handle* sysfsh, int index, unsig
337337
return -1;
338338

339339
char dbuf[120];
340-
snprintf(dbuf, 120, "/sys/kernel/debug/dri/%u/amdgpu_pm_info", gpuindex);
340+
snprintf(dbuf, 120, "/sys/kernel/debug/dri/%d/amdgpu_pm_info", gpuindex);
341341

342342
std::ifstream ifs(dbuf, std::ios::binary);
343343
std::string line;

0 commit comments

Comments
 (0)
This repository has been archived.