浏览代码

iostream: reduce compiler warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74218 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 6 年之前
父节点
当前提交
26ac4179f0

+ 3 - 3
include/iostream/ami_sort_impl.h

@@ -101,7 +101,7 @@ template<class T, class Compare>
 size_t makeRun_Block(AMI_STREAM<T> *instream, T* data, 
 		   unsigned int run_size, Compare *cmp) {
   AMI_err err;
-  off_t new_run_size;
+  off_t new_run_size = 0;
 
   //read next run from input stream
   err = instream->read_array(data, run_size, &new_run_size); 
@@ -256,7 +256,7 @@ runFormation(AMI_STREAM<T> *instream, Compare *cmp) {
       delete str;
     }
 
-  };
+  }
   SDEBUG MM_manager.print();
   //release the run memory!
   delete [] data;
@@ -265,7 +265,7 @@ runFormation(AMI_STREAM<T> *instream, Compare *cmp) {
   SDEBUG MM_manager.print();
 
   return runList;
-};
+}
 
 
 

+ 21 - 21
include/iostream/ami_stream.h

@@ -315,7 +315,7 @@ AMI_STREAM<T>::AMI_STREAM(const char *path_name, AMI_stream_type st) {
   //size_t usage; 
   //main_memory_usage(&usage,  MM_STREAM_USAGE_CURRENT);
   //MM_manager.register_allocation(usage);
-};
+}
 
 
 
@@ -378,7 +378,7 @@ AMI_err AMI_STREAM<T>::new_substream(AMI_stream_type st,
   //*sub_stream = (AMI_base_stream < T > *)substr;
   *sub_stream = substr;
   return  AMI_ERROR_NO_ERROR;
-};
+}
 
 
 
@@ -417,8 +417,8 @@ off_t AMI_STREAM<T>::stream_len(void) {
 
   return (st_size / sizeof(T));
 #else
-  struct stat buf;
-  if (stat(path, &buf) == -1) {
+  struct stat statbuf;
+  if (stat(path, &statbuf) == -1) {
     perror("AMI_STREAM::stream_len(): fstat failed ");
     DEBUG_ASSERT assert(0);
     exit(1);
@@ -426,11 +426,11 @@ off_t AMI_STREAM<T>::stream_len(void) {
 
   //debug stream_len:
   DEBUG_STREAM_LEN fprintf(stderr, "%s: length = %lld   sizeof(T)=%lud\n",
-	  path, (long long int)buf.st_size, sizeof(T));
+	  path, (long long int)statbuf.st_size, sizeof(T));
 
-  return (buf.st_size / sizeof(T));
+  return (statbuf.st_size / sizeof(T));
 #endif
-};
+}
 
 
 
@@ -443,14 +443,14 @@ AMI_err AMI_STREAM<T>::name(char **stream_name)  {
   strcpy(*stream_name, path);
   
   return AMI_ERROR_NO_ERROR;
-};
+}
 
 // Return the path name of this stream.
 template<class T>
 const char *
 AMI_STREAM<T>::name() const {
   return path;
-};
+}
 
 
 
@@ -508,7 +508,7 @@ AMI_STREAM<T>::main_memory_usage(size_t *usage, MM_stream_usage usage_type) {
      break;
    }
    return AMI_ERROR_NO_ERROR;
-};
+}
 
 
 
@@ -534,7 +534,7 @@ AMI_STREAM<T>::~AMI_STREAM(void)  {
   //size_t usage; 
   //main_memory_usage(&usage,  MM_STREAM_USAGE_CURRENT);
   //MM_manager.register_deallocation(usage);
- };
+ }
 
 
 
@@ -563,7 +563,7 @@ AMI_err AMI_STREAM<T>::read_item(T **elt)  {
     *elt = &read_tmp;
     return AMI_ERROR_NO_ERROR; 
   }
-};
+}
 
 
 
@@ -596,7 +596,7 @@ AMI_err AMI_STREAM<T>::read_array(T *data, off_t len, off_t *lenp) {
     if(lenp) *lenp = nobj;
     return AMI_ERROR_NO_ERROR; 
   }
-};
+}
 
 
 
@@ -623,7 +623,7 @@ AMI_err AMI_STREAM<T>::write_item(const T &elt) {
 
     return AMI_ERROR_NO_ERROR;
   }
-};
+}
 
 
 /**********************************************************************/
@@ -649,14 +649,14 @@ AMI_err AMI_STREAM<T>::write_array(const T *data, off_t len) {
     }
    return AMI_ERROR_NO_ERROR;
   }
-};
+}
         
 
 /**********************************************************************/
 template<class T>
 void AMI_STREAM<T>::persist(persistence p)  {
   per = p;
-};
+}
 
 
 
@@ -669,16 +669,16 @@ void AMI_STREAM<T>::persist(persistence p)  {
 // if you are careful.
 template<class T>
 char *AMI_STREAM<T>::sprint()  {
-  static char buf[BUFSIZ];
-  sprintf(buf, "[AMI_STREAM %s %ld]", path, (long)stream_len());
-  return buf;
-};
+  static char desc[BUFSIZ];
+  sprintf(desc, "[AMI_STREAM %s %ld]", path, (long)stream_len());
+  return desc;
+}
 
 /**********************************************************************/
 template<class T>
 int AMI_STREAM<T>::eof()  {
   return eof_reached;
-};
+}
 
 
 #endif // _AMI_STREAM_H 

