IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C Discussion :

Resolution de warnings


Sujet :

C

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2007
    Messages
    125
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 125
    Par défaut Resolution de warnings
    Bonjour tout le monde,

    j'ai reussi a avoir un programme "stable" dans les premières etapes de ce dernier.

    cependant mon programme ne fais pas exactement ce que je desire, comme il me reste encors des Warnings il ce peut que cela s'explique.

    je vous mets mes Warnings

    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
     
    Microchip MPLAB C30 License Manager Version v3.01 (Build Date Jun 11 2007).
    Copyright (c) 2005 Microchip Technology Inc. All rights reserved.
    The MPLAB C30 license has less than 14 days remaining.
    26_09_2007.c: In function 'lcp_rx_handler':
    26_09_2007.c:2367: warning: passing argument 1 of 'get_lword' from incompatible pointer type
    26_09_2007.c:2370: warning: passing argument 1 of 'put_lword' from incompatible pointer type
    26_09_2007.c: In function 'ipcp_rx_handler':
    26_09_2007.c:2475: warning: passing argument 1 of 'get_lword' from incompatible pointer type
    26_09_2007.c:2498: warning: passing argument 1 of 'put_lword' from incompatible pointer type
    26_09_2007.c:2509: warning: passing argument 1 of 'put_lword' from incompatible pointer type
    26_09_2007.c:2517: warning: passing argument 1 of 'get_lword' from incompatible pointer type
    26_09_2007.c: In function 'do_ipcp_actions':
    26_09_2007.c:2582: warning: passing argument 1 of 'put_lword' from incompatible pointer type
    26_09_2007.c: In function 'pap_rx_handler':
    26_09_2007.c:2606: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
    26_09_2007.c: In function 'pap_event_handler':
    26_09_2007.c:2635: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
    26_09_2007.c:2637: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness

    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
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
     
    BYTE clientname[12]="xxxxx";
    BYTE clientpass[12]="xxxxxx";
    BYTE serverid[] = "xxxxxxx";
    static DWORD hostip;
    static DWORD myip;
     
    typedef union
    {
       unsigned long lw;
       BYTE b[4];
    }
    LWORD;
     
     
    BOOL get_lword(LWORD *lwp)
    {
        BYTE n=4, b;
     
    #ifdef HI_TECH_C
        while (n && get_byte(&b))
            lwp->b[--n] = b;
        return(n==0);
    #else
        if (get_byte(&lwp->b[3]) && get_byte(&lwp->b[2]) &&
            get_byte(&lwp->b[1]) && get_byte(&lwp->b[0]))
            return(1);
        return(0);
    #endif
    }
     
    void put_lword(LWORD *lwp)
    {
     
        put_byte(lwp->b[3]);
        put_byte(lwp->b[2]);
        put_byte(lwp->b[1]);
        put_byte(lwp->b[0]);
     
    }
     
    void lcp_rx_handler(void)
    {
    ...
     
    ====>  if ((lcp_state&0xf) == PPP_OPENED && get_lword(&lw))
            {                                       // Get magic num
                lw++;                             // Return magic num + 1
     =======>           put_lword(&lw);
                copy_rx_tx(net_rxin-rxout);         // Echo the data
                send_ppp(PPP_ECHO_REP, ppp_rxid, 1);
            }                                       // Others to state machine..
     
    ...
    }
     
    void pap_event_handler(BYTE event)
    {
     
    .....
     
      if (client_auth)                        // If client authentication..
            {
                setpos_txin(PPP_HEADLEN);           // ..send ID and password
     ======>           put_byte(strlen(clientname));
                putrsUART(clientname);
     ======>           put_byte(strlen(clientpass));
                putrsUART(clientpass);
                send_ppp(PPP_CFG_REQ, ppp_txid, 1);
            }
    ....
     
    }

    j'essais de resoudre c'est warning mais... rien !!!
    pour les premiers warning ce n'est juste qu'une question de TYPE non ?
    mais pour les derniers je comprend pas trop.

    merci encors pour votre aide

  2. #2
    Expert éminent
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 68
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Par défaut
    Citation Envoyé par tiya17 Voir le message
    pour les premiers warning ce n'est juste qu'une question de TYPE non ?
    mais pour les derniers je comprend pas trop.

    merci encors pour votre aide
    Pour les premiers, c'est effectivement le type qui est incorrect. Pour le deuxième aussi. Je rappelle que strlen() attend un pointeur sur char (char *) et non sur unsigned char.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2007
    Messages
    125
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 125
    Par défaut
    m'en reste plus que 3 hihihi

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Microchip MPLAB C30 License Manager Version v3.01 (Build Date Jun 11 2007).
    Copyright (c) 2005 Microchip Technology Inc. All rights reserved.
    The MPLAB C30 license has less than 14 days remaining.
    26_09_2007.c: In function 'pap_rx_handler':
    26_09_2007.c:2607: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
    26_09_2007.c: In function 'pap_event_handler':
    26_09_2007.c:2636: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
    26_09_2007.c:2638: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness

    c'est bete je sais mais suis contant cette fois on m'a juste donner la voie....
    ;-)

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2007
    Messages
    125
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 125
    Par défaut
    voila plus qu'un warning,

    j'ai corriger les autre en faisant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    //BYTE clientname[12]="xxxxx";
    //BYTE clientpass[12]="xxxxxxx";
    //BYTE serverid[] = "xxxxxxx";
    char  clientname[12]="xxxxx;
    char  clientpass[12]="xxxxxx";
    char  serverid[50] = "xxxxx";
    mais c'est pas pour autant que mon programme a evoluer dans son exécution...lol.


    le dernier warning

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Microchip MPLAB C30 License Manager Version v3.01 (Build Date Jun 11 2007).
    Copyright (c) 2005 Microchip Technology Inc. All rights reserved.
    The MPLAB C30 license has less than 14 days remaining.
    26_09_2007.c: In function 'pap_rx_handler':
    26_09_2007.c:2611: warning: pointer targets in passing argument 1 of 'match_data' differ in signedness


    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
     
     
    BYTE match_data(BYTE *ptr, BYTE len)
    {
        BYTE b;
     
        while (len && get_byte(&b) && *ptr==b)
        {
            ptr++;
            len--;
        }
        if (len==0)
            return(1);
        return(0);
    }
     
    void pap_rx_handler(void)
    {
    ...
      ======>      if (match_data(serverid, strlen(serverid)))
            {
    ...
    je vois pas quel chemin prendre pour resoudre ce warning...

  5. #5
    Expert éminent
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 68
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Par défaut
    Citation Envoyé par tiya17 Voir le message
    voila plus qu'un warning,
    le dernier warning
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    26_09_2007.c: In function 'pap_rx_handler':
    26_09_2007.c:2611: warning: pointer targets in passing argument 1 of 'match_data' differ in signedness
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    BYTE match_data(BYTE *ptr, BYTE len)
    {
    <...>
     
    void pap_rx_handler(void)
    {
      ======>      if (match_data(serverid, strlen(serverid)))
            {
    Si j'en crois tes corrections, serverid est mainenant de type char*. Il faut donc que le 1er paramètre de match_data soit du même type :
    char * ou char const *. On l'a pas dit déjà ?

    Il faut passer plus de temps à réfléchir et moins de temps à poster dans les forums...

Discussions similaires

  1. Importance de la resolution des warning
    Par Seth77 dans le forum Langages de programmation
    Réponses: 4
    Dernier message: 03/02/2012, 15h40
  2. [langage] Récupérer des Warning ??
    Par armada dans le forum Langage
    Réponses: 2
    Dernier message: 05/06/2003, 16h45
  3. [warning][properties]problème de police introuvable
    Par cyrdec dans le forum API standards et tierces
    Réponses: 8
    Dernier message: 11/04/2003, 17h41
  4. [Kylix] Resolution e Kylix
    Par ulisse dans le forum EDI
    Réponses: 1
    Dernier message: 02/03/2003, 15h57
  5. Warnings lors de la compilation
    Par polo54 dans le forum C
    Réponses: 5
    Dernier message: 07/02/2003, 09h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo