~mkindahl/drizzle/remove-mem-casts

« back to all changes in this revision

Viewing changes to server/field/short.cc

  • Committer: Brian Aker
  • Date: 2008-07-23 00:11:39 UTC
  • Revision ID: brian@tangent.org-20080723001139-967ewfngqqotwb6e
Removed final uint dead types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
int Field_short::store(double nr)
52
52
{
53
53
  int error= 0;
54
 
  int16 res;
 
54
  int16_t res;
55
55
  nr=rint(nr);
56
56
  if (unsigned_flag)
57
57
  {
63
63
    }
64
64
    else if (nr > (double) UINT16_MAX)
65
65
    {
66
 
      res=(int16) UINT16_MAX;
 
66
      res=(int16_t) UINT16_MAX;
67
67
      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
68
68
      error= 1;
69
69
    }
70
70
    else
71
 
      res=(int16) (uint16) nr;
 
71
      res=(int16_t) (uint16_t) nr;
72
72
  }
73
73
  else
74
74
  {
85
85
      error= 1;
86
86
    }
87
87
    else
88
 
      res=(int16) (int) nr;
 
88
      res=(int16_t) (int) nr;
89
89
  }
90
90
#ifdef WORDS_BIGENDIAN
91
91
  if (table->s->db_low_byte_first)
102
102
int Field_short::store(int64_t nr, bool unsigned_val)
103
103
{
104
104
  int error= 0;
105
 
  int16 res;
 
105
  int16_t res;
106
106
 
107
107
  if (unsigned_flag)
108
108
  {
114
114
    }
115
115
    else if ((uint64_t) nr > (uint64_t) UINT16_MAX)
116
116
    {
117
 
      res=(int16) UINT16_MAX;
 
117
      res=(int16_t) UINT16_MAX;
118
118
      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
119
119
      error= 1;
120
120
    }
121
121
    else
122
 
      res=(int16) (uint16) nr;
 
122
      res=(int16_t) (uint16_t) nr;
123
123
  }
124
124
  else
125
125
  {
139
139
      error= 1;
140
140
    }
141
141
    else
142
 
      res=(int16) nr;
 
142
      res=(int16_t) nr;
143
143
  }
144
144
#ifdef WORDS_BIGENDIAN
145
145
  if (table->s->db_low_byte_first)
196
196
 
197
197
  if (unsigned_flag)
198
198
    length=(uint) cs->cset->long10_to_str(cs, to, mlength, 10, 
199
 
                                          (long) (uint16) j);
 
199
                                          (long) (uint16_t) j);
200
200
  else
201
201
    length=(uint) cs->cset->long10_to_str(cs, to, mlength,-10, (long) j);
202
202
  val_buffer->length(length);