+ 5 - 5
include/iostream/embuffer.h

@@ -487,12 +487,12 @@ em_buffer<T,Key>::em_buffer(const unsigned short i, const unsigned long bs,
   
   //initialize the <arity> streams to NULL, deleted[], streamsize[]
   //and name[]
-  for (unsigned int i=0; i< arity; i++) {
-    data[i] = NULL;
-    deleted[i] = 0;
-    streamsize[i] = 0;
+  for (unsigned int ui=0; ui< arity; ui++) {
+    data[ui] = NULL;
+    deleted[ui] = 0;
+    streamsize[ui] = 0;
 #ifdef SAVE_MEMORY
-    name[i] = NULL;
+    name[ui] = NULL;
 #endif
   }   
   //set index

+ 11 - 11
include/iostream/empq_adaptive_impl.h

@@ -75,7 +75,7 @@ EMPQueueAdaptive<T,Key>::EMPQueueAdaptive(size_t inMem) {
 		    << ( (float)inMem/ (1<< 20)) << "MB" << endl;
   
   initPQ(inMem);
-};
+}
 
 
 //------------------------------------------------------------
@@ -97,7 +97,7 @@ EMPQueueAdaptive<T,Key>::EMPQueueAdaptive() {
 
   initPQ(mm_avail);
 
-};
+}
 
 
 //------------------------------------------------------------
@@ -160,7 +160,7 @@ EMPQueueAdaptive<T,Key>::initPQ(size_t initMem) {
   im = new MinMaxHeap<T>(pqsize);
   assert(im);
   em = NULL;
-};
+}
 
 
 template<class T, class Key> 
@@ -177,7 +177,7 @@ EMPQueueAdaptive<T,Key>::~EMPQueueAdaptive() {
 	delete em; 
 	break;
   }
-};
+}
 
 
 
@@ -200,7 +200,7 @@ EMPQueueAdaptive<T,Key>::maxlen() const {
 	break;
   }
   return m;
-};
+}
 
 
 
@@ -225,7 +225,7 @@ EMPQueueAdaptive<T,Key>::is_empty() const {
 	break;
   }
   return v;
-};
+}
 
 
 //return true if full
@@ -273,7 +273,7 @@ EMPQueueAdaptive<T,Key>::min(T& elt) {
 	break;
   }
   return v;
-};
+}
 
 /* switch over to using an external priority queue */
 template<class T, class Key> 
@@ -332,7 +332,7 @@ EMPQueueAdaptive<T,Key>::extract_all_min(T& elt) {
 	break;
   }
   return v;
-};
+}
 
 //return the nb of elements in the structure 
 template<class T, class Key> 
@@ -384,7 +384,7 @@ EMPQueueAdaptive<T,Key>::extract_min(T& elt) {
 	  break;
     }
 	return v;
-};
+}
  
 
 
@@ -418,7 +418,7 @@ EMPQueueAdaptive<T,Key>::insert(const T& elt) {
 	break;
   }
   return v;
-};
+}
 
 template<class T, class Key> 
 void
@@ -507,6 +507,6 @@ EMPQueueAdaptive<T,Key>::makeExternal() {
 #ifndef NDEBUG
   assert(sizeCheck == size());
 #endif
-};
+}
 
 #endif

+ 1 - 1
include/iostream/empq_impl.h

@@ -1009,7 +1009,7 @@ bool em_pqueue<T,Key>::insert(const T& x) {
   }
   if (!pq->empty()) {
     T pqmax;
-    bool ok;
+
     ok = pq->max(pqmax);
     assert(ok);
     // cout << "insert " << x << " max: " << pqmax << "\n";

+ 7 - 7
include/iostream/mem_stream.h

@@ -83,7 +83,7 @@ MEM_STREAM<T>::MEM_STREAM(T *datap, int lenv) {
   curr = datap;
   len = lenv;
 
-};
+}
 
 
 /**********************************************************************/
@@ -93,7 +93,7 @@ off_t MEM_STREAM<T>::stream_len(void) {
 
   return len;
 
-};
+}
 
 
 
@@ -108,7 +108,7 @@ AMI_err MEM_STREAM<T>::name(char **stream_name)  {
   strcpy(*stream_name, path);
 
   return AMI_ERROR_NO_ERROR;
-};
+}
 
 
 /**********************************************************************/
@@ -128,7 +128,7 @@ AMI_err MEM_STREAM<T>::seek(off_t offset) {
 /**********************************************************************/
 template<class T>
 MEM_STREAM<T>::~MEM_STREAM(void)  {
-};
+}
 
 
 
@@ -144,7 +144,7 @@ AMI_err MEM_STREAM<T>::read_item(T **elt)  {
   *elt = curr;
   curr++;
   return AMI_ERROR_NO_ERROR;
-};
+}
 
 
 
@@ -162,7 +162,7 @@ AMI_err MEM_STREAM<T>::write_item(const T &elt) {
   *curr = elt;
   curr++;
   return AMI_ERROR_NO_ERROR;
-};
+}
 
 
 /**********************************************************************/
@@ -177,6 +177,6 @@ char *MEM_STREAM<T>::sprint()  {
   static char buf[BUFSIZ];
   sprintf(buf, "[MEM_STREAM %d]", stream_len());
   return buf;
-};
+}
 
 #endif // _MEM_STREAM_H