10 Commits 9be42ab24e ... 05f6ef0eb3

Author SHA1 Message Date
  Yifeng Li 05f6ef0eb3 nmmtl_shape.cpp: remove deprecated "register" keyword. 1 year ago
  Yifeng Li c691bf2351 nmmtl_genel.cpp: remove deprecated "register" keyword. 1 year ago
  Yifeng Li eccd4105e9 nmmtl_output_headers.cpp: mark userName as const. 1 year ago
  Yifeng Li 45a979d5f5 units.cpp: fix deletion of uninitialized pointer. 1 year ago
  Yifeng Li a31217f3e6 nmmtl_retrieve.cpp: fix incorrect format string. 1 year ago
  Yifeng Li 0569d87715 nmmtl_parse_xsctn.cpp: fix incorrect printf argument. 1 year ago
  Yifeng Li 569753ad9d nmmtl.cpp: fix missing argument in printf. 1 year ago
  Yifeng Li aac3b89bca nmmtl.cpp: fix incorrect format string. 1 year ago
  Yifeng Li 651699d92d math_library.cpp: fix incorrect format strings. 1 year ago
  Yifeng Li 6f91717174 nmmtl_spout_off.cpp: fix incorrect format strings. 1 year ago

+ 12 - 12
bem/src/math_library.cpp

@@ -155,7 +155,7 @@ void c_fft(int *n,COMPLEX *a,COMPLEX *c,int *status)
    if (ierr != 0)
    if (ierr != 0)
      {
      {
        (*status) = FAIL;
        (*status) = FAIL;
-       fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %ld.\n",ierr);
+       fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %d.\n",ierr);
        return;
        return;
      }
      }
    (*status) = SUCCESS;
    (*status) = SUCCESS;
@@ -225,7 +225,7 @@ void c_fft_inv(int *n,COMPLEX *a,COMPLEX *c,int *status)
   if (ierr != 0)
   if (ierr != 0)
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %ld.\n",ierr);
+      fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %d.\n",ierr);
       return;
       return;
     }
     }
   (*status) = SUCCESS;
   (*status) = SUCCESS;
@@ -447,7 +447,7 @@ void c_init_calc_eigenvalues(int *status)
 //    if (ierr != 0)
 //    if (ierr != 0)
 //      {
 //      {
 //        (*status) = FAIL;
 //        (*status) = FAIL;
-//        fprintf(stderr,"ELECTRO-F-EIGENINT Error on computing eigenvalues, NSWC code %ld\n",ierr);
+//        fprintf(stderr,"ELECTRO-F-EIGENINT Error on computing eigenvalues, NSWC code %d\n",ierr);
 //        return;
 //        return;
 //      }
 //      }
 
 
@@ -768,7 +768,7 @@ void c_invert_matrix(int *n,COMPLEX *a,COMPLEX *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
       return;
     }
     }
 
 
@@ -962,7 +962,7 @@ void invert_matrix(int *n,float *a,float *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
       return;
     }
     }
 
 
@@ -1049,7 +1049,7 @@ void invert_matrix_cond(int *n,float *a,float *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL ;
       (*status) = FAIL ;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
       return;
     }
     }
 
 
@@ -1246,7 +1246,7 @@ void d_invert_matrix(int *n,double *a,double *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
       return;
     }
     }
 
 
@@ -1408,7 +1408,7 @@ void c_solve_linear(int *n, COMPLEX *a, COMPLEX *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %d\n",ierr);
       return;
       return;
     }
     }
 
 
@@ -1623,7 +1623,7 @@ void d_c_solve_linear(int *n,DOUBLE_COMPLEX *a,DOUBLE_COMPLEX *b,
   if (ierr != 0) 
   if (ierr != 0) 
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %ld",ierr);
+      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %d",ierr);
       return;
       return;
     }
     }
 
 
@@ -1865,7 +1865,7 @@ void d_c_solve_linear(int *n,DOUBLE_COMPLEX *a,DOUBLE_COMPLEX *b,
 // 
 // 
 // 	{
 // 	{
 // 	  (*status) = FAIL;
 // 	  (*status) = FAIL;
-//	  fprintf(stderr,"ELECTRO-F-NONLININT Error in solution of nonlinear system, NSWC code %ld\n",info);
+//	  fprintf(stderr,"ELECTRO-F-NONLININT Error in solution of nonlinear system, NSWC code %d\n",info);
 // 	  return;
 // 	  return;
 // 	}
 // 	}
 //     }
 //     }
@@ -1941,7 +1941,7 @@ void lu_factor(int *n, float *a, float *lu, int *lda,
     if (info != 0)   
     if (info != 0)   
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %ld\n",info);
+      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %d\n",info);
       return;
       return;
     }
     }
 
 
