Browse Source

HPCC-8720 Add support for SET OF simpletype to embed plugins

Minor changes following code review.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
2edbeeea9c

+ 17 - 3
plugins/Rembed/Rembed.cpp

@@ -191,9 +191,9 @@ public:
             break;
             break;
         }
         }
         case type_int:
         case type_int:
-            if (elemSize == sizeof(byte))
-                FETCH_ARRAY(byte)
-            else if (elemSize == sizeof(short))
+            /* if (elemSize == sizeof(signed char))  // rcpp does not seem to support...
+                FETCH_ARRAY(signed char)
+            else */ if (elemSize == sizeof(short))
                 FETCH_ARRAY(short)
                 FETCH_ARRAY(short)
             else if (elemSize == sizeof(int))
             else if (elemSize == sizeof(int))
                 FETCH_ARRAY(int)
                 FETCH_ARRAY(int)
@@ -202,6 +202,18 @@ public:
             else
             else
                 rtlFail(0, "Rembed: Unsupported result type");
                 rtlFail(0, "Rembed: Unsupported result type");
             break;
             break;
+        case type_unsigned:
+            if (elemSize == sizeof(byte))
+                FETCH_ARRAY(byte)
+            else if (elemSize == sizeof(unsigned short))
+                FETCH_ARRAY(unsigned short)
+            else if (elemSize == sizeof(unsigned int))
+                FETCH_ARRAY(unsigned int)
+            else if (elemSize == sizeof(unsigned long))    // __int64 / long long does not work...
+                FETCH_ARRAY(unsigned long)
+            else
+                rtlFail(0, "Rembed: Unsupported result type");
+            break;
         case type_real:
         case type_real:
             if (elemSize == sizeof(float))
             if (elemSize == sizeof(float))
                 FETCH_ARRAY(float)
                 FETCH_ARRAY(float)
@@ -266,6 +278,7 @@ public:
         }
         }
         default:
         default:
             rtlFail(0, "REmbed: Unsupported result type");
             rtlFail(0, "REmbed: Unsupported result type");
+            break;
         }
         }
     }
     }
 
 
@@ -393,6 +406,7 @@ public:
         }
         }
         default:
         default:
             rtlFail(0, "REmbed: Unsupported parameter type");
             rtlFail(0, "REmbed: Unsupported parameter type");
+            break;
         }
         }
     }
     }
 
 

+ 2 - 2
plugins/javaembed/javaembed.cpp

@@ -445,12 +445,12 @@ public:
                         {
                         {
                             if (elemSize == UNKNOWN_LENGTH)
                             if (elemSize == UNKNOWN_LENGTH)
                             {
                             {
-                                out.ensureAvailable(outBytes + numchars*sizeof(UChar) + sizeof(size32_t));
-                                outData = out.getbytes() + outBytes;
                                 // You can't assume that number of chars in utf8 matches number in unicode16 ...
                                 // You can't assume that number of chars in utf8 matches number in unicode16 ...
                                 size32_t numchars16;
                                 size32_t numchars16;
                                 rtlDataAttr unicode16;
                                 rtlDataAttr unicode16;
                                 rtlUtf8ToUnicodeX(numchars16, unicode16.refustr(), numchars, text);
                                 rtlUtf8ToUnicodeX(numchars16, unicode16.refustr(), numchars, text);
+                                out.ensureAvailable(outBytes + numchars16*sizeof(UChar) + sizeof(size32_t));
+                                outData = out.getbytes() + outBytes;
                                 * (size32_t *) outData = numchars16;
                                 * (size32_t *) outData = numchars16;
                                 rtlUnicodeToUnicode(numchars16, (UChar *) (outData+sizeof(size32_t)), numchars16, unicode16.getustr());
                                 rtlUnicodeToUnicode(numchars16, (UChar *) (outData+sizeof(size32_t)), numchars16, unicode16.getustr());
                                 outBytes += numchars16*sizeof(UChar) + sizeof(size32_t);
                                 outBytes += numchars16*sizeof(UChar) + sizeof(size32_t);

+ 1 - 1
plugins/pyembed/pyembed.cpp

@@ -538,7 +538,7 @@ public:
         size32_t sizeBytes = rtlUtf8Size(chars, val);
         size32_t sizeBytes = rtlUtf8Size(chars, val);
         PyObject *vval = PyUnicode_FromStringAndSize(val, sizeBytes);   // NOTE - requires size in bytes not chars
         PyObject *vval = PyUnicode_FromStringAndSize(val, sizeBytes);   // NOTE - requires size in bytes not chars
         checkPythonError();
         checkPythonError();
-        addArg(name, vval);   // NOTE - requires size in bytes not chars
+        addArg(name, vval);
     }
     }
 
 
     virtual void bindUnicodeParam(const char *name, size32_t chars, const UChar *val)
     virtual void bindUnicodeParam(const char *name, size32_t chars, const UChar *val)

+ 1 - 1
plugins/v8embed/v8embed.cpp

@@ -167,7 +167,7 @@ public:
                     thisSize = (* (size32_t *) inData) * sizeof(UChar) + sizeof(size32_t);
                     thisSize = (* (size32_t *) inData) * sizeof(UChar) + sizeof(size32_t);
                     break;
                     break;
                 case type_utf8:
                 case type_utf8:
-                    thisSize = rtlUtf8Size(* (size32_t *) inData, inData + sizeof(size32_t)) + sizeof(size32_t);;
+                    thisSize = rtlUtf8Size(* (size32_t *) inData, inData + sizeof(size32_t)) + sizeof(size32_t);
                     break;
                     break;
                 default:
                 default:
                     rtlFail(0, "v8embed: Unsupported parameter type");
                     rtlFail(0, "v8embed: Unsupported parameter type");