summaryrefslogtreecommitdiffstats
path: root/kde/kdebindings/fix-generator-segfaults.patch
blob: 5b69b5961648cc802018c3f2bf1c0ce3d66457ac (plain)
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
--- branches/KDE/4.5/kdebindings/generator/generators/smoke/helpers.cpp	2010/10/09 06:54:13	1184023
+++ branches/KDE/4.5/kdebindings/generator/generators/smoke/helpers.cpp	2010/10/09 06:57:13	1184024
@@ -131,10 +131,10 @@
         // map this method to the function, so we can later retrieve the header it was defined in
         globalFunctionMap[&parent->methods().last()] = &fn;
         
-        int methIndex = parent->methods().length() - 1;
+        int methIndex = parent->methods().size() - 1;
         addOverloads(meth);
         // handle the methods appended by addOverloads()
-        for (int i = parent->methods().length() - 1; i > methIndex; --i)
+        for (int i = parent->methods().size() - 1; i > methIndex; --i)
             globalFunctionMap[&parent->methods()[i]] = &fn;
 
         (*usedTypes) << meth.type();
@@ -458,7 +458,11 @@
         return munge(&resolved);
     }
 
-    if (type->pointerDepth() > 1 || (type->getClass() && type->getClass()->isTemplate() && (!Options::qtMode || (Options::qtMode && type->getClass()->name() != "QFlags"))) ||
+    if (type->name().contains("long long") || type->name() == "size_t") {
+        // Special case 'long long' types as '$'.
+        // Hack: 'size_t' isn't being fully resolved for some reason.
+        return '$';
+    } else if (type->pointerDepth() > 1 || (type->getClass() && type->getClass()->isTemplate() && (!Options::qtMode || (Options::qtMode && type->getClass()->name() != "QFlags"))) ||
         (Options::voidpTypes.contains(type->name()) && !Options::scalarTypes.contains(type->name())) )
     {
         // QString and QStringList are both mapped to Smoke::t_voidp, but QString is a scalar as well
--- branches/KDE/4.5/kdebindings/generator/type_compiler.cpp	2010/10/09 06:54:13	1184023
+++ branches/KDE/4.5/kdebindings/generator/type_compiler.cpp	2010/10/09 06:57:13	1184024
@@ -182,7 +182,7 @@
     TypeCompiler tc(m_session, m_visitor);
     tc.run(node->type_specifier, node->declarator);
     NameCompiler name_cc(m_session, m_visitor);
-    if (tc.type().isFunctionPointer())
+    if (tc.type().isFunctionPointer() && node->declarator && node->declarator->sub_declarator)
         name_cc.run(node->declarator->sub_declarator->id);
     else if (node->declarator)
         name_cc.run(node->declarator->id);
--- branches/KDE/4.5/kdebindings/generator/parser/rpp/pp-macro-expander.cpp	2010/10/09 06:54:13	1184023
+++ branches/KDE/4.5/kdebindings/generator/parser/rpp/pp-macro-expander.cpp	2010/10/09 06:57:13	1184024
@@ -268,10 +268,10 @@
         output << '\"';
 
         while (!is.atEnd()) {
-          if (input == '"') {
+          if (is == '"') {
             output << '\\' << is;
 
-          } else if (input == '\n') {
+          } else if (is == '\n') {
             output << '"' << is << '"';
 
           } else {
@@ -338,7 +338,7 @@
             
             skip_blanks(input, devnull());
             //Omit paste tokens behind empty used actuals, else we will merge with the previous text
-            if(input == '#' && (++input) == '#') {
+            if(!input.atEnd() && input == '#' && !(++input).atEnd() && input == '#') {
               ++input;
               //We have skipped a paste token
             }else{