Re: Porting C programs written for AIX

"Aaron Albertson" <albertaa-r/[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <OFD3267508.32B04FBF-ON002580BC.005FA0B7-862580BC.006099CA@notes.na.collabserv.com>
Hi Jim,

'char *newformat[30];' is a declaration of an array of 30 character
pointers.  I would guess that the 'format' variable is either declared
similarly, or declared as a pointer to char pointer (char **).  It appears
that the code is trying to cast the pointer to a char pointer to get at the
first element of the array.  This shouldn't have even worked on AIX.
Without seeing the rest of the code for context I'm not sure what the
intended behavior here is, but I would say that at the error point it would
appear that they are trying to compare the first element of each array.  I
would recommend replacing the strcpy with something like this:

strcpy( newformat[0], format[0]);

That should get rid of the error.  Without seeing the rest of the code I'm
not sure whether it's the correct thing to do though...

Thanks,

Aaron Albertson


"C400-L" <c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]> wrote on 02/03/2017 09:56:44 AM:

> From: Jim Franz <[email protected]>
> To: c400-l-Zwy7GipZuJhWk0Htik3J/[email protected]
> Date: 02/03/2017 09:57 AM
> Subject: Re: [C400-L] Porting C programs written for AIX
> Sent by: "C400-L" <c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]>
>
> this is our include section (which I am seeing referenced with err
CZM0280)
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sqludf.h>
> #include "veapi.h"
> #include "vefpe.h"
>
> jim
>
> On Fri, Feb 3, 2017 at 10:35 AM, Jim Franz <[email protected]> wrote:
>
> > (previously posted in midrange-l with very little response)
> >
> > Working on a proof of concept project to port a aix implementation of C
(I
> > am told it is C, not C++ but wouldn't know the diff if it hit me in the
> > face..)
> >
> > Large multi platform company, we are the only Power i in the mix of AIX
> > and MS-SQL and .net.
> > The C code is an encryption package where we can all pass data back and
> > forth (and we do a lot of that)  but handle the encryption of sensitive
> > info. They have written C wrappers around a package of C from HP called
> > Voltage.
> > We have the source for the wrappers, but compiling the C on "i" not
> > working. We have solved the includes issues, but getting down to
messages
> > like line 47 :
> >
> >    39     1 |    int      status = 0;
> >                                               |
> >    40       |    char *newformat[30];
> >                                                            |
> >    41       |
> >                                        |
> >    42     2 | if (SQLUDF_NULL(text_ind) || SQLUDF_NULL(format_ind))
> > {                                          |
> >    43     3 |        *out_ind = -1;
> >                                                  |
> >    44     4 |        return;
> >                                                             |
> >    45       |    }
> >                                                                 |
> >    46       |
> >                                        |
> >    47     5 |    strcpy( newformat, (char *) format)
> > ;                                                         |
> >    47     5 +    (__strcpy((newformat),((char *) format)))
> > ;                                                   +
> >
===========> ..............a.............................................
> > ......................................
> > *=SEVERE==========> a - CZM0280  Function argument assignment between
> > types "char*" and "char**" is not allowed.
> >    48     6 |     if (strcmp( (char *) format, "ShortDate" ) == 0 )
> > {                                          |
> >    49     7 |         int result = 0;
> >                                               |
> >    50     8 |      result = GetYear(text);
> >                                                      |
> >
===========> ...............a............................................
> > ......................................
> > *=WARNING=========> a - CZM0304  No function prototype given for
> > "GetYear".
> >
> > IS there a conversion of source needed to ILE C?
> > Is line 40   char *newformat[30];    correct - I can't find anything
like
> > that in google...
> >
> > Thanks
> > Jim Franz
> >
> --
> This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-
> L) mailing list
> To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
>
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.