~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rprev.c

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
Remove uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "heap_priv.h"
17
 
 
18
 
#include <string.h>
19
 
 
20
 
using namespace drizzled;
 
16
#include "heapdef.h"
21
17
 
22
18
        /* Read prev record for key */
23
19
 
29
25
  HP_KEYDEF *keyinfo;
30
26
 
31
27
  if (info->lastinx < 0)
32
 
    return(errno=HA_ERR_WRONG_INDEX);
 
28
    return(my_errno=HA_ERR_WRONG_INDEX);
33
29
  keyinfo = share->keydef + info->lastinx;
34
30
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
35
31
  {
36
32
    heap_rb_param custom_arg;
37
33
 
38
34
    if (info->last_pos)
39
 
      pos = (unsigned char *)tree_search_next(&keyinfo->rb_tree,
40
 
                                              &info->last_pos,
41
 
                                              offsetof(TREE_ELEMENT, right),
42
 
                                              offsetof(TREE_ELEMENT, left));
 
35
      pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
 
36
                             offsetof(TREE_ELEMENT, right),
 
37
                             offsetof(TREE_ELEMENT, left));
43
38
    else
44
39
    {
45
40
      custom_arg.keyseg = keyinfo->seg;
46
41
      custom_arg.key_length = keyinfo->length;
47
42
      custom_arg.search_flag = SEARCH_SAME;
48
 
      pos = (unsigned char *)tree_search_key(&keyinfo->rb_tree,
49
 
                                             info->lastkey, info->parents,
50
 
                                             &info->last_pos,
51
 
                                             info->last_find_flag,
52
 
                                             &custom_arg);
 
43
      pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents, 
 
44
                           &info->last_pos, info->last_find_flag, &custom_arg);
53
45
    }
54
46
    if (pos)
55
47
    {
59
51
    }
60
52
    else
61
53
    {
62
 
      errno = HA_ERR_KEY_NOT_FOUND;
 
54
      my_errno = HA_ERR_KEY_NOT_FOUND;
63
55
    }
64
56
  }
65
57
  else
74
66
    else
75
67
    {
76
68
      pos=0;                                    /* Read next after last */
77
 
      errno=HA_ERR_KEY_NOT_FOUND;
 
69
      my_errno=HA_ERR_KEY_NOT_FOUND;
78
70
    }
79
71
  }
80
72
  if (!pos)
81
73
  {
82
74
    info->update=HA_STATE_PREV_FOUND;           /* For heap_rprev */
83
 
    if (errno == HA_ERR_KEY_NOT_FOUND)
84
 
      errno=HA_ERR_END_OF_FILE;
85
 
    return(errno);
 
75
    if (my_errno == HA_ERR_KEY_NOT_FOUND)
 
76
      my_errno=HA_ERR_END_OF_FILE;
 
77
    return(my_errno);
86
78
  }
87
79
  hp_extract_record(share, record, pos);
88
80
  info->update=HA_STATE_AKTIV | HA_STATE_PREV_FOUND;