| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | #ifdef HAVE_CONFIG_H1 |
| 72 | #include <config.h> |
| 73 | #endif |
| 74 | #include "IntrinsicI.h" |
| 75 | #include "StringDefs.h" |
| 76 | |
| 77 | static XtResource resources[] = { |
| 78 | {XtNchildren((char*)&XtStrings[145]), XtCReadOnly((char*)&XtStrings[1244]), XtRWidgetList((char*)&XtStrings[1884]), sizeof(WidgetList), |
| 79 | XtOffsetOf(CompositeRec, composite.children)__builtin_offsetof(CompositeRec, composite.children), XtRImmediate((char*)&XtStrings[1695]), NULL((void*)0)}, |
| 80 | {XtNnumChildren((char*)&XtStrings[493]), XtCReadOnly((char*)&XtStrings[1244]), XtRCardinal((char*)&XtStrings[1587]), sizeof(Cardinal), |
| 81 | XtOffsetOf(CompositeRec, composite.num_children)__builtin_offsetof(CompositeRec, composite.num_children), XtRImmediate((char*)&XtStrings[1695]), NULL((void*)0)}, |
| 82 | {XtNinsertPosition((char*)&XtStrings[326]), XtCInsertPosition((char*)&XtStrings[1098]), XtRFunction((char*)&XtStrings[1677]), sizeof(XtOrderProc), |
| 83 | XtOffsetOf(CompositeRec, composite.insert_position)__builtin_offsetof(CompositeRec, composite.insert_position), XtRImmediate((char*)&XtStrings[1695]), NULL((void*)0)}, |
| 84 | }; |
| 85 | |
| 86 | static void CompositeClassPartInitialize(WidgetClass); |
| 87 | static void CompositeInitialize(Widget, Widget, ArgList, Cardinal *); |
| 88 | static void CompositeInsertChild(Widget); |
| 89 | static void CompositeDeleteChild(Widget); |
| 90 | static void CompositeDestroy(Widget); |
| 91 | |
| 92 | externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { |
| 93 | { |
| 94 | &widgetClassRec, |
| 95 | "Composite", |
| 96 | sizeof(CompositeRec), |
| 97 | NULL((void*)0), |
| 98 | CompositeClassPartInitialize, |
| 99 | FALSE0, |
| 100 | CompositeInitialize, |
| 101 | NULL((void*)0), |
| 102 | XtInheritRealize((XtRealizeProc) _XtInherit), |
| 103 | NULL((void*)0), |
| 104 | 0, |
| 105 | resources, |
| 106 | XtNumber(resources)((Cardinal) (sizeof(resources) / sizeof(resources[0]))), |
| 107 | NULLQUARK((XrmQuark) 0), |
| 108 | FALSE0, |
| 109 | TRUE1, |
| 110 | FALSE0, |
| 111 | FALSE0, |
| 112 | CompositeDestroy, |
| 113 | NULL((void*)0), |
| 114 | NULL((void*)0), |
| 115 | NULL((void*)0), |
| 116 | NULL((void*)0), |
| 117 | XtInheritSetValuesAlmost((XtAlmostProc) _XtInherit), |
| 118 | NULL((void*)0), |
| 119 | NULL((void*)0), |
| 120 | XtVersion(11 * 1000 + 6), |
| 121 | NULL((void*)0), |
| 122 | NULL((void*)0), |
| 123 | NULL((void*)0), |
| 124 | NULL((void*)0), |
| 125 | NULL((void*)0) |
| 126 | }, |
| 127 | { |
| 128 | NULL((void*)0), |
| 129 | NULL((void*)0), |
| 130 | CompositeInsertChild, |
| 131 | CompositeDeleteChild, |
| 132 | NULL((void*)0) |
| 133 | } |
| 134 | }; |
| 135 | |
| 136 | externaldef(compositewidgetclass) WidgetClass compositeWidgetClass = (WidgetClass) &compositeClassRec; |
| 137 | |
| 138 | static void InheritAllowsChangeManagedSet( |
| 139 | WidgetClass widget_class) |
| 140 | { |
| 141 | CompositeWidgetClass cc = (CompositeWidgetClass) widget_class; |
| 142 | CompositeClassExtension ext, super_ext, new_ext; |
| 143 | |
| 144 | ext = (CompositeClassExtension) |
| 145 | XtGetClassExtension(widget_class, |
| 146 | XtOffsetOf(CompositeClassRec, composite_class.extension)__builtin_offsetof(CompositeClassRec, composite_class.extension ), |
| 147 | NULLQUARK((XrmQuark) 0), 1L, 0); |
| 148 | |
| 149 | if (ext && ext->version == XtCompositeExtensionVersion2L) |
| 150 | return; |
| 151 | |
| 152 | super_ext = (CompositeClassExtension) |
| 153 | XtGetClassExtension(cc->core_class.superclass, |
| 154 | XtOffsetOf(CompositeClassRec, composite_class.extension)__builtin_offsetof(CompositeClassRec, composite_class.extension ), |
| 155 | NULLQUARK((XrmQuark) 0), 1L, 0); |
| 156 | |
| 157 | LOCK_PROCESSif(_XtProcessLock)(*_XtProcessLock)(); |
| 158 | if (super_ext && super_ext->version == XtCompositeExtensionVersion2L && |
| 159 | super_ext->record_size == sizeof(CompositeClassExtensionRec) && |
| 160 | super_ext->allows_change_managed_set) { |
| 161 | |
| 162 | new_ext = (CompositeClassExtension) |
| 163 | __XtCalloc(1, sizeof(CompositeClassExtensionRec)); |
| 164 | |
| 165 | |
| 166 | new_ext->next_extension = cc->composite_class.extension; |
| 167 | new_ext->record_type = NULLQUARK((XrmQuark) 0); |
| 168 | new_ext->version = XtCompositeExtensionVersion2L; |
| 169 | new_ext->record_size = sizeof(CompositeClassExtensionRec); |
| 170 | new_ext->accepts_objects = (ext ? ext->accepts_objects : False0); |
| 171 | new_ext->allows_change_managed_set = True1; |
| 172 | cc->composite_class.extension = (XtPointer) new_ext; |
| 173 | } |
| 174 | UNLOCK_PROCESSif(_XtProcessUnlock)(*_XtProcessUnlock)(); |
| 175 | } |
| 176 | |
| 177 | static void CompositeClassPartInitialize( |
| 178 | WidgetClass widgetClass) |
| 179 | { |
| 180 | register CompositePartPtr wcPtr; |
| 181 | register CompositePartPtr superPtr = NULL((void*)0); |
| 182 | |
| 183 | wcPtr = (CompositePartPtr) |
| 184 | &(((CompositeWidgetClass)widgetClass)->composite_class); |
| 185 | |
| 186 | if (widgetClass != compositeWidgetClass) |
| |
| 187 | |
| 188 | superPtr = (CompositePartPtr)&(((CompositeWidgetClass)widgetClass |
| 189 | ->core_class.superclass)->composite_class); |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | LOCK_PROCESSif(_XtProcessLock)(*_XtProcessLock)(); |
| 2 | Within the expansion of the macro 'LOCK_PROCESS':
|
a | Assuming '_XtProcessLock' is null |
|
| 195 | if (wcPtr->geometry_manager == XtInheritGeometryManager((XtGeometryHandler) _XtInherit)) { |
| |
| 196 | wcPtr->geometry_manager = |
| 197 | superPtr->geometry_manager; |
| 4 | Access to field 'geometry_manager' results in a dereference of a null pointer (loaded from variable 'superPtr') |
|
| 198 | } |
| 199 | |
| 200 | if (wcPtr->change_managed == XtInheritChangeManaged((XtWidgetProc) _XtInherit)) { |
| 201 | wcPtr->change_managed = |
| 202 | superPtr->change_managed; |
| 203 | InheritAllowsChangeManagedSet(widgetClass); |
| 204 | } |
| 205 | |
| 206 | if (wcPtr->insert_child == XtInheritInsertChild((XtWidgetProc) _XtInherit)) { |
| 207 | wcPtr->insert_child = superPtr->insert_child; |
| 208 | } |
| 209 | |
| 210 | if (wcPtr->delete_child == XtInheritDeleteChild((XtWidgetProc) _XtInherit)) { |
| 211 | wcPtr->delete_child = superPtr->delete_child; |
| 212 | } |
| 213 | UNLOCK_PROCESSif(_XtProcessUnlock)(*_XtProcessUnlock)(); |
| 214 | } |
| 215 | |
| 216 | static void CompositeDestroy( |
| 217 | Widget w) |
| 218 | { |
| 219 | register CompositeWidget cw = (CompositeWidget) w; |
| 220 | |
| 221 | XtFree((char *) cw->composite.children); |
| 222 | } |
| 223 | |
| 224 | static void CompositeInsertChild( |
| 225 | Widget w) |
| 226 | { |
| 227 | register Cardinal position; |
| 228 | register Cardinal i; |
| 229 | register CompositeWidget cw; |
| 230 | register WidgetList children; |
| 231 | |
| 232 | cw = (CompositeWidget) w->core.parent; |
| 233 | children = cw->composite.children; |
| 234 | |
| 235 | if (cw->composite.insert_position != NULL((void*)0)) |
| 236 | position = (*(cw->composite.insert_position))(w); |
| 237 | else |
| 238 | position = cw->composite.num_children; |
| 239 | |
| 240 | if (cw->composite.num_children == cw->composite.num_slots) { |
| 241 | |
| 242 | cw->composite.num_slots += (cw->composite.num_slots / 2) + 2; |
| 243 | cw->composite.children = children = |
| 244 | (WidgetList) XtRealloc((XtPointer) children, |
| 245 | (unsigned) (cw->composite.num_slots) * sizeof(Widget)); |
| 246 | } |
| 247 | |
| 248 | for (i = cw->composite.num_children; i > position; i--) { |
| 249 | children[i] = children[i-1]; |
| 250 | } |
| 251 | children[position] = w; |
| 252 | cw->composite.num_children++; |
| 253 | } |
| 254 | |
| 255 | static void CompositeDeleteChild( |
| 256 | Widget w) |
| 257 | { |
| 258 | register Cardinal position; |
| 259 | register Cardinal i; |
| 260 | register CompositeWidget cw; |
| 261 | |
| 262 | cw = (CompositeWidget) w->core.parent; |
| 263 | |
| 264 | for (position = 0; position < cw->composite.num_children; position++) { |
| 265 | if (cw->composite.children[position] == w) { |
| 266 | break; |
| 267 | } |
| 268 | } |
| 269 | if (position == cw->composite.num_children) return; |
| 270 | |
| 271 | |
| 272 | cw->composite.num_children--; |
| 273 | for (i = position; i < cw->composite.num_children; i++) { |
| 274 | cw->composite.children[i] = cw->composite.children[i+1]; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | |
| 279 | static void CompositeInitialize( |
| 280 | Widget requested_widget, |
| 281 | Widget new_widget, |
| 282 | ArgList args, |
| 283 | Cardinal *num_args) |
| 284 | { |
| 285 | register CompositeWidget cw; |
| 286 | |
| 287 | cw = (CompositeWidget) new_widget; |
| 288 | cw->composite.num_children = 0; |
| 289 | cw->composite.children = NULL((void*)0); |
| 290 | cw->composite.num_slots = 0; |
| 291 | } |