diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-06 02:04:52 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-06 02:04:52 +0200 |
commit | fb74fccff9e46cc6392fae262491d4b4218f4e5e (patch) | |
tree | f66f929cc02cd3b110667183929f39e5bd2231a9 /mysys | |
parent | 14810ff1d3e7d74167f59c6c4baf1f11491810f7 (diff) | |
parent | e3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4 (diff) | |
download | mariadb-git-fb74fccff9e46cc6392fae262491d4b4218f4e5e.tar.gz |
Merge with 4.0.8
BitKeeper/etc/logging_ok:
auto-union
BUILD/SETUP.sh:
Auto merged
acinclude.m4:
Auto merged
include/mysql.h:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/mi_test1.c:
Auto merged
sql/ha_berkeley.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/mini_client.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/table.cc:
Auto merged
tools/mysqlmanager.c:
Auto merged
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_compress.c | 41 | ||||
-rw-r--r-- | mysys/my_getopt.c | 4 |
2 files changed, 27 insertions, 18 deletions
diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 1e46584d525..dd076311188 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -32,24 +32,28 @@ my_bool my_compress(byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_compress"); if (*len < MIN_COMPRESS_LENGTH) + { *complen=0; + DBUG_PRINT("note",("Packet too short: Not compressed")); + } else { byte *compbuf=my_compress_alloc(packet,len,complen); if (!compbuf) - return *complen ? 0 : 1; + DBUG_RETURN(*complen ? 0 : 1); memcpy(packet,compbuf,*len); my_free(compbuf,MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) { byte *compbuf; - *complen = *len * 120 / 100 + 12; - if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME)))) + *complen= *len * 120 / 100 + 12; + if (!(compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)))) return 0; /* Not enough memory */ if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet, (uLong) *len ) != Z_OK) @@ -59,31 +63,36 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) } if (*complen >= *len) { - *complen=0; - my_free(compbuf,MYF(MY_WME)); + *complen= 0; + my_free(compbuf, MYF(MY_WME)); + DBUG_PRINT("note",("Packet got longer on compression; Not compressed")); return 0; } - swap(ulong,*len,*complen); /* *len is now packet length */ + swap(ulong, *len, *complen); /* *len is now packet length */ return compbuf; } my_bool my_uncompress (byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_uncompress"); if (*complen) /* If compressed */ { - byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME)); + byte *compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)); + int error; if (!compbuf) - return 1; /* Not enough memory */ - if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK) + DBUG_RETURN(1); /* Not enough memory */ + if ((error=uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len)) + != Z_OK) { /* Probably wrong packet */ - my_free (compbuf,MYF(MY_WME)); - return 1; + DBUG_PRINT("error",("Can't uncompress packet, error: %d",error)); + my_free(compbuf, MYF(MY_WME)); + DBUG_RETURN(1); } - *len = *complen; - memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + *len= *complen; + memcpy(packet, compbuf, *len); + my_free(compbuf, MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } #endif /* HAVE_COMPRESS */ diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index b2ee6e0f373..21adb9374ce 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -572,7 +572,7 @@ static longlong eval_num_suffix (char *argument, int *error, char *option_name) In case of an error, set error value in *err. */ -longlong getopt_ll (char *arg, const struct my_option *optp, int *err) +static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) { longlong num; @@ -596,7 +596,7 @@ longlong getopt_ll (char *arg, const struct my_option *optp, int *err) values. */ -static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err) +static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err) { ulonglong num; |