summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2003-07-17 10:11:02 (GMT)
committerdkf <dkf@noemail.net>2003-07-17 10:11:02 (GMT)
commit36a13bb1274192b7969f6a14958f7d5a30458ceb (patch)
treee4b199d6eea7e6512d49795ef5c7900c03cfb361 /generic/tkImgPhoto.c
parent0a1c5a3bd8b0e60f589c4fc3f009b862a2d45513 (diff)
downloadtk-36a13bb1274192b7969f6a14958f7d5a30458ceb.zip
tk-36a13bb1274192b7969f6a14958f7d5a30458ceb.tar.gz
tk-36a13bb1274192b7969f6a14958f7d5a30458ceb.tar.bz2
Rearranged code in ImgPhotoCmd to not use confusing fallthroughs in switches.
[Bug 771988] Also TAB Police in Changelog... FossilOrigin-Name: cbba54a5e53176b893d6efae44c927631de7286f
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 */
}
/*