~capttofu/drizzle/drizzle_memcached

« back to all changes in this revision

Viewing changes to plugin/uncompress/uncompressudf.cc

  • Committer: Brian Aker
  • Date: 2008-11-18 23:19:19 UTC
  • mfrom: (584.1.16 devel)
  • Revision ID: brian@tangent.org-20081118231919-w9sr347dtiwhccml
Merge of Monty's work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#define DRIZZLE_SERVER 1 /* for session variable max_allowed_packet */
17
17
#include <drizzled/server_includes.h>
 
18
#include <drizzled/session.h>
18
19
#include <drizzled/error.h>
 
20
#include <drizzled/item/strfunc.h>
19
21
 
20
22
#include <zlib.h>
21
23
 
47
49
  if (res->length() <= 4)
48
50
  {
49
51
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
50
 
                        ER_ZLIB_Z_DATA_ERROR,
51
 
                        ER(ER_ZLIB_Z_DATA_ERROR));
 
52
                        ER_ZLIB_Z_DATA_ERROR,
 
53
                        ER(ER_ZLIB_Z_DATA_ERROR));
52
54
    goto err;
53
55
  }
54
56
 
57
59
  if (new_size > current_session->variables.max_allowed_packet)
58
60
  {
59
61
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
60
 
                        ER_TOO_BIG_FOR_UNCOMPRESS,
61
 
                        ER(ER_TOO_BIG_FOR_UNCOMPRESS),
 
62
                        ER_TOO_BIG_FOR_UNCOMPRESS,
 
63
                        ER(ER_TOO_BIG_FOR_UNCOMPRESS),
62
64
                        current_session->variables.max_allowed_packet);
63
65
    goto err;
64
66
  }
66
68
    goto err;
67
69
 
68
70
  if ((err= uncompress((Byte*)buffer.ptr(), &new_size,
69
 
                       ((const Bytef*)res->ptr())+4,res->length())) == Z_OK)
 
71
                       ((const Bytef*)res->ptr())+4,res->length())) == Z_OK)
70
72
  {
71
73
    buffer.length((uint32_t) new_size);
72
74
    return &buffer;