Aller au contenu

« Fonctionnement technique de Jeuxvideo.com » : différence entre les versions

Tabulation plus visible, includes
(JvCare Awk)
(Tabulation plus visible, includes)
Ligne 184 : Ligne 184 :
==== C ====
==== C ====


#include <stdlib.h>
#include <string.h>
  const char *__jvcarebase16 = "0A12B34C56D78E9F";
  const char *__jvcarebase16 = "0A12B34C56D78E9F";
   
   
  char *jvcare(const char *class) {
  char *jvcare(const char *class) {
  char *s = strchr(class, ' ') + 1;
    char *s = strchr(class, ' ') + 1;
   
   
  int urllen = strlen(s) / 2;
    int urllen = strlen(s) / 2;
  char *url = malloc(urllen + 1);
    char *url = malloc(urllen + 1);
  for (int i = 0; i < urllen; i++) {
    for (int i = 0; i < urllen; i++) {
    char pos1 = strchr(__jvcarebase16, s[i * 2]) - __jvcarebase16;
        char pos1 = strchr(__jvcarebase16, s[i * 2]) - __jvcarebase16;
    char pos2 = strchr(__jvcarebase16, s[i * 2 + 1]) - __jvcarebase16;
        char pos2 = strchr(__jvcarebase16, s[i * 2 + 1]) - __jvcarebase16;
    url[i] = pos1 * 16 + pos2;
        url[i] = pos1 * 16 + pos2;
  }
    }
  url[urllen] = '\0';
    url[urllen] = '\0';
  return url;
    return url;
  }
  }


4

modifications