problem compiling eventlog.idl NDR code

James Peach jpeach at sgi.com
Fri Sep 9 01:49:41 GMT 2005


Hi all,

I'm having a problem compiling ndr_eventlog.c, and it's not immediately
apparant to me whether the generated code is correct.

In eventlog.idl, we have 

    35          typedef [public] struct {
    ...
    54                  nstring strings[num_of_strings];
    55                  astring raw_data;
    56          } eventlog_Record;

which generates a structure definition in eventlog.h:

    27  struct eventlog_Record {
    ...
    46          const char * strings;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
    47          const char * raw_data;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
    48  }/* [public] */;


Now, we run into a problem in ndr_eventlog.c:

    77  for (cntr_strings_0 = 0; cntr_strings_0 < r->num_of_strings; cntr_s trings_0++) {
    78          NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->strings[cntr _strings_0]));
    79  }
   ...
   134  for (cntr_strings_0 = 0; cntr_strings_0 < r->num_of_strings; cntr_s trings_0++) {
   135          NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->strings[cnt r_strings_0]));
   136  }
   ...
   180 if (idx_0) {
   181         ndr_print_string(ndr, "strings", r->strings[cntr_strings_0]);
   182         free(idx_0);
   183 }

These sections of code lead to the following compilation problems:

Compiling librpc/gen_ndr/ndr_eventlog.c
cc-1164 cc: ERROR File = librpc/gen_ndr/ndr_eventlog.c, Line = 78
  Argument of type "char" is incompatible with parameter of type "const char *".
	NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->strings[cntr_strings_0]));
                                ^

cc-1164 cc: WARNING File = librpc/gen_ndr/ndr_eventlog.c, Line = 135
  Argument of type "const char *" is incompatible with parameter of type
          "const char **".
	NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->strings[cntr_strings_0]));
                                ^

cc-1164 cc: ERROR File = librpc/gen_ndr/ndr_eventlog.c, Line = 181
  Argument of type "char" is incompatible with parameter of type "const char *".
	ndr_print_string(ndr, "strings", r->strings[cntr_strings_0]);
                                                         ^

So what's the right thing here? Is the strings member of struct
eventlog_Record supposed to be a char * or an array of char *?

-- 
James Peach | jpeach at sgi.com | SGI Australian Software Group
I don't speak for SGI.


More information about the samba-technical mailing list