@@ -2103,7 +2103,7 @@ void dlu_factor(int *n, double *a, double *lu, int *lda,
     if (info != 0)   
     if (info != 0)   
     {
     {
       (*status) = FAIL;
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %ld\n",status);
+      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %d\n",*status);
       return;
       return;
     }
     }
 
 

+ 2 - 2
bem/src/nmmtl.cpp

@@ -315,7 +315,7 @@ int main (int argc, char **argv)
 	    filename, cntr_seg, pln_seg, coupling);
 	    filename, cntr_seg, pln_seg, coupling);
     printf ("risetime: %g  conductivity: %g  frequency: %g\n",
     printf ("risetime: %g  conductivity: %g  frequency: %g\n",
 	    risetime, conductivity, frequency);
 	    risetime, conductivity, frequency);
-    printf ("half_min_dim: %g  grnd_planes: %d  top_grnd_thck: %d\n",
+    printf ("half_min_dim: %g  grnd_planes: %d  top_grnd_thck: %f\n",
 	    half_minimum_dimension, gnd_planes, top_ground_plane_thickness);
 	    half_minimum_dimension, gnd_planes, top_ground_plane_thickness);
     printf ("bot_grnd_thck: %g  num_sig: %d  num_grounds: %d\n",
     printf ("bot_grnd_thck: %g  num_sig: %d  num_grounds: %d\n",
 	    bottom_ground_plane_thickness, num_signals, num_grounds);
 	    bottom_ground_plane_thickness, num_signals, num_grounds);
@@ -357,7 +357,7 @@ int main (int argc, char **argv)
     sprintf (filespec, "%s.result", filename); 
     sprintf (filespec, "%s.result", filename); 
     if( (output_file1 = fopen(filespec,"w")) == NULL )
     if( (output_file1 = fopen(filespec,"w")) == NULL )
     {
     {
-      printf ("*** Could not open %s for output ***\n");
+      printf ("*** Could not open %s for output ***\n", filespec);
       return 0;  /* Fatal error; could not open output file */
       return 0;  /* Fatal error; could not open output file */
     }
     }
     
     

+ 1 - 1
bem/src/nmmtl_genel.cpp

