List:Commits« Previous MessageNext Message »
From:pekka Date:February 22 2007 12:39pm
Subject:bk commit into 5.1 tree (pekka:1.2453)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-22 12:38:44+01:00, pekka@stripped +1 -0
  ndb - rel5.1.16 NdbRecAttr print of blob length assumed uint64 aligned buffer

  storage/ndb/src/ndbapi/NdbRecAttr.cpp@stripped, 2007-02-22 12:37:54+01:00,
pekka@stripped +16 -16
    ndb - rel5.1.16 NdbRecAttr print of blob length assumed uint64 aligned buffer

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/export/home/space/pekka/ndb/version/my51-rel

--- 1.32/storage/ndb/src/ndbapi/NdbRecAttr.cpp	2007-02-22 12:39:14 +01:00
+++ 1.33/storage/ndb/src/ndbapi/NdbRecAttr.cpp	2007-02-22 12:39:14 +01:00
@@ -343,24 +343,24 @@
     }
     break;
     case NdbDictionary::Column::Blob:
-    {
-      const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef();
-      out << h->length << ":";
-      const unsigned char* p = (const unsigned char*)(h + 1);
-      unsigned n = r.get_size_in_bytes() - sizeof(*h);
-      for (unsigned k = 0; k < n && k < h->length; k++)
-	out.print("%02X", (int)p[k]);
-      j = length;
-    }
-    break;
     case NdbDictionary::Column::Text:
     {
-      const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef();
-      out << h->length << ":";
-      const unsigned char* p = (const unsigned char*)(h + 1);
-      unsigned n = r.get_size_in_bytes() - sizeof(*h);
-      for (unsigned k = 0; k < n && k < h->length; k++)
-	out.print("%c", (int)p[k]);
+      // user defined aRef() may not be aligned to Uint64
+      NdbBlob::Head head;
+      memcpy(&head, r.aRef(), sizeof(head));
+      out << head.length << ":";
+      const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head);
+      if (r.get_size_in_bytes() < sizeof(head))
+        out << "***error***"; // really cannot happen
+      else {
+        unsigned n = r.get_size_in_bytes() - sizeof(head);
+        for (unsigned k = 0; k < n && k < head.length; k++) {
+          if (r.getType() == NdbDictionary::Column::Blob)
+            out.print("%02X", (int)p[k]);
+          else
+            out.print("%c", (int)p[k]);
+        }
+      }
       j = length;
     }
     break;
Thread
bk commit into 5.1 tree (pekka:1.2453)pekka22 Feb