Skip to contentSkip to conversation

rc4030: Fix compilation error in debug code

PATCH Applied Stefan Weil 2 participants 2 messages Sep 30, 2010 – Oct 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rc4030: Fix compilation error in debug code

min was unknown here, so avoid it.

---
 hw/rc4030.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
hw/rc4030.c +4 -1
index 2231373..abbc3eb 100644
@@ -749,7 +749,10 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
         printf("rc4030 dma: Copying %d bytes %s host %p\n",
             len, is_write ? "from" : "to", buf);
         for (i = 0; i < len; i += 16) {
-            int n = min(16, len - i);
+            int n = 16;
+            if (n > len - i) {
+                n = len - i;
+            }
             for (j = 0; j < n; j++)
                 printf("%02x ", buf[i + j]);
             while (j++ < 16)
Signature · 1 line
1.7.1
Applied
#1 lore raw

Thanks, applied.

Quoted 28 lines · Stefan Weil

min was unknown here, so avoid it.

---
 hw/rc4030.c |    5 ++++-

 1 files changed, 4 insertions(+), 1 deletions(-)
hw/rc4030.c +4 -2
index 2231373..abbc3eb 100644
@@ -749,7 +749,10 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri
         printf("rc4030 dma: Copying %d bytes %s host %p\n",
             len, is_write ? "from" : "to", buf);
         for (i = 0; i < len; i += 16) {
-            int n = min(16, len - i);
+            int n = 16;
+            if (n > len - i) {
+                n = len - i;
+            }
             for (j = 0; j < n; j++)
                 printf("%02x ", buf[i + j]);
             while (j++ < 16)
--

1.7.1