~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_fstream.c

  • Committer: Jay Pipes
  • Date: 2008-07-17 21:18:07 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717211807-k9cwb1m2wi7ys9fq
Phase 6 - Remove DBUG from mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags)
46
46
{
47
47
  size_t readbytes;
48
 
  DBUG_ENTER("my_fread");
49
 
  DBUG_PRINT("my",("stream: 0x%lx  Buffer: 0x%lx  Count: %u  MyFlags: %d",
50
 
                   (long) stream, (long) Buffer, (uint) Count, MyFlags));
51
48
 
52
49
  if ((readbytes= fread(Buffer, sizeof(char), Count, stream)) != Count)
53
50
  {
54
 
    DBUG_PRINT("error",("Read only %d bytes", (int) readbytes));
55
51
    if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
56
52
    {
57
53
      if (ferror(stream))
64
60
    }
65
61
    my_errno=errno ? errno : -1;
66
62
    if (ferror(stream) || MyFlags & (MY_NABP | MY_FNABP))
67
 
      DBUG_RETURN((size_t) -1);                 /* Return with error */
 
63
      return((size_t) -1);                      /* Return with error */
68
64
  }
69
65
  if (MyFlags & (MY_NABP | MY_FNABP))
70
 
    DBUG_RETURN(0);                             /* Read ok */
71
 
  DBUG_RETURN(readbytes);
 
66
    return(0);                          /* Read ok */
 
67
  return(readbytes);
72
68
} /* my_fread */
73
69
 
74
70
 
93
89
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
94
90
  uint errors;
95
91
#endif
96
 
  DBUG_ENTER("my_fwrite");
97
 
  DBUG_PRINT("my",("stream: 0x%lx  Buffer: 0x%lx  Count: %u  MyFlags: %d",
98
 
                   (long) stream, (long) Buffer, (uint) Count, MyFlags));
99
92
 
100
93
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
101
94
  errors=0;
107
100
    if ((written = (size_t) fwrite((char*) Buffer,sizeof(char),
108
101
                                   Count, stream)) != Count)
109
102
    {
110
 
      DBUG_PRINT("error",("Write only %d bytes", (int) writtenbytes));
111
103
      my_errno=errno;
112
104
      if (written != (size_t) -1)
113
105
      {
154
146
      writtenbytes+= written;
155
147
    break;
156
148
  }
157
 
  DBUG_RETURN(writtenbytes);
 
149
  return(writtenbytes);
158
150
} /* my_fwrite */
159
151
 
160
152
 
163
155
my_off_t my_fseek(FILE *stream, my_off_t pos, int whence,
164
156
                  myf MyFlags __attribute__((unused)))
165
157
{
166
 
  DBUG_ENTER("my_fseek");
167
 
  DBUG_PRINT("my",("stream: 0x%lx  pos: %lu  whence: %d  MyFlags: %d",
168
 
                   (long) stream, (long) pos, whence, MyFlags));
169
 
  DBUG_RETURN(fseek(stream, (off_t) pos, whence) ?
 
158
  return(fseek(stream, (off_t) pos, whence) ?
170
159
              MY_FILEPOS_ERROR : (my_off_t) ftell(stream));
171
160
} /* my_seek */
172
161
 
176
165
my_off_t my_ftell(FILE *stream, myf MyFlags __attribute__((unused)))
177
166
{
178
167
  off_t pos;
179
 
  DBUG_ENTER("my_ftell");
180
 
  DBUG_PRINT("my",("stream: 0x%lx  MyFlags: %d", (long) stream, MyFlags));
181
168
  pos=ftell(stream);
182
 
  DBUG_PRINT("exit",("ftell: %lu",(ulong) pos));
183
 
  DBUG_RETURN((my_off_t) pos);
 
169
  return((my_off_t) pos);
184
170
} /* my_ftell */