com gtk/php-gtk: Return NULL in unhandled cases. It's probably better not to return objects out of thin air...: ext/gtk+/gdk.overrides

[email protected] (David Soria Parra) Wed, 28 Sep 2005 12:26:31 +0000
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    a2b591515d161e4270380f6a9282dcc12e78235c=0AAuthor:    Steph Fox =
<[email protected]>         Wed, 28 Sep 2005 12:26:31 +0000=0AParents:   25b5161=
b3502a90706b208da680957cbaf097457=0ABranches:  master=0A=0ALink:       http=
://git.php.net/?p=3Dgtk/php-gtk.git;a=3Dcommitdiff;h=3Da2b591515d161e427038=
0f6a9282dcc12e78235c=0A=0ALog:=0AReturn NULL in unhandled cases.  It's prob=
ably better not to return objects out of thin air...=0A=0AChanged paths:=0A=
  M  ext/gtk+/gdk.overrides=0A=0A=0ADiff:=0Aa2b591515d161e4270380f6a9282dcc=
12e78235c=0Adiff --git a/ext/gtk+/gdk.overrides b/ext/gtk+/gdk.overrides=0A=
index f08b61d..f264920 100644=0A--- a/ext/gtk+/gdk.overrides=0A+++ b/ext/gt=
k+/gdk.overrides=0A@@ -308,7 +308,7 @@ static zval* phpg_gdkevent_read_prop=
erty_handler(zval *object, zval *member, int=0A                 phpg_gboxed=
_new(&result, GDK_TYPE_RECTANGLE, &event->expose.area, TRUE, TRUE TSRMLS_CC=
);=0A             } else if (!strcmp(name, "region")) { /* GdkRegion is a s=
truct */=0A                 ALLOC_ZVAL(result);=0A-                phpg_gob=
ject_new(&result, (GObject*)event->expose.region TSRMLS_CC);=0A+           =
     ZVAL_NULL(result);=0A             } else if (!strcmp(name, "count")) {=
=0A                 ALLOC_ZVAL(result);=0A                 ZVAL_LONG(result=
, event->expose.count);=0A@@ -488,7 +488,7 @@ static zval* phpg_gdkevent_re=
ad_property_handler(zval *object, zval *member, int=0A         case GDK_PRO=
PERTY_NOTIFY:=0A             if (!strcmp(name, "atom")) { /* GdkAtom is a s=
truct */=0A                 ALLOC_ZVAL(result);=0A-                phpg_gob=
ject_new(&result, (GObject *)event->property.atom TSRMLS_CC);=0A+          =
      ZVAL_NULL(result);=0A             } else if (!strcmp(name, "time")) {=
=0A                 ALLOC_ZVAL(result);=0A                 ZVAL_LONG(result=
, event->property.time);=0A@@ -503,19 +503,19 @@ static zval* phpg_gdkevent=
_read_property_handler(zval *object, zval *member, int=0A         case GDK_=
SELECTION_NOTIFY:=0A             if (!strcmp(name, "selection")) { /* GdkAt=
om is a struct */=0A                 ALLOC_ZVAL(result);=0A-               =
 phpg_gobject_new(&result, (GObject *)event->selection.selection TSRMLS_CC)=
;=0A+                ZVAL_NULL(result);=0A             } else if (!strcmp(n=
ame, "target")) { /* GdkAtom */=0A                 ALLOC_ZVAL(result);=0A- =
               phpg_gobject_new(&result, (GObject *)event->selection.target=
 TSRMLS_CC);=0A+                ZVAL_NULL(result);=0A             } else if=
 (!strcmp(name, "property")) { /* GdkAtom */=0A                 ALLOC_ZVAL(=
result);=0A-                phpg_gobject_new(&result, (GObject *)event->sel=
ection.property TSRMLS_CC);=0A+                ZVAL_NULL(result);=0A       =
      } else if (!strcmp(name, "time")) {=0A                 ALLOC_ZVAL(res=
ult);=0A                 ZVAL_LONG(result, event->selection.time);=0A      =
       } else if (!strcmp(name, "requestor")) { /* GdkNativeWindow can be e=
ither pointer or uint */=0A                 ALLOC_ZVAL(result);=0A-        =
        ZVAL_LONG(result, event->selection.requestor);=0A+                Z=
VAL_NULL(result);=0A             }=0A             break;=0A =0A@@ -538,7 +5=
38,7 @@ static zval* phpg_gdkevent_read_property_handler(zval *object, zval=
 *member, int=0A         case GDK_DROP_FINISHED:=0A             if (!strcmp=
(name, "context")) { /* GdkDragContext is a struct */=0A                 AL=
LOC_ZVAL(result);=0A-                phpg_gobject_new(&result, (GObject*)ev=
ent->dnd.context TSRMLS_CC);=0A+                ZVAL_NULL(result);=0A      =
       } else if (!strcmp(name, "time")) {=0A                 ALLOC_ZVAL(re=
sult);=0A                 ZVAL_LONG(result, event->dnd.time);=0A@@ -554,7 +=
554,7 @@ static zval* phpg_gdkevent_read_property_handler(zval *object, zva=
l *member, int=0A         case GDK_CLIENT_EVENT:=0A             if (!strcmp=
(name, "message_type")) { /* GdkAtom is a struct */=0A                 ALLO=
C_ZVAL(result);=0A-                phpg_gobject_new(&result, (GObject*)even=
t->client.message_type TSRMLS_CC);=0A+                ZVAL_NULL(result);=0A=
             } else if (!strcmp(name, "data_format")) {=0A                 =
ALLOC_ZVAL(result);=0A                 ZVAL_LONG(result, event->client.data=
_format);=0A@@ -625,13 +625,13 @@ static zval* phpg_gdkevent_read_property_=
handler(zval *object, zval *member, int=0A         case GDK_OWNER_CHANGE:=
=0A             if (!strcmp(name, "owner")) { /* GdkNativeWindow can be poi=
nter or uint ??! */=0A                 ALLOC_ZVAL(result);=0A-             =
   ZVAL_LONG(result, event->owner_change.owner);=0A+                ZVAL_NU=
LL(result);=0A             } else if (!strcmp(name, "reason")) {=0A        =
         ALLOC_ZVAL(result);=0A                 ZVAL_LONG(result, event->ow=
ner_change.reason);=0A             } else if (!strcmp(name, "selection")) {=
 /* GdkAtom is a struct */=0A                 ALLOC_ZVAL(result);=0A-      =
          phpg_gobject_new(&result, (GObject *)event->owner_change.selectio=
n TSRMLS_CC);=0A+                ZVAL_NULL(result);=0A             } else i=
f (!strcmp(name, "time")) {=0A                 ALLOC_ZVAL(result);=0A      =
           ZVAL_LONG(result, event->owner_change.time);=0A