summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-07-17 10:11:02 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-07-17 10:11:02 (GMT)
commit6a815f3d71ae51d26f0dea29130cc2e899013058 (patch)
treee4b199d6eea7e6512d49795ef5c7900c03cfb361 /generic/tkImgPhoto.c
parent2094eb19c0574532e416f52846a5ac10cebcf386 (diff)
downloadtk-6a815f3d71ae51d26f0dea29130cc2e899013058.zip
tk-6a815f3d71ae51d26f0dea29130cc2e899013058.tar.gz
tk-6a815f3d71ae51d26f0dea29130cc2e899013058.tar.bz2
Rearranged code in ImgPhotoCmd to not use confusing fallthroughs in switches.
[Bug 771988] Also TAB Police in Changelog...
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3849556..02ab477 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -16,7 +16,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.37 2003/03/06 15:05:36 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.38 2003/07/17 10:11:03 dkf Exp $
*/
#include "tkInt.h"
@@ -686,11 +686,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (objc == 2) {
Tk_PhotoBlank(masterPtr);
+ return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
return TCL_ERROR;
}
- break;
case PHOTO_CGET: {
char *arg;
@@ -704,17 +704,15 @@ ImgPhotoCmd(clientData, interp, objc, objv)
if (masterPtr->dataString) {
Tcl_SetObjResult(interp, masterPtr->dataString);
}
- return TCL_OK;
- }
- if (strncmp(arg,"-format", length) == 0) {
+ } else if (strncmp(arg,"-format", length) == 0) {
if (masterPtr->format) {
Tcl_SetObjResult(interp, masterPtr->format);
}
- return TCL_OK;
+ } else {
+ Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
+ (char *) masterPtr, Tcl_GetString(objv[2]), 0);
}
- Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
- break;
+ return TCL_OK;
}
case PHOTO_CONFIGURE:
@@ -877,15 +875,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- if (Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, &block,
- options.toX, options.toY, options.toX2 - options.toX,
+ return Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ &block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
- options.compositingRule) != TCL_OK) {
- return TCL_ERROR;
- }
-
- break;
+ options.compositingRule);
case PHOTO_DATA: {
char *data;
@@ -970,7 +964,6 @@ ImgPhotoCmd(clientData, interp, objc, objv)
ckfree(data);
}
return result;
- break;
}
case PHOTO_GET: {
@@ -1003,7 +996,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
sprintf(string, "%d %d %d", pixelPtr[0], pixelPtr[1],
pixelPtr[2]);
Tcl_AppendResult(interp, string, (char *) NULL);
- break;
+ return TCL_OK;
}
case PHOTO_PUT:
@@ -1127,15 +1120,12 @@ ImgPhotoCmd(clientData, interp, objc, objv)
block.offset[1] = 1;
block.offset[2] = 2;
block.offset[3] = 0;
- if (Tk_PhotoPutBlock(interp, (ClientData)masterPtr, &block,
+ result = Tk_PhotoPutBlock(interp, (ClientData)masterPtr, &block,
options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY,
- TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
- ckfree((char *) block.pixelPtr);
- return TCL_ERROR;
- }
+ TK_PHOTO_COMPOSITE_SET);
ckfree((char *) block.pixelPtr);
- break;
+ return result;
case PHOTO_READ: {
Tcl_Obj *format;
@@ -1246,7 +1236,6 @@ ImgPhotoCmd(clientData, interp, objc, objv)
Tcl_Close(NULL, chan);
}
return result;
- break;
}
case PHOTO_REDITHER:
@@ -1282,7 +1271,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
(masterPtr->width - x), (masterPtr->height - y),
masterPtr->width, masterPtr->height);
}
- break;
+ return TCL_OK;
case PHOTO_TRANS: {
static CONST char *photoTransOptions[] = {
@@ -1397,10 +1386,11 @@ ImgPhotoCmd(clientData, interp, objc, objv)
Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1,
masterPtr->width, masterPtr->height);
masterPtr->flags &= ~IMAGE_CHANGED;
+ return TCL_OK;
}
}
- return TCL_OK;
+ panic("unexpected fallthrough");
}
case PHOTO_WRITE: {
@@ -1522,7 +1512,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
}
- return TCL_OK;
+ panic("unexpected fallthrough");
+ return TCL_ERROR; /* NOT REACHED */
}
/*