Commit graph

13 commits

Author SHA1 Message Date
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
monty@mysql.com/nosik.monty.fi
e825879800 Remove compiler warnings
(Mostly in DBUG_PRINT() and unused arguments)
Fixed bug in query cache when used with traceing (--with-debug)
Fixed memory leak in mysqldump
Removed warnings from mysqltest scripts (replaced -- with #)
2006-11-20 22:42:06 +02:00
tsmith/tim@siva.hindu.god
fb6625e495 Merge siva.hindu.god:/usr/home/tim/m/bk/tmp/41
into  siva.hindu.god:/usr/home/tim/m/bk/tmp/50
2006-09-14 23:22:25 -06:00
tsmith/tim@siva.hindu.god
43e8890abc Merge siva.hindu.god:/usr/home/tim/m/bk/tmp/40
into  siva.hindu.god:/usr/home/tim/m/bk/tmp/41
2006-09-14 23:20:13 -06:00
tsmith/tim@siva.hindu.god
7b9f4086fa Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"
- Fix my_read/my_write to handle return values from read/write correctly
- Add debugging 'deprecated function' warning to my_lread/my_lwrite
- Add debugging 'error, read/write interrupt not handled' warning to my_quick_read/my_quick_write

There is no test case associated with these changes.  However, this is a conservative change,
and no repeatable test case is available.
2006-09-14 23:19:24 -06:00
cmiller@zippy.cornsilk.net
5a3922fbf1 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug04053/my40-bug04053
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug04053/my41-bug04053
2006-08-30 17:33:28 -04:00
cmiller@zippy.cornsilk.net
2c356ec7db Bug#4053: too many of "error 1236: 'binlog truncated in the middle of \
event' from master"

Since there is no repeatable test case, and this is obviously wrong, this is
the most conservative change that might possibly work.  

The syscall  read()  wasn't checked for a negative return value for an
interrupted read.  The kernel  sys_read()  returns -EINTR, and the "library" 
layer maps that to return value of -1 and sets  errno  to EINTR.  It's 
impossible (on Linux) for  read()  to set errno EINTR without the return 
value being -1 .

So, if we're checking for EINTR behavior, we should not require that the
return value be zero.
2006-08-30 17:28:34 -04:00
monty@mysql.com
309d691e65 Changed %lx -> 0x%lx (for easier comparison of debug files)
Cosmetic cleanups
Don't call 'delete_elements' on copy_funcs as this causes elements to be freed twice
2004-08-23 13:46:51 +03:00
monty@mashka.mysql.fi
2aecdd1a91 Big code cleanup/review before 4.0.2 release.
(All commit emails since 4.0.1 checked)
This had to be done now, before the 4.1 tree changes to much, to make it easy to propagate bug fixes to the 4.1 tree.
2002-06-11 11:20:31 +03:00
monty@hundin.mysql.fi
b658662ae4 Update copyright
Fixed memory leak on shutdown (Affects the embedded version & MyODBC)
2001-12-06 14:10:51 +02:00
sasha@mysql.sashanet.com
1a0a77389f added mysqlmanager-pwgen
added set_exec_stdout and set_exec_stderr to mysqlmanager to be able 
to redirect stdout and stderr
added support for MY_FULL_IO to my_read, so we can tell it to read
a number of bytes in as many chunks as it takes instead of one try
2001-09-22 21:47:57 -06:00
bk@work.mysql.com
f4c589ff6c Import changeset 2000-07-31 21:29:14 +02:00