code style

This commit is contained in:
Phuntsok Drak-pa 2018-11-24 22:51:25 +01:00
parent ae74134064
commit 0ab3192fa4
No known key found for this signature in database
GPG Key ID: 9CB34B6827C66D22
3 changed files with 18 additions and 18 deletions

View File

@ -22,8 +22,7 @@ typedef struct {
void *end; /*!< Pointeur sur lélément situé immédiatement après le dernier void *end; /*!< Pointeur sur lélément situé immédiatement après le dernier
élément du tableau */ élément du tableau */
size_t element_size; /*!< Taille des éléments stockés dans le tableau */ size_t element_size; /*!< Taille des éléments stockés dans le tableau */
size_t capacity; /*!< Capacité maximale du tableau actuel (non destinée à size_t capacity; /*!< Capacité maximale du tableau actuel */
lutilisateur) */
} darray; } darray;
/// \brief Créé un nouvel objet \ref darray vide /// \brief Créé un nouvel objet \ref darray vide

View File

@ -22,18 +22,19 @@
* \param[in] t_exit_code Code de sortie du processus * \param[in] t_exit_code Code de sortie du processus
*/ */
void help(int t_exit_code) { void help(int t_exit_code) {
puts("Usage:\n\ puts("Usage:\n"
surfaces-unies -i path [-o path] [-options]\n\n\ "surfaces-unies -i path [-o path] [-options]\n\n"
The default action is to compress the mandatory input image to a .su\n\ "The default action is to compress the mandatory input image to a .su\n"
file saved in the current directory.\n\ "file saved in the current directory.\n"
The input image MUST be saved in the ppm format.\n\ "The input image MUST be saved in the ppm format.\n"
Options available:\n\ "Options available:\n"
-h --help\n\tdisplay the current message\n\ "-h --help\n\tdisplay the current message\n"
-i --input\n\tpath to the input file (MANDATORY)\n\ "-i --input\n\tpath to the input file (MANDATORY)\n"
-o --output\n\ "-o --output\n"
\tpath to the output file (if the file already exists, it will be overwritten)\n\ "\tpath to the output file (if the file already exists, it will be\n"
-c --compress\n\tcompress the input file\n\ "\toverwritten)\n"
-u --uncompress\n\tuncompresses the input file to the output file."); "-c --compress\n\tcompress the input file\n"
"-u --uncompress\n\tuncompresses the input file to the output file.");
exit(t_exit_code); exit(t_exit_code);
} }

View File

@ -61,8 +61,8 @@ void check_for_comments(FILE *t_fp) {
char c; char c;
c = (char)getc(t_fp); c = (char)getc(t_fp);
while (c == '#') { while (c == '#') {
while (getc(t_fp) != '\n') while (getc(t_fp) != '\n') {
; }
c = (char)getc(t_fp); c = (char)getc(t_fp);
} }
ungetc(c, t_fp); ungetc(c, t_fp);
@ -141,7 +141,7 @@ void read_data(FILE *t_fp, uint64_t t_size, unsigned char **t_data,
* \param[in] t_size Taille du tableau de `unsigned char` * \param[in] t_size Taille du tableau de `unsigned char`
*/ */
void dataToImage(Image *t_img, uint8_t *t_data, uint64_t t_size) { void dataToImage(Image *t_img, uint8_t *t_data, uint64_t t_size) {
unsigned long i; uint64_t i;
t_img->pixels = darrayNew(sizeof(Pixel)); t_img->pixels = darrayNew(sizeof(Pixel));
printf("Size of data: %lu\n", t_size); printf("Size of data: %lu\n", t_size);
for (i = 0; i < t_size; i += 3) { for (i = 0; i < t_size; i += 3) {
@ -161,7 +161,7 @@ void dataToImage(Image *t_img, uint8_t *t_data, uint64_t t_size) {
uint8_t *imageToData(Image *t_img) { uint8_t *imageToData(Image *t_img) {
Pixel *pixel; Pixel *pixel;
uint8_t *data, size; uint8_t *data, size;
unsigned long i; uint64_t i;
size = (uint8_t)darraySize(t_img->pixels); size = (uint8_t)darraySize(t_img->pixels);
data = (uint8_t *)malloc(3 * sizeof(uint8_t) * size); data = (uint8_t *)malloc(3 * sizeof(uint8_t) * size);
for (i = 0; i < size; i += 3) { for (i = 0; i < size; i += 3) {