~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

Merged build changes from Antony.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
*/
23
23
 
24
24
#include "mysql_priv.h"
25
 
#include <m_ctype.h>
26
25
#include "sql_sort.h"
27
26
 
28
27
/// How to write record_ref.
131
130
  my_b_clear(&buffpek_pointers);
132
131
  buffpek=0;
133
132
  error= 1;
134
 
  bzero((char*) &param,sizeof(param));
 
133
  memset((char*) &param, 0, sizeof(param));
135
134
  param.sort_length= sortlength(thd, sortorder, s_length, &multi_byte_charset);
136
135
  param.ref_length= table->file->ref_length;
137
136
  param.addon_field= 0;
691
690
        if (field->is_null())
692
691
        {
693
692
          if (sort_field->reverse)
694
 
            bfill(to,sort_field->length+1,(char) 255);
 
693
            memset(to, 255, sort_field->length+1);
695
694
          else
696
 
            bzero((char*) to,sort_field->length+1);
 
695
            memset((char*) to, 0, sort_field->length+1);
697
696
          to+= sort_field->length+1;
698
697
          continue;
699
698
        }
722
721
        if (!res)
723
722
        {
724
723
          if (maybe_null)
725
 
            bzero((char*) to-1,sort_field->length+1);
 
724
            memset((char*) to-1, 0, sort_field->length+1);
726
725
          else
727
726
          {
728
727
            /* purecov: begin deadcode */
732
731
              This code is here mainly to avoid a hard crash in this case.
733
732
            */
734
733
            assert(0);
735
 
            bzero((char*) to,sort_field->length);       // Avoid crash
 
734
            memset((char*) to, 0, sort_field->length);  // Avoid crash
736
735
            /* purecov: end */
737
736
          }
738
737
          break;
781
780
            if (item->null_value)
782
781
            {
783
782
              if (maybe_null)
784
 
                bzero((char*) to-1,sort_field->length+1);
 
783
                memset((char*) to-1, 0, sort_field->length+1);
785
784
              else
786
785
              {
787
 
                bzero((char*) to,sort_field->length);
 
786
                memset((char*) to, 0, sort_field->length);
788
787
              }
789
788
              break;
790
789
            }
819
818
          {
820
819
            if (item->null_value)
821
820
            { 
822
 
              bzero((char*)to, sort_field->length+1);
 
821
              memset((char*)to, 0, sort_field->length+1);
823
822
              to++;
824
823
              break;
825
824
            }
837
836
          {
838
837
            if (item->null_value)
839
838
            {
840
 
              bzero((char*) to,sort_field->length+1);
 
839
              memset((char*) to, 0, sort_field->length+1);
841
840
              to++;
842
841
              break;
843
842
            }
879
878
    SORT_ADDON_FIELD *addonf= param->addon_field;
880
879
    uchar *nulls= to;
881
880
    assert(addonf != 0);
882
 
    bzero((char *) nulls, addonf->offset);
 
881
    memset((char *) nulls, 0, addonf->offset);
883
882
    to+= addonf->offset;
884
883
    for ( ; (field= addonf->field) ; addonf++)
885
884
    {
887
886
      {
888
887
        nulls[addonf->null_offset]|= addonf->null_bit;
889
888
#ifdef HAVE_purify
890
 
        bzero(to, addonf->length);
 
889
        memset(to, 0, addonf->length);
891
890
#endif
892
891
      }
893
892
      else
897
896
        uint length= (uint) ((to + addonf->length) - end);
898
897
        assert((int) length >= 0);
899
898
        if (length)
900
 
          bzero(end, length);
 
899
          memset(end, 0, length);
901
900
#else
902
901
        (void) field->pack(to, field->ptr);
903
902
#endif
1584
1583
  if (nr == 0.0)
1585
1584
  {                                             /* Change to zero string */
1586
1585
    tmp[0]=(uchar) 128;
1587
 
    bzero((char*) tmp+1,sizeof(nr)-1);
 
1586
    memset((char*) tmp+1, 0, sizeof(nr)-1);
1588
1587
  }
1589
1588
  else
1590
1589
  {
1591
1590
#ifdef WORDS_BIGENDIAN
1592
 
    memcpy_fixed(tmp,&nr,sizeof(nr));
 
1591
    memcpy(tmp,&nr,sizeof(nr));
1593
1592
#else
1594
1593
    {
1595
1594
      uchar *ptr= (uchar*) &nr;