Commit 6e630c0f authored by Gabriel Genois's avatar Gabriel Genois

from school. wide char error on string. Can't count items for precisions. Need more work

parent db55faa4
Pipeline #101 failed with stages
in 27 seconds
......@@ -6,7 +6,7 @@
/* By: ggenois <ggenois@student.le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/05/19 16:03:09 by ggenois #+# ## ## #+# */
/* Updated: 2018/11/05 00:29:58 by ggenois ### #+. /#+ ###.fr */
/* Updated: 2018/11/08 16:50:58 by ggenois ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
......@@ -196,7 +196,7 @@ int main(int argc, char **argv)
//ft_putchar('\n');
//ft_putnbr(i);
//ft_putchar('\n');
i = ft_printf("%S", L"米");
i = ft_printf("%S", L"米米米米");
ft_putchar('\n');
//i = ft_printf("% h");
//ft_putchar('\n');
......
......@@ -15,22 +15,18 @@ int ftpf_getwcharlen(wchar_t wchar)
return (0);
else if (wchar <= 0x7f)
{
ft_putstr("wsize:1\n");
return (1);
}
else if (wchar <= 0x7ff)
{
ft_putstr("wsize:2\n");
return (2);
}
else if (wchar <= 0xffff)
{
ft_putstr("wsize:3\n");
return (3);
}
else
{
ft_putstr("wsize:4\n");
return (4);
}
}
......@@ -72,7 +68,7 @@ int ft_lstfromwchar(t_pfdata **dt, wchar_t *item)
int ilenght;
char *buffer;
wchar_t tmp;
char c;
ilenght = 0;
if(!item)
......@@ -90,14 +86,7 @@ int ft_lstfromwchar(t_pfdata **dt, wchar_t *item)
{
tmp = *(--item);
buffer = ftpf_charfromwchar(tmp);
//write(0, &buffer, ftpf_getwcharlen(tmp));
//ft_lstadd(&(*dt)->data, ft_lstnew(&buffer, ftpf_getwcharlen(tmp)));
c = '-';
ft_lstfromstr(&(*dt)->data, &buffer);
ft_lstadd(&(*dt)->data, ft_lstnew(&c, sizeof(char)));
free(buffer);
}
ftpf_tmp_printpfdata(dt);
......
......@@ -6,7 +6,7 @@
/* By: ggenois <ggenois@student.le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/05/19 16:09:47 by ggenois #+# ## ## #+# */
/* Updated: 2018/11/05 00:28:50 by ggenois ### #+. /#+ ###.fr */
/* Updated: 2018/11/08 16:53:35 by ggenois ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
......@@ -30,8 +30,11 @@ int ftpf_strings_w(t_pfdata **dt, va_list *data)
{
wchar_t c;
wchar_t *ws;
t_list *tw;
char *tmp;
int l;
l = 1;
if ((*dt)->t == 'C' || (*dt)->t == 'c')
{
......@@ -40,31 +43,17 @@ int ftpf_strings_w(t_pfdata **dt, va_list *data)
(*dt)->data = ft_lstnew(&c, sizeof(char));
else
{
ft_lstadd(&(*dt)->data,ft_lstnew(&c, sizeof(wchar_t)));
//tmp = ftpf_charfromwchar(c);
//ft_lstfromstr(&(*dt)->data, &tmp);
//free(tmp);
tmp = ftpf_charfromwchar(c);
ft_putstr(tmp);
ft_lstfromstr(&(*dt)->data, &tmp);
free(tmp);
}
}
else if ((*dt)->t == 'S' || (*dt)->t == 's')
{
ws = va_arg((*data), wchar_t *);
while ((*(++ws)))
l++;
tw = (t_list *) malloc(sizeof(t_list));
tw->content_size = sizeof(wchar_t);
tw->content = (wchar_t *) malloc (sizeof(wchar_t));
tw->next = NULL;
ftpf_wmemcpy(tw, ws, 1);
ft_lstadd(&(*dt)->data,tw);
//l = ft_lstfromwchar(dt, va_arg((*data), wchar_t *));
ft_lstfromwchar(dt, ws);
}
ftpf_tmp_printpfdata(dt);
return (l);
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment