* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
#ifdef USE_METALINK
#include <sys/stat.h>
+#include <stdlib.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
# error "Can't compile METALINK support without a crypto library."
#endif
-#include "rawstr.h"
-
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
static unsigned char hex_to_uint(const char *s)
{
- int v[2];
- int i;
- for(i = 0; i < 2; ++i) {
- v[i] = Curl_raw_toupper(s[i]);
- if('0' <= v[i] && v[i] <= '9') {
- v[i] -= '0';
- }
- else if('A' <= v[i] && v[i] <= 'Z') {
- v[i] -= 'A'-10;
- }
- }
- return (unsigned char)((v[0] << 4) | v[1]);
+ char buf[3];
+ unsigned long val;
+ buf[0] = s[0];
+ buf[1] = s[1];
+ buf[2] = 0;
+ val = strtoul(buf, NULL, 16);
+ return (unsigned char)(val&0xff);
}
/*
++digest_alias) {
metalink_checksum_t **p;
for(p = fileinfo->checksums; *p; ++p) {
- if(Curl_raw_equal(digest_alias->alias_name, (*p)->type) &&
+ if(curl_strequal(digest_alias->alias_name, (*p)->type) &&
check_hex_digest((*p)->hash, digest_alias->digest_def)) {
f->checksum =
new_metalink_checksum_from_hex_digest(digest_alias->digest_def,
metainfo file URL may be appeared in fileinfo->metaurls.
*/
if((*p)->type == NULL ||
- Curl_raw_equal((*p)->type, "http") ||
- Curl_raw_equal((*p)->type, "https") ||
- Curl_raw_equal((*p)->type, "ftp") ||
- Curl_raw_equal((*p)->type, "ftps")) {
+ curl_strequal((*p)->type, "http") ||
+ curl_strequal((*p)->type, "https") ||
+ curl_strequal((*p)->type, "ftp") ||
+ curl_strequal((*p)->type, "ftps")) {
res = new_metalink_resource((*p)->url);
tail->next = res;
tail = res;
if(!*ptr) {
return 0;
}
- return Curl_raw_nequal(ptr, media_type, media_type_len) &&
+ return curl_strnequal(ptr, media_type, media_type_len) &&
(*(ptr+media_type_len) == '\0' || *(ptr+media_type_len) == ' ' ||
*(ptr+media_type_len) == '\t' || *(ptr+media_type_len) == ';');
}