Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE : C / external procedure puzzle for the C guru's

RE : C / external procedure puzzle for the C guru's

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Wed, 31 May 2000 10:39:38 +0200
Message-Id: <10514.107220@fatcity.com>


Jared,

> When I modify it for use in a shared library, the function
> has the habit of returning data that is too short. It appears
> that whenever an encypted character is ascii character 10, the
> rest of the string is truncated.

[snip]
> create or replace package crypt
> is
> function rc4( key_in varchar2, data_in varchar2 ) return varchar2;
> --pragma restrict_references( rc4, wnds, rnds, wnps );
> end;
> /
>

 I think that your problem is with defining the function to return varchar2 - If 0's can occur in the string, it should return raw. For C, strings exist only has such when you refer to them as "string" (between double quotes), when you pass them to a string function (strlen() and the like) or when you format them with "%s" - that's about the only cases when the final '\0' has a special meaning in the array of characters. Oracle makes internally much more differences between types than does C, it has at least four or five internal types which are usually mapped to (unsigned) char * - RAW included.

-- 
HTH,

  Stephane Faroult
  email: sfaroult_at_oriolecorp.com 
  Oriole Corporation
  Voice:  +44  (0) 7050-696-269 
  Fax:    +44  (0) 7050-696-449 
  Performance Tools & Free Scripts
------------------------------------------------------------------
http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs
------------------------------------------------------------------
Received on Wed May 31 2000 - 03:39:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US