File: | Functions.c |
Location: | line 194, column 32 |
Description: | Dereference of null pointer |
1 | /* | ||
2 | |||
3 | Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved. | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | copy of this software and associated documentation files (the "Software"), | ||
7 | to deal in the Software without restriction, including without limitation | ||
8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | and/or sell copies of the Software, and to permit persons to whom the | ||
10 | Software is furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice (including the next | ||
13 | paragraph) shall be included in all copies or substantial portions of the | ||
14 | Software. | ||
15 | |||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | DEALINGS IN THE SOFTWARE. | ||
23 | |||
24 | */ | ||
25 | |||
26 | /* | ||
27 | |||
28 | Copyright 1985, 1986, 1987, 1988, 1989, 1994, 1998 The Open Group | ||
29 | |||
30 | Permission to use, copy, modify, distribute, and sell this software and its | ||
31 | documentation for any purpose is hereby granted without fee, provided that | ||
32 | the above copyright notice appear in all copies and that both that | ||
33 | copyright notice and this permission notice appear in supporting | ||
34 | documentation. | ||
35 | |||
36 | The above copyright notice and this permission notice shall be included in | ||
37 | all copies or substantial portions of the Software. | ||
38 | |||
39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
41 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
42 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
43 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
44 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
45 | |||
46 | Except as contained in this notice, the name of The Open Group shall not be | ||
47 | used in advertising or otherwise to promote the sale, use or other dealings | ||
48 | in this Software without prior written authorization from The Open Group. | ||
49 | |||
50 | */ | ||
51 | |||
52 | #ifdef HAVE_CONFIG_H1 | ||
53 | #include <config.h> | ||
54 | #endif | ||
55 | #include "IntrinsicI.h" | ||
56 | #include <X11/Shell.h> | ||
57 | #include <X11/Vendor.h> | ||
58 | |||
59 | /* | ||
60 | * This file defines functional equivalents to all macros defined | ||
61 | * in Intrinsic.h | ||
62 | * | ||
63 | */ | ||
64 | |||
65 | #undef XtIsRectObj | ||
66 | Boolean XtIsRectObj(Widget object) | ||
67 | { | ||
68 | return _XtCheckSubclassFlag(object, 0x02); | ||
69 | } | ||
70 | |||
71 | |||
72 | #undef XtIsWidget | ||
73 | Boolean XtIsWidget(Widget object) | ||
74 | { | ||
75 | return _XtCheckSubclassFlag(object, 0x04); | ||
76 | } | ||
77 | |||
78 | |||
79 | #undef XtIsComposite | ||
80 | Boolean XtIsComposite(Widget object) | ||
81 | { | ||
82 | return _XtCheckSubclassFlag(object, 0x08); | ||
83 | } | ||
84 | |||
85 | |||
86 | #undef XtIsConstraint | ||
87 | Boolean XtIsConstraint(Widget object) | ||
88 | { | ||
89 | return _XtCheckSubclassFlag(object, 0x10); | ||
90 | } | ||
91 | |||
92 | |||
93 | #undef XtIsShell | ||
94 | Boolean XtIsShell(Widget object) | ||
95 | { | ||
96 | return _XtCheckSubclassFlag(object, 0x20); | ||
97 | } | ||
98 | |||
99 | |||
100 | #undef XtIsOverrideShell | ||
101 | Boolean XtIsOverrideShell(Widget object) | ||
102 | { | ||
103 | return _XtIsSubclassOf(object, (WidgetClass)overrideShellWidgetClass, | ||
104 | (WidgetClass)shellWidgetClass, 0x20); | ||
105 | } | ||
106 | |||
107 | |||
108 | #undef XtIsWMShell | ||
109 | Boolean XtIsWMShell(Widget object) | ||
110 | { | ||
111 | return _XtCheckSubclassFlag(object, 0x40); | ||
112 | } | ||
113 | |||
114 | |||
115 | #undef XtIsVendorShell | ||
116 | Boolean XtIsVendorShell(Widget object) | ||
117 | { | ||
118 | Boolean retval; | ||
119 | |||
120 | LOCK_PROCESSif(_XtProcessLock)(*_XtProcessLock)(); | ||
121 | retval = _XtIsSubclassOf(object, | ||
122 | #ifdef notdef | ||
123 | /* | ||
124 | * We don't refer to vendorShell directly, because some shared libraries | ||
125 | * bind local references tightly. | ||
126 | */ | ||
127 | (WidgetClass)vendorShellWidgetClass, | ||
128 | #endif | ||
129 | transientShellWidgetClass->core_class.superclass, | ||
130 | (WidgetClass)wmShellWidgetClass, 0x40); | ||
131 | UNLOCK_PROCESSif(_XtProcessUnlock)(*_XtProcessUnlock)(); | ||
132 | return retval; | ||
133 | } | ||
134 | |||
135 | |||
136 | #undef XtIsTransientShell | ||
137 | Boolean XtIsTransientShell(Widget object) | ||
138 | { | ||
139 | return _XtIsSubclassOf(object, (WidgetClass)transientShellWidgetClass, | ||
140 | (WidgetClass)wmShellWidgetClass, 0x40); | ||
141 | } | ||
142 | |||
143 | |||
144 | #undef XtIsTopLevelShell | ||
145 | Boolean XtIsTopLevelShell(Widget object) | ||
146 | { | ||
147 | return _XtCheckSubclassFlag(object, 0x80); | ||
148 | } | ||
149 | |||
150 | |||
151 | #undef XtIsApplicationShell | ||
152 | Boolean XtIsApplicationShell(Widget object) | ||
153 | { | ||
154 | return _XtIsSubclassOf(object, (WidgetClass)applicationShellWidgetClass, | ||
155 | (WidgetClass)topLevelShellWidgetClass, 0x80); | ||
156 | } | ||
157 | |||
158 | #undef XtIsSessionShell | ||
159 | Boolean XtIsSessionShell(Widget object) | ||
160 | { | ||
161 | return _XtIsSubclassOf(object, (WidgetClass)sessionShellWidgetClass, | ||
162 | (WidgetClass)topLevelShellWidgetClass, 0x80); | ||
163 | } | ||
164 | |||
165 | #undef XtMapWidget | ||
166 | void XtMapWidget(Widget w) | ||
167 | { | ||
168 | Widget hookobj; | ||
169 | WIDGET_TO_APPCON(w)XtAppContext app = (w && _XtProcessLock ? XtWidgetToApplicationContext (w) : ((void*)0)); | ||
170 | |||
171 | LOCK_APP(app)if(app && app->lock)(*app->lock)(app); | ||
172 | XMapWindow(XtDisplay(w)(((w)->core.screen)->display), XtWindow(w)((w)->core.window)); | ||
173 | hookobj = XtHooksOfDisplay(XtDisplay(w)(((w)->core.screen)->display)); | ||
174 | if (XtHasCallbacks(hookobj, XtNchangeHook((char*)&XtStrings[2061])) == XtCallbackHasSome) { | ||
175 | XtChangeHookDataRec call_data; | ||
176 | |||
177 | call_data.type = XtHmapWidget((char*)&XtStrings[2534]); | ||
178 | call_data.widget = w; | ||
179 | XtCallCallbackList(hookobj, | ||
180 | ((HookObject)hookobj)->hooks.changehook_callbacks, | ||
181 | (XtPointer)&call_data); | ||
182 | } | ||
183 | UNLOCK_APP(app)if(app && app->unlock)(*app->unlock)(app); | ||
184 | } | ||
185 | |||
186 | |||
187 | #undef XtUnmapWidget | ||
188 | void XtUnmapWidget(Widget w) | ||
189 | { | ||
190 | Widget hookobj; | ||
191 | WIDGET_TO_APPCON(w)XtAppContext app = (w && _XtProcessLock ? XtWidgetToApplicationContext (w) : ((void*)0)); | ||
192 | |||
193 | LOCK_APP(app)if(app && app->lock)(*app->lock)(app); | ||
194 | XUnmapWindow(XtDisplay(w)(((w)->core.screen)->display), XtWindow(w)((w)->core.window)); | ||
Within the expansion of the macro 'XtWindow':
| |||
195 | hookobj = XtHooksOfDisplay(XtDisplay(w)(((w)->core.screen)->display)); | ||
196 | if (XtHasCallbacks(hookobj, XtNchangeHook((char*)&XtStrings[2061])) == XtCallbackHasSome) { | ||
197 | XtChangeHookDataRec call_data; | ||
198 | |||
199 | call_data.type = XtHunmapWidget((char*)&XtStrings[2546]); | ||
200 | call_data.widget = w; | ||
201 | XtCallCallbackList(hookobj, | ||
202 | ((HookObject)hookobj)->hooks.changehook_callbacks, | ||
203 | (XtPointer)&call_data); | ||
204 | } | ||
205 | UNLOCK_APP(app)if(app && app->unlock)(*app->unlock)(app); | ||
206 | } | ||
207 | |||
208 | |||
209 | #undef XtNewString | ||
210 | String XtNewString(String str) | ||
211 | { | ||
212 | if (str == NULL((void*)0)) | ||
213 | return NULL((void*)0); | ||
214 | else | ||
215 | return strcpy(__XtMalloc((unsigned)strlen(str) + 1), str); | ||
216 | } |