~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_fstream.c

Removed/replaced DBUG symbols and TRUE/FALSE

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