~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_cache.c

  • Committer: Monty Taylor
  • Date: 2008-07-16 19:10:24 UTC
  • mfrom: (51.1.127 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: monty@inaugust.com-20080716191024-prjgoh7fbri7rx26
MergedĀ fromĀ remove-dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
  uint read_length,in_buff_length;
42
42
  my_off_t offset;
43
43
  uchar *in_buff_pos;
44
 
  DBUG_ENTER("_mi_read_cache");
45
44
 
46
45
  if (pos < info->pos_in_file)
47
46
  {
50
49
      read_length=(uint) (info->pos_in_file-pos);
51
50
    info->seek_not_done=1;
52
51
    if (my_pread(info->file,buff,read_length,pos,MYF(MY_NABP)))
53
 
      DBUG_RETURN(1);
 
52
      return(1);
54
53
    if (!(length-=read_length))
55
 
      DBUG_RETURN(0);
 
54
      return(0);
56
55
    pos+=read_length;
57
56
    buff+=read_length;
58
57
  }
64
63
    in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos));
65
64
    memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
66
65
    if (!(length-=in_buff_length))
67
 
      DBUG_RETURN(0);
 
66
      return(0);
68
67
    pos+=in_buff_length;
69
68
    buff+=in_buff_length;
70
69
  }
82
81
    else
83
82
      info->read_pos=info->read_end;                    /* All block used */
84
83
    if (!(*info->read_function)(info,buff,length))
85
 
      DBUG_RETURN(0);
 
84
      return(0);
86
85
    read_length=info->error;
87
86
  }
88
87
  else
89
88
  {
90
89
    info->seek_not_done=1;
91
90
    if ((read_length=my_pread(info->file,buff,length,pos,MYF(0))) == length)
92
 
      DBUG_RETURN(0);
 
91
      return(0);
93
92
  }
94
93
  if (!(flag & READING_HEADER) || (int) read_length == -1 ||
95
94
      read_length+in_buff_length < 3)
96
95
  {
97
 
    DBUG_PRINT("error",
98
 
               ("Error %d reading next-multi-part block (Got %d bytes)",
99
 
                my_errno, (int) read_length));
100
96
    if (!my_errno || my_errno == -1)
101
97
      my_errno=HA_ERR_WRONG_IN_RECORD;
102
 
    DBUG_RETURN(1);
 
98
    return(1);
103
99
  }
104
100
  bzero(buff+read_length,MI_BLOCK_INFO_HEADER_LENGTH - in_buff_length -
105
101
        read_length);
106
 
  DBUG_RETURN(0);
 
102
  return(0);
107
103
} /* _mi_read_cache */