From f1bc5f3cae2f4140d3fd56fddb579e6c7c826993 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 25 Nov 2005 15:23:07 +0000 Subject: Improved the error reporting of the transform methods. --- generic/tkZinc.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 9 deletions(-) (limited to 'generic') diff --git a/generic/tkZinc.c b/generic/tkZinc.c index 6e8cabb..98f8efe 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -5539,7 +5539,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. } } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -5586,7 +5591,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. "scale tagOrIdOrTransform xFactor yFactor ?centerX centerY?"); goto error; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -5755,7 +5765,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. Tcl_WrongNumArgs(interp, 1, args, "skew tagOrIdOrTransform xSkewAngle ySkewAngle"); goto error; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -5837,7 +5852,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. argc--; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[3])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -5853,7 +5873,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. t = item->transfo; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { to = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -5947,7 +5972,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. goto err_tget; } } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -6013,6 +6043,10 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. * Setup the source transform. */ tag = Tcl_GetString(args[2]); + if (strlen(tag) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } if (strcmp(tag, "device") == 0) { from_t = &t1; ZnTransfoSetIdentity(from_t); @@ -6041,6 +6075,10 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. * Setup the destination transform */ tag = Tcl_GetString(args[argc-2]); + if (strlen(tag) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } if (strcmp(tag, "device") == 0) { to_t = &t2; ZnTransfoSetIdentity(to_t); @@ -6131,7 +6169,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); goto error; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -6174,7 +6212,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. Tcl_WrongNumArgs(interp, 1, args, "treset tagOrIdOrTransform"); goto error; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); } @@ -6297,7 +6340,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. } new._[i/2][i%2] = (float) d; } - entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); + goto error; + } + entry = Tcl_FindHashEntry(wi->t_table, str); if (entry != NULL) { t = (ZnTransfo *) Tcl_GetHashValue(entry); *t = new; -- cgit v1.1