[q-lang-cvs] qt-q/src smokeqt.i,1.25,1.26
                
                Brought to you by:
                
                    agraef
                    
                
            
            
        
        
        
    | 
      
      
      From: Albert G. <ag...@us...> - 2007-11-03 22:26:53
      
     | 
| Update of /cvsroot/q-lang/qt-q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17865 Modified Files: smokeqt.i Log Message: fix up null pointer support Index: smokeqt.i =================================================================== RCS file: /cvsroot/q-lang/qt-q/src/smokeqt.i,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** smokeqt.i 3 Nov 2007 10:39:46 -0000 1.25 --- smokeqt.i 3 Nov 2007 22:26:49 -0000 1.26 *************** *** 246,250 **** QNetworkOperation>, -*, -& nil NULL class pointer ! 0 other NULL pointer (char* and other "scalar" pointers) NOTES: 1. Generally, the supported types of C++ pointers and references are --- 246,250 ---- QNetworkOperation>, -*, -& nil NULL class pointer ! nilptr other NULL pointer (char* and other "scalar" pointers) NOTES: 1. Generally, the supported types of C++ pointers and references are *************** *** 300,308 **** This is most useful for passing a NULL pointer for the 'parent' parameter of QWidget constructors. Similarly, other NULL pointers (char*, etc.) can ! be passed as the integer 0. CAVEAT: Passing a NULL pointer to methods which ! are not prepared to handle them will crash your application. */ ! // special constructors for byte string references ! public const bytev X, intv X; // convenience functions to create QRgb and QCOORD byte strings --- 300,308 ---- This is most useful for passing a NULL pointer for the 'parent' parameter of QWidget constructors. Similarly, other NULL pointers (char*, etc.) can ! be passed as the symbol nilptr. CAVEAT: Passing a NULL pointer to methods ! which are not prepared to handle them will crash your application. */ ! // special constructors for NULL pointers and byte string references ! public const nilptr, bytev X, intv X; // convenience functions to create QRgb and QCOORD byte strings *************** *** 3606,3609 **** --- 3606,3614 ---- arg.conv_table = conv_str; return '$'; + } else if (issym(x, __sym(nilptr))) { + // scalar NULL pointer + arg.flags = Smoke::t_voidp; + arg.arg.s_voidp = NULL; + return '$'; } else if (isbstr(x, &mval)) { // QByteArray *************** *** 3759,3767 **** } return 1; - } else if ((type.flags & Smoke::tf_ref) == Smoke::tf_ptr) { - /* as a special case, we allow the scalar 0 to be passed as a NULL - pointer */ - out.s_voidp = NULL; - return 1; } else return 0; --- 3764,3767 ---- *************** *** 3777,3781 **** case Smoke::t_voidp: /* generic pointer value; consult conversions table */ ! if (q2c_conv(in.conv_table, in.x, type.name, meth, in.arg.s_voidp, in.from_cval, in.free)) { out.s_voidp = in.arg.s_voidp; --- 3777,3782 ---- case Smoke::t_voidp: /* generic pointer value; consult conversions table */ ! if (issym(in.x, __sym(nilptr)) || ! q2c_conv(in.conv_table, in.x, type.name, meth, in.arg.s_voidp, in.from_cval, in.free)) { out.s_voidp = in.arg.s_voidp; |