This commit is contained in:
Jeremy FLEURY
2019-07-17 11:51:13 +02:00
parent 748d10f4f3
commit 45e980b4e3
65 changed files with 6601 additions and 18 deletions

View File

@@ -6,7 +6,7 @@
/* By: jfleury <jfleury@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/05 15:35:42 by jfleury #+# #+# */
/* Updated: 2019/07/15 19:15:18 by igarbuz ### ########.fr */
/* Updated: 2019/07/17 11:49:39 by jfleury ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,7 +18,7 @@
# include <stdlib.h>
# include <stdarg.h>
# define BUFF_SIZE 32
# define BUFF_SIZE 1
# define CONV_ID_NB 13
# define FLAGS_NB 5
# define PRECI_GROUPS 3
@@ -120,8 +120,8 @@ char *ft_strstr(const char *str, const char *to_find);
char *ft_strsub(char const *s, unsigned int start, size_t len);
char *ft_strtrim(char const *s);
int ft_tolower(int c);
char *ft_itoa_base_int(unsigned int nb, int base);
char *ft_itoa_base_short(unsigned short nb, int base);
unsigned char *ft_itoa_base_int(unsigned int nb, int base);
unsigned char *ft_itoa_base_short(unsigned short nb, int base);
int ft_toupper(int c);
char *ft_strextend(char *s1, char const *s2);
char *ft_strnextend(char *s1, char const *s2, size_t len);

View File

@@ -6,7 +6,7 @@
/* By: jfleury <jfleury@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/23 15:05:04 by allefebv #+# #+# */
/* Updated: 2019/07/09 15:26:17 by jfleury ### ########.fr */
/* Updated: 2019/07/17 11:39:51 by jfleury ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <string.h>
static int ft_malloc_len(unsigned int nb, int base)
static int ft_malloc_len(unsigned int nb, int base)
{
int i;
@@ -27,11 +27,11 @@ static int ft_malloc_len(unsigned int nb, int base)
return (i);
}
char *ft_itoa_base_int(unsigned int nb, int base)
unsigned char *ft_itoa_base_int(unsigned int nb, int base)
{
unsigned int result;
int i;
char *str;
unsigned char *str;
char *tab;
tab = ft_strdup("0123456789abcdef");
@@ -40,7 +40,7 @@ char *ft_itoa_base_int(unsigned int nb, int base)
i = ft_malloc_len(nb, base);
if (nb == 0)
i++;
if (!(str = (char*)malloc(sizeof(char*) * i + 1)))
if (!(str = malloc(sizeof(unsigned char*) * i + 1)))
return (NULL);
str[i] = '\0';
if (nb == 0)

View File

@@ -6,7 +6,7 @@
/* By: jfleury <jfleury@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/23 15:05:04 by allefebv #+# #+# */
/* Updated: 2019/07/13 17:27:38 by tmaze ### ########.fr */
/* Updated: 2019/07/17 11:40:00 by jfleury ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,9 +14,9 @@
#include <stdlib.h>
#include <string.h>
static int ft_malloc_len(unsigned short nb, int base)
static int ft_malloc_len(unsigned short nb, int base)
{
short i;
short i;
i = 0;
while (nb != 0)
@@ -27,12 +27,12 @@ static int ft_malloc_len(unsigned short nb, int base)
return (i);
}
char *ft_itoa_base_short(unsigned short nb, int base)
unsigned char *ft_itoa_base_short(unsigned short nb, int base)
{
unsigned short result;
short i;
char *str;
char *tab;
unsigned short result;
short i;
unsigned char *str;
char *tab;
tab = ft_strdup("0123456789abcdef");
if (base < 2 || base > 16)
@@ -40,7 +40,7 @@ char *ft_itoa_base_short(unsigned short nb, int base)
i = ft_malloc_len(nb, base);
if (nb == 0)
i++;
if (!(str = (char*)malloc(sizeof(char*) * i + 1)))
if (!(str = malloc(sizeof(unsigned char*) * i + 1)))
return (NULL);
str[i] = '\0';
if (nb == 0)