From 4a9cccb4d46b90d08a8bfce56c76d886591e1561 Mon Sep 17 00:00:00 2001 From: Davis King Date: Fri, 30 Sep 2016 21:06:11 -0400 Subject: [PATCH] Minor changes to avoid warnings in visual studio 2015 --- dlib/array2d/array2d_kernel.h | 2 +- dlib/dnn/cuda_dlib.cu | 2 +- dlib/dnn/cuda_utils.h | 4 ++-- dlib/dnn/tensor.h | 2 +- dlib/matrix/matrix.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlib/array2d/array2d_kernel.h b/dlib/array2d/array2d_kernel.h index 5a3f418b2..3e2b1468c 100644 --- a/dlib/array2d/array2d_kernel.h +++ b/dlib/array2d/array2d_kernel.h @@ -72,7 +72,7 @@ namespace dlib - (*this)[x] == data[x] !*/ - friend class array2d; + friend class array2d; friend class row_helper; public: diff --git a/dlib/dnn/cuda_dlib.cu b/dlib/dnn/cuda_dlib.cu index c6e9a005e..ba78068e4 100644 --- a/dlib/dnn/cuda_dlib.cu +++ b/dlib/dnn/cuda_dlib.cu @@ -54,7 +54,7 @@ namespace dlib { int can_access; CHECK_CUDA(cudaDeviceCanAccessPeer(&can_access, device_id, peer_device_id)); - return can_access; + return can_access != 0; } bool can_access_peer (const tensor& device, const tensor& peer_device) { diff --git a/dlib/dnn/cuda_utils.h b/dlib/dnn/cuda_utils.h index bc96c0f95..f34d188db 100644 --- a/dlib/dnn/cuda_utils.h +++ b/dlib/dnn/cuda_utils.h @@ -131,8 +131,8 @@ namespace dlib struct max_jobs { - max_jobs(size_t n) : num(n) {} - size_t num; + max_jobs(int n) : num(n) {} + int num; }; template diff --git a/dlib/dnn/tensor.h b/dlib/dnn/tensor.h index 46e2506e9..60959013c 100644 --- a/dlib/dnn/tensor.h +++ b/dlib/dnn/tensor.h @@ -137,7 +137,7 @@ namespace dlib const matrix_exp& item ) { - DLIB_CASSERT(idx < num_samples()); + DLIB_CASSERT(idx < (unsigned long)num_samples()); DLIB_CASSERT(item.size() == nr()*nc()*k()); static_assert((is_same_type::value == true), "To assign a matrix to a tensor the matrix must contain float values"); diff --git a/dlib/matrix/matrix.h b/dlib/matrix/matrix.h index 4b7b29801..542b11490 100644 --- a/dlib/matrix/matrix.h +++ b/dlib/matrix/matrix.h @@ -1751,7 +1751,7 @@ namespace dlib literal_assign_helper(const literal_assign_helper& item) : m(item.m), r(item.r), c(item.c), has_been_used(false) {} explicit literal_assign_helper(matrix* m_): m(m_), r(0), c(0),has_been_used(false) {next();} - ~literal_assign_helper() throw (std::exception) + ~literal_assign_helper() noexcept(false) { DLIB_CASSERT(!has_been_used || r == m->nr(), "You have used the matrix comma based assignment incorrectly by failing to\n" @@ -1778,7 +1778,7 @@ namespace dlib private: - friend class matrix; + friend class matrix; void next ( ) const