Commit b0fee59003fbb314573bdb51865acc159d640d12

Authored by heziqi
1 parent c9fd97f0

convert long int to long long int

Showing 2 changed files with 6 additions and 12 deletions   Show diff stats
@@ -34,10 +34,9 @@ protected: @@ -34,10 +34,9 @@ protected:
34 34
35 //returns the file size 35 //returns the file size
36 // reads the file size from disk and returns it (in bytes) 36 // reads the file size from disk and returns it (in bytes)
37 - unsigned int get_file_size(){  
38 -  
39 - struct stat results;  
40 - if(stat(name.c_str(), &results) == 0) 37 + long long int get_file_size(){
  38 + struct _stat64 results;
  39 + if(_stat64(name.c_str(), &results) == 0)
41 return results.st_size; 40 return results.st_size;
42 else return 0; 41 else return 0;
43 } 42 }
@@ -45,10 +44,10 @@ protected: @@ -45,10 +44,10 @@ protected:
45 //make sure that the specified file size matches the file size on disk 44 //make sure that the specified file size matches the file size on disk
46 // returns true/false 45 // returns true/false
47 bool test_file_size(){ 46 bool test_file_size(){
48 - unsigned int npts = 1; //initialize the number of data points to 1 47 + long long int npts = 1; //initialize the number of data points to 1
49 for(unsigned int i = 0; i<D; i++) //iterate over each dimension 48 for(unsigned int i = 0; i<D; i++) //iterate over each dimension
50 npts *= R[i]; //compute the total number of data points in the file 49 npts *= R[i]; //compute the total number of data points in the file
51 - unsigned int datasize = npts * sizeof(T);//multiply the sum by the size of the template parameter 50 + long long int datasize = npts * sizeof(T);//multiply the sum by the size of the template parameter
52 51
53 if(datasize + header == get_file_size()) return true; //if the byte size matches the file size, we're golden 52 if(datasize + header == get_file_size()) return true; //if the byte size matches the file size, we're golden
54 else return false; //otherwise return an error 53 else return false; //otherwise return an error
@@ -618,12 +618,6 @@ public: @@ -618,12 +618,6 @@ public:
618 618
619 pi++; 619 pi++;
620 } 620 }
621 - //at this point, pi is an index to the mi'th valid pixel  
622 -  
623 - //load the next N valid pixels  
624 - //for(unsigned i = 0; i < N; i++){  
625 -  
626 - //}  
627 621
628 for(unsigned i = pi; i < pixels; i++){ 622 for(unsigned i = pi; i < pixels; i++){
629 if(mask[i] != 0){ 623 if(mask[i] != 0){
@@ -644,6 +638,7 @@ public: @@ -644,6 +638,7 @@ public:
644 std::cout << "number of valid pixels in the mask : " << count <<"is less than N: "<< N; 638 std::cout << "number of valid pixels in the mask : " << count <<"is less than N: "<< N;
645 exit(1); 639 exit(1);
646 } 640 }
  641 + free(p);
647 return true; 642 return true;
648 } 643 }
649 644