LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C code: error: incompatible types in assignment (https://www.linuxquestions.org/questions/programming-9/c-code-error-incompatible-types-in-assignment-507302/)

hedpe 12-04-2006 02:42 AM

C code: error: incompatible types in assignment
 
Hey,

I am trying to fix an incompatible types in assignment error, and I can't quite figure it out.

Here is where the error comes from:
Code:

curr_cap_header->markings[curr_marking] = (u8) 0;
Here is the related code
Code:

void create_capability_header(char *buffer, unsigned short buffer_size);

struct iphdr *ip_header;
pubkey_token *token_key;
bcap_token_hdr *token_header;
secflow_capability *curr_cap_header;

struct udphdr *udp_header;

char *currpos;

void create_capability_header(char *buffer, unsigned short buffer_size) {
        int curr_marking;
        curr_cap_header = (secflow_capability *) currpos;
        curr_cap_header->id = 1;
        curr_cap_header->prioclass = 0;
        curr_cap_header->cur_router = 1;

        for(curr_marking=0; curr_marking < MAXPATHLEN; curr_marking++) {
                curr_cap_header->markings[curr_marking] = (u8) 0;
        }

        currpos = (char *)curr_cap_header + sizeof(secflow_capability);
}

Code:

typedef struct t_secflow_marking{
  u8 marking;
} secflow_marking;

typedef struct t_secflow_capability{
  u32 id;
  u16 prioclass;
  u16 cur_router;
  secflow_marking markings[MAXPATHLEN];
}secflow_capability;

I'd appreciate any help... thanks!

- George

vkmgeek 12-04-2006 06:58 AM

I dont see anything wrong here.
Just give me how u8 is type defined?

rstewart 12-04-2006 10:30 AM

Quote:

curr_cap_header->markings[curr_marking] = (u8) 0;
Shouldn't your code be:
Code:

curr_cap_header->markings[curr_marking].marking = (u8) 0;


All times are GMT -5. The time now is 06:47 PM.