~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/hex_functions/hex_functions.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-05 13:28:48 UTC
  • mto: This revision was merged to the branch mainline in revision 2395.
  • Revision ID: olafvdspek@gmail.com-20110805132848-vvwjg6pgwf56xnsd
Use const char* instead of str_ref

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
 
22
 
#include <drizzled/charset_info.h>
 
22
#include <drizzled/charset.h>
23
23
#include <drizzled/function/str/strfunc.h>
24
24
#include <drizzled/internal/m_string.h>
25
25
#include <drizzled/plugin/function.h>
102
102
    if ((null_value= args[0]->null_value))
103
103
      return 0;
104
104
    ptr= internal::int64_t2str(dec,ans,16);
105
 
    if (str->copy(ans,(uint32_t) (ptr-ans),default_charset()))
106
 
      return &my_empty_string;                  // End of memory
 
105
    str->copy(ans,(uint32_t) (ptr-ans),default_charset());
107
106
    return str;
108
107
  }
109
108
 
110
109
  /* Convert given string to a hex string, character by character */
111
110
  res= args[0]->val_str(str);
112
 
  if (!res || tmp_value.alloc(res->length()*2+1))
 
111
  if (!res)
113
112
  {
114
113
    null_value=1;
115
114
    return 0;
116
115
  }
117
116
  null_value=0;
 
117
  tmp_value.alloc(res->length()*2+1);
118
118
  tmp_value.length(res->length()*2);
119
119
 
120
120
  (void) drizzled_string_to_hex((char*) tmp_value.ptr(), res->ptr(),
133
133
  assert(fixed == 1);
134
134
 
135
135
  res= args[0]->val_str(str);
136
 
  if (!res || tmp_value.alloc(length= (1+res->length())/2))
 
136
  if (!res)
137
137
  {
138
138
    null_value=1;
139
139
    return 0;
140
140
  }
 
141
  tmp_value.alloc(length= (1+res->length())/2);
141
142
 
142
143
  from= res->ptr();
143
144
  null_value= 0;