[Spice-devel,Xspice,05/11] playback_dir_changed: rename variable "index" to "offset"

Submitted by Uri Lublin on Jan. 26, 2015, 10:35 a.m.

Details

Message ID 7486ea4dfc7b4c26ef85a1a8a97d54b1cb17ed8b.1422267879.git.uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin Jan. 26, 2015, 10:35 a.m.
This fixes the following compiler warning.
spiceqxl_audio.c: In function ‘playback_dir_changed’:
spiceqxl_audio.c:386: warning: declaration of ‘index’ shadows a global declaration
---
 src/spiceqxl_audio.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/spiceqxl_audio.c b/src/spiceqxl_audio.c
index 086b943..eba9b10 100644
--- a/src/spiceqxl_audio.c
+++ b/src/spiceqxl_audio.c
@@ -383,23 +383,23 @@  static void playback_dir_changed(int fd, int event, void *opaque)
 {
     qxl_screen_t *qxl = opaque;
     static unsigned char buf[sizeof(struct inotify_event) + NAME_MAX + 1];
-    static int index = 0;
+    static int offset = 0;
     struct inotify_event *e;
     int rc;
 
     do {
-        rc = read(fd, buf + index, sizeof(buf) - index);
+        rc = read(fd, buf + offset, sizeof(buf) - offset);
         if (rc > 0) {
-            index += rc;
-            if (index >= sizeof(*e)) {
+            offset += rc;
+            if (offset >= sizeof(*e)) {
                 int len;
                 e = (struct inotify_event *) buf;
                 len = sizeof(*e) + e->len;
-                if (index >= len) {
+                if (offset >= len) {
                     handle_one_change(qxl, e);
-                    if (index > len)
-                        memmove(buf, buf + index, index - len);
-                    index -= len;
+                    if (offset > len)
+                        memmove(buf, buf + offset, offset - len);
+                    offset -= len;
                 }
             }
         }