[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20011023: SFCCON now requires PRO=CONF (cont.)



>From: "Paul L. Sirvatka" <address@hidden>
>Organization: College of DuPage
>Keywords: 200109281354.f8SDsC118602 McIDAS-X 7.80 MAP SFCCON

Paul,

re: doesn't work or gives wrong projection
>The do not work. I get 
>Program Terminated, segmentation violation
>SFCCON:PTCON command failed

Damn!

>It does not default to mercator...even if I change the global keyword.

Hmm...  It should.

>I have maps defined in MAPS.SITE with the projection labelled CONF.
>
>Since it worked before the update, I can only assume that there is a bug
>in the code somewhere.
>
>So...let me know what you think.

I dug into the code and found my mistake: freeing a dynamically allocated
character array when I shouldn't have.

The change that I made is in:

~mcidas/mcidas7.8/src/mapcoord.c

In procedure 'mcgetdefaultprojstring_' (last procedure in the file), the line:

    free ( *proj );

from the block:

  rc = McGetDefaultProjString (map, proj);
  if ( rc == 0 ) {
    slen = strlen( *proj );
    nch  = (slen <= proj_len) ? slen : proj_len;
    (void) strncpy( map_proj, *proj, nch );
    free ( *proj );                            /* <- delete this line */
  }

should be deleted.  Then, ptcon.k needs to be remade and reinstalled:

cd ~mcidas/mcidas7.8/src

<edit the file mapcoord.c and remove the line 'free( *proj );' from the
procedure 'mcgetdefaultprojstring_'>

make libmcidas.a
make ptcon.k
rm ~/bin/ptcon.k
ln ptcon.k ~/bin

I will correct this routine in a new addendum after I finish adding a bunch
of modifications that finally make it possible to build using g77.

Sorry for the hassle.

Tom

>From address@hidden Tue Oct 23 10:58:08 2001
>To: "Paul L. Sirvatka" <address@hidden>
>Subject: 20011023: SFCCON now requires PRO=CONF (cont.) 

Paul,

Further testing of the mod I sent you in my previous email shows that I
_still_ have something wrong.  Until I get to the real problem, your
best bet is to specify the PRO= keyword on your SFCCON and RAOBCON
command lines.

I will let you know when I have a solid solution.

Again, sorry for the hassle.

Tom

>From address@hidden Tue Oct 23 10:58:08 2001
>To: "Paul L. Sirvatka" <address@hidden>
>Subject: 20011023: SFCCON now requires PRO=CONF (cont.) 
>Date: Tue, 23 Oct 2001 10:58:06 -0600

Paul,

Hopefully, third time is the charm.  Here are the changes that are
needed to the procedure 'mcgetdefaultprojstring_' in the file
~mcidas/mcidas7.8/src/mapcoord.c:

Fint
  mcgetdefaultprojstring_ (
    char              *map_name,
    char              *map_proj,
    FsLen              name_len,
    FsLen              proj_len)
{
  int    nch, slen;
  int    rc;
  char  *map;
  char  *proj;

  map = fsalloc (map_name, name_len);

  rc = McGetDefaultProjString (map, &proj);
  if ( rc == 0 ) {
    slen = strlen( proj );
    nch  = (slen <= proj_len) ? slen : proj_len;
    (void) strncpy( map_proj, proj, nch );
    free( proj );
  }

  free (map);

  return ((Fint) rc);
}

The code listed above should be used as a substitute for the
'mcgetdefaultprojstring_' code currently in mapccord.c.

I have tested the above code on my RedHat 7.1 Linux box, and it appears to
work correctly for a variety of cases.

The procedure for building a new ptcon.k is the same:

cd ~mcidas/mcidas7.8/src

<replace the 'mcgetdefaultprojstring_' code in  mapcoord.c with the code above>

make libmcidas.a
make ptcon.k
rm ~/bin/ptcon.k
ln ptcon.k ~/bin

Tom