1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

11 Commits

Author SHA1 Message Date
Christophe CURIS
19202fd2db WRaster: Create header for i18n helper functions
This patch is just adding a single header, but because it also modifies
all the C files to add the #include, it was made as a patch on its own to
ease review.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
920c6d16b1 wraster: Remove duplicate code
Duplicating things makes maintenance error-prone, which is not a good idea.
In case the abort procedure would need an update, it would be easy then
to forget some place, leading to leaks, if not worse.

Beside, goto is not as bad as academics would like people to believe, when
it is used correctly (and this case is one of them).
The name for the label was given an explicit meaning to make code easy to
understand.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Rodolfo García Peñas (kix)
6a044fe5ae load_jpeg.c Return NULL
The image is NULL, we can return NULL here.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Rodolfo García Peñas (kix)
6dd1498f7c load_jpeg.c Style
This patch is just coding style. Removes some empty lines,...

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Rodolfo García Peñas (kix)
090b761fde load_jpeg.c Removed dead code
This patch removes the code not used. Because the if block
check that buffer[0] is NULL, then, we don't need check it
again inside.

Image is not used yet, so is NULL. We can return NULL.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Rodolfo García Peñas (kix)
49db946aa2 load_jpeg.c Clean code
This patch returns NULL, because the variable image is not used yet.

The patch also removes three lines:

- buffer[0] = NULL;       /* Initialize pointer to avoid spurious free in cleanup code */
  RErrorCode = RERR_BADIMAGEFILE;
  jpeg_destroy_decompress(&cinfo);
  fclose(file);
- if (buffer[0])
-    free(buffer[0]);

buffer is a local variable. The malloc is not used yet. So:

- We set the value to NULL, then check if is null to call free(). So the free()
  call is never used. We can remove the last too lines.
- We don't need set now to NULL, because the variable is empty (the
  initializated (or not) value is not used, and is destroyed as local variable
  when we returns, just one line later.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Rodolfo García Peñas (kix)
a2cc89dd3d load_jpeg.c Removed goto
This patch removes the goto call. I copied the code after the bye: label and
I paste it in the goto-calls.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2019-06-20 22:04:31 +01:00
Christophe CURIS
173eaee9c2 wrlib: initialise value for variable to avoid possible crash (Coverity #50245)
As pointed by Coverity, there's a free on the content of this buffer at
function's end, but if the image's width or height is lower than 1 then we
could reach this free before allocating anything, thus having an
uninitialised pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-06-15 19:45:20 +01:00
Amadeusz Sławiński
1b69c49fb2 wrlib: Value stored to 'bptr' is never read
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-05-18 23:00:17 +01:00
Christophe CURIS
787036551f wrlib: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
c3a132215d wrlib: Renamed image format related files for clarity
This patch makes all files appear together when listing files and
it is more clear about their function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00