fix a few random compiler warnings

* unused variables
 * implicit enum conversion
 * sigend <-> unsigned comparison
 * left shift negative number

The only warnings left on my setup right now are `-Wstringop-truncation`
from strncpy calls. Those are not trivial to fix. Turns out the code does
regularly not take into account that strncpy may not result in a null
terminated string. Details, see `man string_copying`.
This commit is contained in:
axxel
2024-09-15 22:50:32 +02:00
committed by Marcus Meissner
parent aa4197e18c
commit 2e17f8e2ec
5 changed files with 6 additions and 6 deletions

View File

@@ -43,6 +43,7 @@
#define CLAMP_U8(x) (((x) > 255) ? 255 : (((x) < 0) ? 0 : (x)))
#ifdef HAVE_LIBGD
static const int corr_tables[4][8] = {
/* Table 0 depends on wrap around to get negative
corrections!! */
@@ -52,7 +53,6 @@ static const int corr_tables[4][8] = {
{ 0, 4, 8, 12, -16, -12, -8, -4 },
};
#ifdef HAVE_LIBGD
/* With in a compressed 4x4 block, the data is stored 4 component values at a
time, compressed into 2 bytes, the first 5 bits are a starting value,
then 2 bits encoding which correction/delta table to use and

View File

@@ -982,7 +982,7 @@ int pslr_set_exposure_mode(pslr_handle_t h, pslr_exposure_mode_t mode) {
}
if ( p->model->need_exposure_mode_conversion ) {
mode = exposure_mode_conversion( mode );
mode = (pslr_exposure_mode_t)exposure_mode_conversion( mode );
}
return ipslr_handle_command_x18( p, true, X18_EXPOSURE_MODE, 2, 1, mode, 0);

View File

@@ -412,7 +412,7 @@ fd_putfunc(PTPParams* params, void* private,
PTPFDHandlerPrivate* priv = (PTPFDHandlerPrivate*)private;
written = write (priv->fd, data, sendlen);
if (written != sendlen)
if ((unsigned long)written != sendlen)
return PTP_ERROR_IO;
return PTP_RC_OK;
}

View File

@@ -112,7 +112,7 @@ int qtkn_decode(unsigned char *raw, int width, int height, unsigned char **out)
for (c=0; c < 3; c++) {
val = ((0x1000000/last[c] + 0x7ff) >> 12) * mul[c];
s = val > 65564 ? 10:12;
x = ~(-1 << (s-1));
x = ~((unsigned int)-1 << (s-1));
val <<= 12-s;
for (i=0; i < (int)(sizeof(buf[0])/sizeof(short)); i++) {
((short *)buf[c])[i] = (((short *)buf[c])[i] * val + x) >> s;

View File

@@ -151,9 +151,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GPContext *context)
{
Camera *camera = data;
int idx, size;
int idx;
#ifdef HAVE_LIBGD
int ret;
int ret, size;
gdImagePtr im;
void *gdpng;
#endif