Bonjour (bonsoir ?) à tous,

J'essayais de faire une matrice de t_pixel, mais gcc me retourne une erreur des plus classiques, sauf que je ne comprend pas où est le problème de typage...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
test.c: Dans la fonction «make_matrix» :
test.c:104: erreur: incompatible types in assignment
Alors en gros parmis les choses importantes à savoir c'est :

Mes types :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
[...]
typedef unsigned char   t_pixel[3];
typedef t_pixel         **t_pixmap;
ma structure s_picture
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
typedef struct          picture
{
[...] 
  t_pixmap              pixmap;
  int                   width;
  int                   height;
  FILE                  *fd;
}                       s_picture;
et ma fonction make_matrix bien entendu
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
void            make_matrix(s_picture           *pic)
{
  int           i, j;
  t_pixel       pixel;
 
  (*pic).pixmap = malloc(sizeof (t_pixel *) * (*pic).height);
  for (i = 0; i < (*pic).height; ++i)
  {
    (*pic).pixmap[i] = malloc(sizeof (t_pixel) * (*pic).width);
  }
 
  for (i = 0; i < (*pic).height; ++i)
  {
    for (j = 0; j < (*pic).width; ++j)
    {
      fread(&(pixel[B]), sizeof (char), 1, (*pic).fd);
      fread(&(pixel[G]), sizeof (char), 1, (*pic).fd);
      fread(&(pixel[R]), sizeof (char), 1, (*pic).fd);
      (*pic).pixmap[i][j] = pixel;  /* ceci est la ligne 104 */
    }
  }
C'est peut être l'heure mais je n'arrive pas à trouver où est le problème de typage...

Si quelqun pouvait m'apporter son aide, je ne me permettrait pas la refuser
Si jamais vous avez besoin d'autre chose (plus de code ? je pense avoir mit l'essentiel) n'hésitez pas à demander

Cordialement,

iLUV