aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cximage-6.0/CxImage/ximadsp.cpp6
-rw-r--r--lib/cximage-6.0/CxImage/xmemfile.cpp16
-rw-r--r--lib/cximage-6.0/png/pngwutil.c3
-rw-r--r--lib/cximage-6.0/raw/dcraw.c13
-rw-r--r--lib/cximage-6.0/raw/libdcr.c12
5 files changed, 36 insertions, 14 deletions
diff --git a/lib/cximage-6.0/CxImage/ximadsp.cpp b/lib/cximage-6.0/CxImage/ximadsp.cpp
index f54ffd615a..a21c0661a3 100644
--- a/lib/cximage-6.0/CxImage/ximadsp.cpp
+++ b/lib/cximage-6.0/CxImage/ximadsp.cpp
@@ -654,6 +654,7 @@ bool CxImage::Colorize(BYTE hue, BYTE sat, float blend)
hsl.rgbRed=hue;
hsl.rgbGreen=sat;
hsl.rgbBlue = (BYTE)RGB2GRAY(color.rgbRed,color.rgbGreen,color.rgbBlue);
+ hsl.rgbReserved = (BYTE)0;
hsl = HSLtoRGB(hsl);
//BlendPixelColor(x,y,hsl,blend);
//color.rgbRed = (BYTE)(hsl.rgbRed * blend + color.rgbRed * (1.0f - blend));
@@ -679,6 +680,7 @@ bool CxImage::Colorize(BYTE hue, BYTE sat, float blend)
hsl.rgbRed=hue;
hsl.rgbGreen=sat;
hsl.rgbBlue = (BYTE)RGB2GRAY(color.rgbRed,color.rgbGreen,color.rgbBlue);
+ hsl.rgbReserved = (BYTE)0;
hsl = HSLtoRGB(hsl);
color.rgbRed = (BYTE)(hsl.rgbRed * blend + color.rgbRed * (1.0f - blend));
color.rgbBlue = (BYTE)(hsl.rgbBlue * blend + color.rgbBlue * (1.0f - blend));
@@ -1802,6 +1804,7 @@ bool CxImage::Combine(CxImage* r,CxImage* g,CxImage* b,CxImage* a, long colorspa
c.rgbRed=r->GetPixelIndex(x,y);
c.rgbGreen=g->GetPixelIndex(x,y);
c.rgbBlue=b->GetPixelIndex(x,y);
+ c.rgbReserved = (BYTE)0;
switch (colorspace){
case 1:
BlindSetPixelColor(x,y,HSLtoRGB(c));
@@ -2700,7 +2703,10 @@ bool CxImage::UnsharpMask(float radius /*= 5.0*/, float amount /*= 0.5*/, int th
pPalette = new RGBQUAD[head.biClrUsed];
memcpy(pPalette, GetPalette(),GetPaletteSize());
if (!IncreaseBpp(24))
+ {
+ delete [] pPalette;
return false;
+ }
}
CxImage iDst;
diff --git a/lib/cximage-6.0/CxImage/xmemfile.cpp b/lib/cximage-6.0/CxImage/xmemfile.cpp
index af8db945a3..5a72200238 100644
--- a/lib/cximage-6.0/CxImage/xmemfile.cpp
+++ b/lib/cximage-6.0/CxImage/xmemfile.cpp
@@ -186,9 +186,21 @@ bool CxMemFile::Alloc(DWORD dwNewLen)
// allocate new buffer
if (m_pBuffer == NULL) m_pBuffer = (BYTE*)malloc(dwNewBufferSize);
- else m_pBuffer = (BYTE*)realloc(m_pBuffer, dwNewBufferSize);
+ else
+ {
+ BYTE* new_buf = (BYTE*)realloc(m_pBuffer, dwNewBufferSize);
+ if (!new_buf)
+ {
+ free(m_pBuffer);
+ m_bFreeOnClose = false;
+ return false;
+ }
+ else
+ m_pBuffer = new_buf;
+ }
// I own this buffer now (caller knows nothing about it)
- m_bFreeOnClose = true;
+ if (m_pBuffer)
+ m_bFreeOnClose = true;
m_Edge = dwNewBufferSize;
}
diff --git a/lib/cximage-6.0/png/pngwutil.c b/lib/cximage-6.0/png/pngwutil.c
index fef38aef9d..7f4ba12f67 100644
--- a/lib/cximage-6.0/png/pngwutil.c
+++ b/lib/cximage-6.0/png/pngwutil.c
@@ -1721,7 +1721,6 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
}
#endif
-
/* initializes the row writing capability of libpng */
void /* PRIVATE */
png_write_start_row(png_structp png_ptr)
@@ -1790,8 +1789,8 @@ png_write_start_row(png_structp png_ptr)
(png_ptr->rowbytes + 1));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
}
-#endif /* PNG_NO_WRITE_FILTERING */
}
+#endif /* PNG_NO_WRITE_FILTERING */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* if interlaced, we need to set up width and height of pass */
diff --git a/lib/cximage-6.0/raw/dcraw.c b/lib/cximage-6.0/raw/dcraw.c
index d57b9151a4..45cd7a96b4 100644
--- a/lib/cximage-6.0/raw/dcraw.c
+++ b/lib/cximage-6.0/raw/dcraw.c
@@ -3485,6 +3485,7 @@ void CLASS subtract (char *fname)
BAYER(row,col) = MAX (BAYER(row,col) - ntohs(pixel[col]), 0);
}
free (pixel);
+ fclose(fp);
black = 0;
}
@@ -4774,7 +4775,7 @@ void CLASS romm_coeff (float romm_cam[3][3])
void CLASS parse_mos (int offset)
{
char data[40];
- int skip, from, i, c, neut[4], planes=0, frot=0;
+ int skip, from, i, j, c, neut[4], planes=0, frot=0;
static const char *mod[] =
{ "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22",
"Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65",
@@ -4802,13 +4803,15 @@ void CLASS parse_mos (int offset)
strcpy (model, mod[i]);
}
if (!strcmp(data,"icc_camera_to_tone_matrix")) {
- for (i=0; i < 9; i++)
- romm_cam[0][i] = int_to_float(get4());
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ romm_cam[i][j] = int_to_float(get4());
romm_coeff (romm_cam);
}
if (!strcmp(data,"CaptProf_color_matrix")) {
- for (i=0; i < 9; i++)
- fscanf (ifp, "%f", &romm_cam[0][i]);
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ fscanf (ifp, "%f", &romm_cam[i][j]);
romm_coeff (romm_cam);
}
if (!strcmp(data,"CaptProf_number_of_planes"))
diff --git a/lib/cximage-6.0/raw/libdcr.c b/lib/cximage-6.0/raw/libdcr.c
index 81bf2fb322..ced60c3665 100644
--- a/lib/cximage-6.0/raw/libdcr.c
+++ b/lib/cximage-6.0/raw/libdcr.c
@@ -4735,7 +4735,7 @@ void DCR_CLASS dcr_romm_coeff (DCRAW* p, float romm_cam[3][3])
void DCR_CLASS dcr_parse_mos (DCRAW* p, int offset)
{
char data[40];
- int skip, from, i=0, c, neut[4], planes=0, frot=0;
+ int skip, from, i=0, j, c, neut[4], planes=0, frot=0;
static const char *mod[] =
{ "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22",
"Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65",
@@ -4763,13 +4763,15 @@ void DCR_CLASS dcr_parse_mos (DCRAW* p, int offset)
strcpy (p->model, mod[i]);
}
if (!strcmp(data,"icc_camera_to_tone_matrix")) {
- for (i=0; i < 9; i++)
- romm_cam[0][i] = dcr_int_to_float(dcr_get4(p));
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ romm_cam[i][j] = dcr_int_to_float(dcr_get4(p));
dcr_romm_coeff (p,romm_cam);
}
if (!strcmp(data,"CaptProf_color_matrix")) {
- for (i=0; i < 9; i++)
- dcr_fscanf(p->obj_, "%f", &romm_cam[0][i]);
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ dcr_fscanf(p->obj_, "%f", &romm_cam[i][j]);
dcr_romm_coeff (p,romm_cam);
}
if (!strcmp(data,"CaptProf_number_of_planes"))