API Record to Blob, BLOB to text and back = crash

View: New views
1 Messages — Rating Filter:   Alert me  

API Record to Blob, BLOB to text and back = crash

by Dan Katz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sending a record to a blob, compressing the blob, calling blob to  
text, sticking the text in the body of an email, receiving the email  
with a different app, and frequently crashing when pulling the record  
out and saving it. Using 2004.8 on Mac OS 10.5.8 and Win XP. When it  
works the records are received in perfect condition.

C_LONGINT($tableNum;$recordNum;$1;$2;$error)
C_BLOB($blob)
C_POINTER($tablePtr)
C_TEXT($text;$0)

$tableNum:=$1
$recordNum:=$2
$text:=""

SET BLOB SIZE($blob;0)

$tablePtr:=Table($tableNum)
GOTO RECORD($tablePtr->;$recordNum)
$error:=API Record To Blob ($tableNum;$blob)

if($error=0)
   COMPRESS BLOB($blob)
   $text:=BLOB to text($blob;Text without length )
end if
$0:=$text


When the email is received a record is created, then this is called:

C_LONGINT($tableNum;$1;$compressed;$expandedSize;$currentSize)
C_TEXT($2;$text)
C_BOOLEAN($0)

C_BLOB($blob)

$tableNum:=$1
$text:=$2

SET BLOB SIZE($blob;0)
TEXT TO BLOB($text;$blob;Text without length )
BLOB PROPERTIES($blob;$compressed;$expandedSize;$currentSize)
If ($compressed # Is not compressed )
   EXPAND BLOB($blob)
End if
$error:=API Blob To Record ($tableNum;$blob)

SET BLOB SIZE($blob;0)
$0:=($error=0)

I bumped the process stack to 512K. The records tend to be around  
350-450 bytes before compression, no pictures or subtables. i stuck in  
some logging code and the crash happens at various points within the  
method or just after the record is saved.

What am I doing wrong?

thanks,
Dan


++++++++++++++++++++++++++++++++++
  Dan Katz
  Outside Technology
  San Anselmo, CA

  http://www.outsidetech.com
++++++++++++++++++++++++++++++++++


**********************************************************************
Upgrade to 4D v11 SQL before 4D 2004
upgrade prices increase - http://www.4d.com 
   

4D Internet Users Group (4D iNUG)
FAQ:    http://www.4D.com/support/faqnug.html
Unsub:  mailto:4D_Pub-Unsubscribe@...
Post: mailto:4D_Pub@...
Options: https://lists.4d.com/mailman/listinfo/4d_pub
**********************************************************************