@@ -137,7 +137,7 @@ int nmmtl_generate_elements(int conductor_counter,
   CIRCLE_SEGMENTS_P ccs;
   CIRCLE_SEGMENTS_P ccs;
   CELEMENTS_P head,tail,gnd_list,gnd_list_head = NULL;
   CELEMENTS_P head,tail,gnd_list,gnd_list_head = NULL;
   CELEMENTS_P gnd_plane_list_head = NULL;  
   CELEMENTS_P gnd_plane_list_head = NULL;  
-  register unsigned int node_point_counter_start;
+  unsigned int node_point_counter_start;
   int number_elements = 0;  
   int number_elements = 0;  
   char infostring[256];
   char infostring[256];
   
   

+ 2 - 2
bem/src/nmmtl_output_headers.cpp

@@ -75,7 +75,7 @@
 */
 */
 #ifndef HAVE_GETLOGIN
 #ifndef HAVE_GETLOGIN
 #include <stdlib.h>
 #include <stdlib.h>
-char *getlogin() {
+const char *getlogin() {
   char *name ;
   char *name ;
   name = getenv("USERNAME");
   name = getenv("USERNAME");
   if ( name == NULL ) {
   if ( name == NULL ) {
@@ -131,7 +131,7 @@ void nmmtl_output_headers(FILE *output_file,
   time_t tm ;
   time_t tm ;
 
 
   struct passwd *user_entry;
   struct passwd *user_entry;
-  char *userName;
+  const char *userName;
   static char nullString[] = "";
   static char nullString[] = "";
 
 
   // look up the user name 
   // look up the user name 

+ 1 - 1
bem/src/nmmtl_parse_xsctn.cpp

@@ -395,7 +395,7 @@ int nmmtl_parse_graphic(char *filename,
 	      /* count ground planes */
 	      /* count ground planes */
 	      printf ("**************************************************************\n");
 	      printf ("**************************************************************\n");
 	      printf ("* Warning: There are %d groundplanes in the design...reset to 2\n",
 	      printf ("* Warning: There are %d groundplanes in the design...reset to 2\n",
-		      gnd_planes);
+		      *gnd_planes);
 	      printf ("***************************************************************\n");
 	      printf ("***************************************************************\n");
 	      *gnd_planes = 2;	/* keep it at 2 */
 	      *gnd_planes = 2;	/* keep it at 2 */
 	    } 
 	    } 

+ 2 - 2
bem/src/nmmtl_retrieve.cpp

@@ -233,7 +233,7 @@ int nmmtl_retrieve(FILE *retrieve_file,
       }
       }
       for(i = 0; i < 3; i++)
       for(i = 0; i < 3; i++)
       {
       {
-	if(fscanf(retrieve_file,"%d %f %f\n",&ce->node[i],
+	if(fscanf(retrieve_file,"%d %lf %lf\n",&ce->node[i],
 		  &ce->xpts[i],&ce->ypts[i]) != 3) return(FAIL);
 		  &ce->xpts[i],&ce->ypts[i]) != 3) return(FAIL);
 	
 	
       }
       }
@@ -264,7 +264,7 @@ int nmmtl_retrieve(FILE *retrieve_file,
     
     
     for(i = 0; i < 3; i++)
     for(i = 0; i < 3; i++)
     {
     {
-      fscanf(retrieve_file,"%d %f %f\n",&die_elements->node[i],
+      fscanf(retrieve_file,"%d %lf %lf\n",&die_elements->node[i],
 	     &die_elements->xpts[i],&die_elements->ypts[i]);
 	     &die_elements->xpts[i],&die_elements->ypts[i]);
     }
     }
     if(fgets(line,255,retrieve_file) == NULL) return(FAIL);
     if(fgets(line,255,retrieve_file) == NULL) return(FAIL);

+ 5 - 5
bem/src/nmmtl_shape.cpp

@@ -112,10 +112,10 @@ COMPILATION ERROR ERROR ---      INTERP_PTS != 3       --- ERROR ERROR
 			  float nu0,
 			  float nu0,
 			  float nu1)
 			  float nu1)
 {
 {
-  register int i;
-  register double X,Y; /* interpolated points */
-  register double numerator,denominator;
-  register double deltax,deltay,factor;
+  int i;
+  double X,Y; /* interpolated points */
+  double numerator,denominator;
+  double deltax,deltay,factor;
   
   
   
   
   /* first get the ordinary shape function */
   /* first get the ordinary shape function */
@@ -415,7 +415,7 @@ void nmmtl_shape(double point,
 		 double *shape)
 		 double *shape)
 {
 {
   
   
-	register double L1,L2;
+	double L1,L2;
   
   
   
   
   /* shortcuts for the L1 and L2 used in Lagrangian polynomials evaluated at
   /* shortcuts for the L1 and L2 used in Lagrangian polynomials evaluated at

+ 2 - 2
bem/src/nmmtl_spout_off.cpp

@@ -66,8 +66,8 @@ void nmmtl_spout_off(float the_conductivity,
   minfreq = (long) (minimumFrequency/1e6 + 1.0) ;
   minfreq = (long) (minimumFrequency/1e6 + 1.0) ;
   printf ("%ld MHz is the minimum frequency for the surface current assumptions for this cross section\n", minfreq);
   printf ("%ld MHz is the minimum frequency for the surface current assumptions for this cross section\n", minfreq);
   if(output_file1 != NULL)
   if(output_file1 != NULL)
-    fprintf(output_file1,"Note: minimum frequency for surface current assumptions is %d MHz.", minfreq);
+    fprintf(output_file1,"Note: minimum frequency for surface current assumptions is %ld MHz.", minfreq);
   if(output_file2 != NULL)
   if(output_file2 != NULL)
-    fprintf(output_file2,"Note: minimum frequency for surface current assumptions is %d MHz.", minfreq);
+    fprintf(output_file2,"Note: minimum frequency for surface current assumptions is %ld MHz.", minfreq);
 }
 }
 
 

+ 2 - 1
bem/src/units.cpp

@@ -821,7 +821,8 @@ int conversion(char *from_string, char *to_string,
   {
   {
   char *remove_all_spaces(char *string);
   char *remove_all_spaces(char *string);
   char *local_from_string = strdup(from_string);
   char *local_from_string = strdup(from_string);
-  char *havestr, *wantstr;
+  char *havestr = nullptr;
+  char *wantstr = nullptr;
   struct unittype have, want;
   struct unittype have, want;
   double number;
   double number;
   int status;
   int status;