Bytef & uLongf



  • was hat es mit Bytef und uLongf aufsich?
    ich kann dazu nirgens was finden ...



  • ich nehm an, dass das irgend welche typedefs sind. Wo hast du das aufgegriffen?

    wahrscheinlich sind die Typen so definiert

    typedef unsigned char Bytef;
    typedef unsigned long uLongf;
    

    wobei ich die Namen nicht wirklich schön finde 🙂



  • In einen beispiel code zur zlib.h nur leider lueft der noch nicht mit dev-cpp

    #include <stdio.h>
    #include <stdlib.h>
    #include <zlib.h>
    
    // My two function prototypes
    Bytef* mycompress(char *some_data);
    Bytef* myuncompress(Bytef *comdata);
    
    // It's supposed to accept a string and return compressed data
    Bytef* mycompress(char *some_data)
    {
    int result;
    
    unsigned char *uncomdata;
    uLong uncomdatalength;
    
    Bytef *comdata;
    comdata = malloc(512);
    unsigned long comdatalength;
    
    strcpy(uncomdata, some_data);
    
    uncomdatalength = strlen(uncomdata);
    
    result = compress(comdata,&comdatalength,(const Bytef*)uncomdata,uncomdatalength);
    
    return(comdata);
    }
    
    // Supposed to receive compressed data and return uncompressed data.
    Bytef* myuncompress(Bytef *comdata)
    {
    int result;
    
    Bytef *uncomdata;
    unsigned long uncomdatalength;
    
    uLong comdatalength;
    
    comdatalength = strlen(comdata);
    
    result = uncompress(uncomdata,&uncomdatalength,(const Bytef*)comdata,comdatalength);
    
    return(uncomdata);
    }
    
    int main()
    {
    int status;
    char some_data[] = "HHHHEEEEEELLLLLLLLLOOOOOOOOO WWWWWWWWWOOOOOOOORRRRRRRRLLLLLLLLDDDDDDDD";
    
    Bytef *uncomdata;
    Bytef *comdata;
    
    //Then this is where I call the two functions.
    comdata = mycompress(some_data);
    uncomdata = myuncompress(comdata);
    return 0;
    }
    

    allerdings erkennt der compiler diese typedefs an.



  • Hallo,

    witec schrieb:

    allerdings erkennt der compiler diese typedefs an

    na dann ist doch alles in Ordnung, oder 😕

    MfG


Anmelden zum Antworten