~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_read.c

Removed/replaced DBUG symbols and standardized TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
      N  number of bytes read.
34
34
*/
35
35
 
36
 
size_t my_read(File Filedes, unsigned char *Buffer, size_t Count, myf MyFlags)
 
36
size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
37
37
{
38
38
  size_t readbytes, save_count;
 
39
  DBUG_ENTER("my_read");
 
40
  DBUG_PRINT("my",("Fd: %d  Buffer: 0x%lx  Count: %lu  MyFlags: %d",
 
41
                   Filedes, (long) Buffer, (ulong) Count, MyFlags));
39
42
  save_count= Count;
40
43
 
41
44
  for (;;)
44
47
    if ((readbytes= read(Filedes, Buffer, Count)) != Count)
45
48
    {
46
49
      my_errno= errno ? errno : -1;
 
50
      DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
 
51
                            (int) readbytes, (ulong) Count, Filedes,
 
52
                            my_errno));
47
53
      if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
48
54
      {  
 
55
        DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld",
 
56
                             (long) readbytes));
49
57
        continue;                              /* Interrupted */
50
58
      }
51
59
      if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
59
67
      }
60
68
      if (readbytes == (size_t) -1 ||
61
69
          ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
62
 
        return(MY_FILE_ERROR);  /* Return with error */
 
70
        DBUG_RETURN(MY_FILE_ERROR);     /* Return with error */
63
71
      if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO))
64
72
      {
65
73
        Buffer+= readbytes;
74
82
      readbytes= save_count;
75
83
    break;
76
84
  }
77
 
  return(readbytes);
 
85
  DBUG_RETURN(readbytes);
78
86
} /* my_read */