~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_lib.c

Moved base64.h to mysys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/*       Convert MSDOS-TIME to standar time_t (still needed?) */
18
18
 
19
19
#include        "mysys_priv.h"
20
 
#include        <mystrings/m_string.h>
 
20
#include        <m_string.h>
21
21
#include        <my_dir.h>      /* Structs used by my_dir,includes sys/types */
22
22
#include        "mysys_err.h"
23
23
#if defined(HAVE_DIRENT_H)
53
53
#define NAMES_START_SIZE   32768
54
54
 
55
55
 
56
 
static int comp_names(const struct fileinfo *a, const struct fileinfo *b);
 
56
static int      comp_names(struct fileinfo *a,struct fileinfo *b);
57
57
 
58
58
 
59
59
        /* We need this because program don't know with malloc we used */
66
66
                                    ALIGN_SIZE(sizeof(MY_DIR))));
67
67
    free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) + 
68
68
                          ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
69
 
    free((unsigned char*) buffer);
 
69
    my_free((uchar*) buffer,MYF(0));
70
70
  }
71
71
  return;
72
72
} /* my_dirend */
74
74
 
75
75
        /* Compare in sort of filenames */
76
76
 
77
 
static int comp_names(const struct fileinfo *a, const struct fileinfo *b)
 
77
static int comp_names(struct fileinfo *a, struct fileinfo *b)
78
78
{
79
79
  return (strcmp(a->name,b->name));
80
80
} /* comp_names */
110
110
  if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
111
111
                            ENTRIES_START_SIZE, ENTRIES_INCREMENT))
112
112
  {
113
 
    free((unsigned char*) buffer);
 
113
    my_free((uchar*) buffer,MYF(0));
114
114
    goto error;
115
115
  }
116
116
  init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
118
118
  /* MY_DIR structure is allocated and completly initialized at this point */
119
119
  result= (MY_DIR*)buffer;
120
120
 
121
 
  tmp_file= strchr(tmp_path, '\0');
 
121
  tmp_file=strend(tmp_path);
122
122
 
123
123
  dp= (struct dirent*) dirent_tmp;
124
124
  
133
133
                                               sizeof(struct stat))))
134
134
        goto error;
135
135
      
136
 
      memset(finfo.mystat, 0, sizeof(struct stat));
137
 
      my_stpcpy(tmp_file,dp->d_name);
138
 
      stat(tmp_path, finfo.mystat);
139
 
      if (!(finfo.mystat->st_mode & S_IREAD))
 
136
      bzero(finfo.mystat, sizeof(struct stat));
 
137
      VOID(strmov(tmp_file,dp->d_name));
 
138
      VOID(stat(tmp_path, finfo.mystat));
 
139
      if (!(finfo.mystat->st_mode & MY_S_IREAD))
140
140
        continue;
141
141
    }
142
142
    else
143
143
      finfo.mystat= NULL;
144
144
 
145
 
    if (push_dynamic(dir_entries_storage, (unsigned char*)&finfo))
 
145
    if (push_dynamic(dir_entries_storage, (uchar*)&finfo))
146
146
      goto error;
147
147
  }
148
148
 
190
190
 
191
191
  if (src[0] == 0)
192
192
    src= (char*) ".";                           /* Use empty as current */
193
 
  end=my_stpcpy(dst, src);
 
193
  end=strmov(dst, src);
194
194
  if (end[-1] != FN_LIBCHAR)
195
195
  {
196
196
    end[0]=FN_LIBCHAR;                          /* Add last '/' */