~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/compression/uncompress.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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"
21
 
#include <drizzled/session.h>
 
20
#include <config.h>
 
21
 
22
22
#include <drizzled/error.h>
23
23
#include <drizzled/function/str/strfunc.h>
24
 
#include "plugin/compression/uncompress.h"
 
24
#include <drizzled/session.h>
 
25
 
 
26
#include <plugin/compression/uncompress.h>
25
27
 
26
28
#include <zlib.h>
27
29
#include <string>
46
48
  /* If length is less than 4 bytes, data is corrupt */
47
49
  if (res->length() <= 4)
48
50
  {
49
 
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
 
51
    push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_ERROR,
50
52
                        ER_ZLIB_Z_DATA_ERROR,
51
53
                        ER(ER_ZLIB_Z_DATA_ERROR));
52
54
    goto err;
54
56
 
55
57
  /* Size of uncompressed data is stored as first 4 bytes of field */
56
58
  new_size= uint4korr(res->ptr()) & 0x3FFFFFFF;
57
 
  if (new_size > current_session->variables.max_allowed_packet)
 
59
  if (new_size > getSession().variables.max_allowed_packet)
58
60
  {
59
 
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
 
61
    push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_ERROR,
60
62
                        ER_TOO_BIG_FOR_UNCOMPRESS,
61
63
                        ER(ER_TOO_BIG_FOR_UNCOMPRESS),
62
 
                        current_session->variables.max_allowed_packet);
 
64
                        getSession().variables.max_allowed_packet);
63
65
    goto err;
64
66
  }
 
67
 
65
68
  if (buffer.realloc((uint32_t)new_size))
66
69
    goto err;
67
70
 
74
77
 
75
78
  code= ((err == Z_BUF_ERROR) ? ER_ZLIB_Z_BUF_ERROR :
76
79
         ((err == Z_MEM_ERROR) ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR));
77
 
  push_warning(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, code, ER(code));
 
80
  push_warning(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_ERROR, code, ER(code));
78
81
 
79
82
err:
80
83
  null_value= 1;