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
élément du 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 à
lutilisateur) */
size_t capacity; /*!< Capacité maximale du tableau actuel */
} darray;
/// \brief Créé un nouvel objet \ref darray vide

View File

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

View File

@ -61,8 +61,8 @@ void check_for_comments(FILE *t_fp) {
char c;
c = (char)getc(t_fp);
while (c == '#') {
while (getc(t_fp) != '\n')
;
while (getc(t_fp) != '\n') {
}
c = (char)getc(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`
*/
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));
printf("Size of data: %lu\n", t_size);
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) {
Pixel *pixel;
uint8_t *data, size;
unsigned long i;
uint64_t i;
size = (uint8_t)darraySize(t_img->pixels);
data = (uint8_t *)malloc(3 * sizeof(uint8_t) * size);
for (i = 0; i < size; i += 3) {