~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/command.cc

  • Committer: Brian Aker
  • Date: 2011-12-19 16:28:27 UTC
  • mto: (2478.1.1 drizzle-build)
  • mto: This revision was merged to the branch mainline in revision 2478.
  • Revision ID: brian@tangent.org-20111219162827-bfwc9zzfk10omyil
Null safety fix for libdrizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
 
89
89
drizzle_return_t drizzle_state_command_read(drizzle_con_st *con)
90
90
{
 
91
  if (con == NULL)
 
92
  {
 
93
    return DRIZZLE_RETURN_INVALID_ARGUMENT;
 
94
  }
 
95
 
91
96
  drizzle_log_debug(con->drizzle, "drizzle_state_command_read");
92
97
 
93
98
  if (con->buffer_size == 0)
135
140
  size_t free_size;
136
141
  drizzle_return_t ret;
137
142
 
 
143
  if (con == NULL)
 
144
  {
 
145
    return DRIZZLE_RETURN_INVALID_ARGUMENT;
 
146
  }
 
147
 
138
148
  drizzle_log_debug(con->drizzle, "drizzle_state_command_write");
139
149
 
140
150
  if (con->command_data == NULL && con->command_total != 0 &&
149
159
    start= con->buffer;
150
160
  }
151
161
  else
 
162
  {
152
163
    start= con->buffer_ptr + con->buffer_size;
 
164
  }
153
165
 
154
166
  if (con->command_offset == 0)
155
167
  {
175
187
    ptr= start;
176
188
    ptr[3]= 0;
177
189
    if (con->options & DRIZZLE_CON_MYSQL)
 
190
    {
178
191
      ptr[4]= (uint8_t)(con->command);
 
192
    }
179
193
    else
 
194
    {
180
195
      ptr[4]= (uint8_t)(_command_drizzle_map[con->command]);
 
196
    }
181
197
    ptr+= 5;
182
198
 
183
199
    if (con->command == DRIZZLE_COMMAND_CHANGE_USER)