From b9e85edd39501b4ebb3320efd7f04f6bfcc729c1 Mon Sep 17 00:00:00 2001 From: Vitaliy Lyudvichenko Date: Wed, 8 Jul 2015 19:15:51 +0300 Subject: [PATCH] fixed sign type mismatch warnings in cnpy --- modules/dnn/test/cnpy.cpp | 4 ++-- modules/dnn/test/cnpy.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/dnn/test/cnpy.cpp b/modules/dnn/test/cnpy.cpp index b71aeab12..45abec6a4 100644 --- a/modules/dnn/test/cnpy.cpp +++ b/modules/dnn/test/cnpy.cpp @@ -65,7 +65,7 @@ void cnpy::parse_npy_header(FILE* fp, unsigned int& word_size, unsigned int*& sh std::string header = fgets(buffer,256,fp); assert(header[header.size()-1] == '\n'); - int loc1, loc2; + size_t loc1, loc2; //fortran order loc1 = header.find("fortran_order")+16; @@ -76,7 +76,7 @@ void cnpy::parse_npy_header(FILE* fp, unsigned int& word_size, unsigned int*& sh loc2 = header.find(")"); std::string str_shape = header.substr(loc1+1,loc2-loc1-1); if(str_shape[str_shape.size()-1] == ',') ndims = 1; - else ndims = std::count(str_shape.begin(),str_shape.end(),',')+1; + else ndims = (unsigned)std::count(str_shape.begin(),str_shape.end(),',')+1; shape = new unsigned int[ndims]; for(unsigned int i = 0;i < ndims;i++) { loc1 = str_shape.find(","); diff --git a/modules/dnn/test/cnpy.h b/modules/dnn/test/cnpy.h index 9886ec530..f6719ca8f 100644 --- a/modules/dnn/test/cnpy.h +++ b/modules/dnn/test/cnpy.h @@ -87,7 +87,7 @@ namespace cnpy { assert(tmp_dims == ndims); } - for(int i = 1; i < ndims; i++) { + for(unsigned i = 1; i < ndims; i++) { if(shape[i] != tmp_shape[i]) { std::cout<<"libnpy error: npy_save attempting to append misshaped data to "<