pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i think it's time for version 1.0
[smdp.git]
/
src
/
url.c
diff --git
a/src/url.c
b/src/url.c
index
1aa2de6
..
18b7397
100644
(file)
--- a/
src/url.c
+++ b/
src/url.c
@@
-1,6
+1,6
@@
/*
* Functions necessary to handle pandoc URLs.
/*
* Functions necessary to handle pandoc URLs.
- * Copyright (C) 201
4
Michael Goehler
+ * Copyright (C) 201
5
Michael Goehler
*
* This file is part of mdp.
*
*
* This file is part of mdp.
*
@@
-21,7
+21,7
@@
#include <stdlib.h>
#include <assert.h>
#include <stdlib.h>
#include <assert.h>
-#include <
string
.h>
+#include <
wchar
.h>
#include <stdio.h>
#include "url.h"
#include <stdio.h>
#include "url.h"
@@
-39,7
+39,7
@@
void url_init(void) {
init_ok = 1;
}
init_ok = 1;
}
-int url_add(const
char *link_name, int link_name_length, const char
*target, int target_length, int x, int y) {
+int url_add(const
wchar_t *link_name, int link_name_length, const wchar_t
*target, int target_length, int x, int y) {
if (!init_ok) return -1;
url_t *tmp = NULL;
if (!init_ok) return -1;
url_t *tmp = NULL;
@@
-60,14
+60,14
@@
int url_add(const char *link_name, int link_name_length, const char *target, int
assert(tmp);
}
assert(tmp);
}
- tmp -> link_name = calloc(link_name_length+1, sizeof(
char
));
+ tmp -> link_name = calloc(link_name_length+1, sizeof(
wchar_t
));
assert(tmp->link_name);
assert(tmp->link_name);
-
str
ncpy(tmp->link_name, link_name, link_name_length);
+
wcs
ncpy(tmp->link_name, link_name, link_name_length);
tmp->link_name[link_name_length] = '\0';
tmp->link_name[link_name_length] = '\0';
- tmp->target = calloc(target_length+1, sizeof(
char
));
+ tmp->target = calloc(target_length+1, sizeof(
wchar_t
));
assert(tmp->target);
assert(tmp->target);
-
str
ncpy(tmp->target, target, target_length);
+
wcs
ncpy(tmp->target, target, target_length);
tmp->target[target_length] = '\0';
tmp->x = x;
tmp->target[target_length] = '\0';
tmp->x = x;
@@
-79,7
+79,7
@@
int url_add(const char *link_name, int link_name_length, const char *target, int
return index_max-1;
}
return index_max-1;
}
-
char
* url_get_target(int index) {
+
wchar_t
* url_get_target(int index) {
if (!init_ok) return NULL;
url_t *tmp = list;
if (!init_ok) return NULL;
url_t *tmp = list;
@@
-96,7
+96,7
@@
char * url_get_target(int index) {
} else return NULL;
}
} else return NULL;
}
-
char
* url_get_name(int index) {
+
wchar_t
* url_get_name(int index) {
url_t *tmp = list;
while (index > 0 && tmp && tmp->next) {
url_t *tmp = list;
while (index > 0 && tmp && tmp->next) {
@@
-158,9
+158,9
@@
int url_get_amount(void) {
return index_max;
}
return index_max;
}
-int url_count_inline(const
char
*line) {
+int url_count_inline(const
wchar_t
*line) {
int count = 0;
int count = 0;
- const
char
*i = line;
+ const
wchar_t
*i = line;
for (; *i; i++) {
if (*i == '\\') {
for (; *i; i++) {
if (*i == '\\') {
@@
-168,9
+168,9
@@
int url_count_inline(const char *line) {
} else if ( *i == '[' && *(i+1) != ']') {
while (*i && *i != ']') i++;
i++;
} else if ( *i == '[' && *(i+1) != ']') {
while (*i && *i != ']') i++;
i++;
- if (*i == '(' &&
str
chr(i, ')')) {
+ if (*i == '(' &&
wcs
chr(i, ')')) {
count ++;
count ++;
- i =
str
chr(i, ')');
+ i =
wcs
chr(i, ')');
}
}
}
}
}
}
@@
-178,9
+178,9
@@
int url_count_inline(const char *line) {
return count;
}
return count;
}
-int url_len_inline(const
char *text
) {
+int url_len_inline(const
wchar_t *value
) {
int count = 0;
int count = 0;
- const
char *i = text
;
+ const
wchar_t *i = value
;
for (; *i; i++) {
if (*i == '\\') {
for (; *i; i++) {
if (*i == '\\') {
@@
-188,7
+188,7
@@
int url_len_inline(const char *text) {
} else if ( *i == '[' && *(i+1) != ']') {
while (*i && *i != ']') i++;
i++;
} else if ( *i == '[' && *(i+1) != ']') {
while (*i && *i != ']') i++;
i++;
- if (*i == '(' &&
str
chr(i, ')')) {
+ if (*i == '(' &&
wcs
chr(i, ')')) {
while (*i && *i != ')') {
count++;
i++;
while (*i && *i != ')') {
count++;
i++;