Esempio n. 1
0
//abandon
void initHashTable()
{
    inithashtab();

    char *filename = "signatureMd5";    //signature file name
    struct stat fstat;
    if (stat(filename, &fstat) != 0) {
        printf("No signature file : %s\n", filename);
        exit(1);
    }

    FILE *file = fopen(filename, "r");

    if (file != NULL) {
        char line[100];
        char version[100];
        while (fgets(line, sizeof line, file) != NULL) {        /* read a line */
            char md5[100];
            md5[0] = 0;         //let length of md5 is 0

            //get rid of empty line
            if ((int) line[0] == 10)
                continue;

            if (line[0] == 'v')
                strcpy(version, line + 1);
            else {
                strcpy(md5, line);
            }
            if (strlen(version) > 0 && strlen(md5) > 0) {
                insertToHashtable(md5, version);
                //printf("%s %s", md5, version);
            }
        }
        fclose(file);
    } else {
        perror(filename);       /* why didn't the file open? */
        return;
    }
}
Esempio n. 2
0
// Initializes variables for each image
int histo_reset(int nb_dct)
{
  inithashtab();
  return 0;
}