]> git.neil.brown.name Git - history.git/commitdiff
Avoid compiler warning by using the proper types in "min()".
authorLinus Torvalds <torvalds@home.osdl.org>
Fri, 26 Sep 2003 03:56:28 +0000 (20:56 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 26 Sep 2003 03:56:28 +0000 (20:56 -0700)
sound/core/info.c

index 25c2aab5054844ba31ea900003985f965e02ca4f..03e184e8f3fe3f950f9ba123790191133bfd68d2 100644 (file)
@@ -180,7 +180,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer,
        snd_info_private_data_t *data;
        struct snd_info_entry *entry;
        snd_info_buffer_t *buf;
-       long size = 0;
+       size_t size = 0;
 
        data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO);
        snd_assert(data != NULL, return -ENXIO);
@@ -192,7 +192,8 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer,
                        return -EIO;
                if (file->f_pos >= (long)buf->size)
                        return 0;
-               size = min(count, buf->size - file->f_pos);
+               size = buf->size - file->f_pos;
+               size = min(count, size);
                if (copy_to_user(buffer, buf->buffer + file->f_pos, size))
                        return -EFAULT;
                file->f_pos += size;
@@ -213,7 +214,7 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer,
        snd_info_private_data_t *data;
        struct snd_info_entry *entry;
        snd_info_buffer_t *buf;
-       long size = 0;
+       size_t size = 0;
 
        data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO);
        snd_assert(data != NULL, return -ENXIO);
@@ -227,7 +228,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer,
                        return -EINVAL;
                if (file->f_pos >= (long)buf->len)
                        return -ENOMEM;
-               size = min(count, buf->len - file->f_pos);
+               size = buf->len - file->f_pos;
+               size = min(count, size);
                if (copy_from_user(buf->buffer + file->f_pos, buffer, size))
                        return -EFAULT;
                if ((long)buf->size < file->f_pos + size)