summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPPM.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-20 10:41:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-20 10:41:43 (GMT)
commit2f89fa96c29e874b87523d628df15c62984dd9b7 (patch)
tree512c62f76a0e9be490f422d8aa6f866cd1c0c5c3 /generic/tkImgPPM.c
parent22f8312f1177e98133c31e059d6f1ae948178f37 (diff)
downloadtk-2f89fa96c29e874b87523d628df15c62984dd9b7.zip
tk-2f89fa96c29e874b87523d628df15c62984dd9b7.tar.gz
tk-2f89fa96c29e874b87523d628df15c62984dd9b7.tar.bz2
Much more WIP: Appears to be working on UNIX, and for a bit part on Windows too.
Diffstat (limited to 'generic/tkImgPPM.c')
-rw-r--r--generic/tkImgPPM.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index ea49fc2..91d809b 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -103,6 +103,9 @@ FileMatchPPM(
Tcl_Interp *interp) /* unused */
{
int dummy;
+ (void)fileName;
+ (void)format;
+ (void)interp;
return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy);
}
@@ -145,6 +148,7 @@ FileReadPPM(
size_t nBytes, count;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
+ (void)format;
type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity);
if (type == 0) {
@@ -212,7 +216,7 @@ FileReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = ckalloc(nBytes);
+ pixelPtr = (unsigned char *)ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {
@@ -290,6 +294,7 @@ FileWritePPM(
size_t nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
+ (void)format;
chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666);
if (chan == NULL) {
@@ -377,6 +382,7 @@ StringWritePPM(
unsigned char *pixLinePtr, *byteArray;
char header[16 + TCL_INTEGER_SPACE * 2];
Tcl_Obj *byteArrayObj;
+ (void)format;
sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
@@ -454,6 +460,8 @@ StringMatchPPM(
Tcl_Interp *interp) /* unused */
{
int dummy;
+ (void)format;
+ (void)interp;
return ReadPPMStringHeader(dataObj, widthPtr, heightPtr,
&dummy, NULL, NULL);
@@ -494,6 +502,7 @@ StringReadPPM(
int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1;
unsigned char *pixelPtr, *dataBuffer;
Tk_PhotoImageBlock block;
+ (void)format;
type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight,
&maxIntensity, &dataBuffer, &dataSize);
@@ -580,7 +589,7 @@ StringReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = ckalloc(nBytes);
+ pixelPtr = (unsigned char *)ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {