~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove().
Adding non-const version of String::ptr() to provide covariance on const:ness.

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
  my_b_clear(&buffpek_pointers);
132
132
  buffpek=0;
133
133
  error= 1;
134
 
  memset((char*) &param, 0, sizeof(param));
 
134
  memset(&param, 0, sizeof(param));
135
135
  param.sort_length= sortlength(thd, sortorder, s_length, &multi_byte_charset);
136
136
  param.ref_length= table->file->ref_length;
137
137
  param.addon_field= 0;
693
693
          if (sort_field->reverse)
694
694
            memset(to, 255, sort_field->length+1);
695
695
          else
696
 
            memset((char*) to, 0, sort_field->length+1);
 
696
            memset(to, 0, sort_field->length+1);
697
697
          to+= sort_field->length+1;
698
698
          continue;
699
699
        }
722
722
        if (!res)
723
723
        {
724
724
          if (maybe_null)
725
 
            memset((char*) to-1, 0, sort_field->length+1);
 
725
            memset(to-1, 0, sort_field->length+1);
726
726
          else
727
727
          {
728
728
            /* purecov: begin deadcode */
732
732
              This code is here mainly to avoid a hard crash in this case.
733
733
            */
734
734
            assert(0);
735
 
            memset((char*) to, 0, sort_field->length);  // Avoid crash
 
735
            memset(to, 0, sort_field->length);  // Avoid crash
736
736
            /* purecov: end */
737
737
          }
738
738
          break;
781
781
            if (item->null_value)
782
782
            {
783
783
              if (maybe_null)
784
 
                memset((char*) to-1, 0, sort_field->length+1);
 
784
                memset(to-1, 0, sort_field->length+1);
785
785
              else
786
786
              {
787
 
                memset((char*) to, 0, sort_field->length);
 
787
                memset(to, 0, sort_field->length);
788
788
              }
789
789
              break;
790
790
            }
819
819
          {
820
820
            if (item->null_value)
821
821
            { 
822
 
              memset((char*)to, 0, sort_field->length+1);
 
822
              memset(to, 0, sort_field->length+1);
823
823
              to++;
824
824
              break;
825
825
            }
837
837
          {
838
838
            if (item->null_value)
839
839
            {
840
 
              memset((char*) to, 0, sort_field->length+1);
 
840
              memset(to, 0, sort_field->length+1);
841
841
              to++;
842
842
              break;
843
843
            }
879
879
    SORT_ADDON_FIELD *addonf= param->addon_field;
880
880
    uchar *nulls= to;
881
881
    assert(addonf != 0);
882
 
    memset((char *) nulls, 0, addonf->offset);
 
882
    memset(nulls, 0, addonf->offset);
883
883
    to+= addonf->offset;
884
884
    for ( ; (field= addonf->field) ; addonf++)
885
885
    {
908
908
  else
909
909
  {
910
910
    /* Save filepos last */
911
 
    memcpy((uchar*) to, ref_pos, (size_t) param->ref_length);
 
911
    memcpy(to, ref_pos, (size_t) param->ref_length);
912
912
  }
913
913
  return;
914
914
}
1214
1214
        if (!(*cmp)(first_cmp_arg, &(param->unique_buff),
1215
1215
                    (uchar**) &buffpek->key))
1216
1216
              goto skip_duplicate;
1217
 
            memcpy(param->unique_buff, (uchar*) buffpek->key, rec_length);
 
1217
            memcpy(param->unique_buff, buffpek->key, rec_length);
1218
1218
      }
1219
1219
      if (flag == 0)
1220
1220
      {
1584
1584
  if (nr == 0.0)
1585
1585
  {                                             /* Change to zero string */
1586
1586
    tmp[0]=(uchar) 128;
1587
 
    memset((char*) tmp+1, 0, sizeof(nr)-1);
 
1587
    memset(tmp+1, 0, sizeof(nr)-1);
1588
1588
  }
1589
1589
  else
1590
1590
  {