freemyipod r247 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r246‎ | r247 | r248 >
Date:22:47, 2 November 2010
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Fix issues with long file names
Modified paths:
  • /umsboot/main.c (modified) (history)

Diff [purge]

Index: umsboot/main.c
@@ -106,15 +106,15 @@
107107
108108 void swap(src, dest)
109109 {
 110+ memcpy(swapbuf, ramdisk[dest], RAMDISK_SECTORSIZE);
110111 uint16_t srcmap = swapmap[src];
111112 uint16_t destmap = swaprev[dest];
112 - memcpy(swapbuf, ramdisk[dest], RAMDISK_SECTORSIZE);
113113 memcpy(ramdisk[dest], ramdisk[srcmap], RAMDISK_SECTORSIZE);
 114+ swapmap[src] = dest;
 115+ swaprev[dest] = src;
114116 memcpy(ramdisk[srcmap], swapbuf, RAMDISK_SECTORSIZE);
115 - swapmap[src] = dest;
 117+ swaprev[srcmap] = destmap;
116118 swapmap[destmap] = srcmap;
117 - swaprev[srcmap] = destmap;
118 - swaprev[dest] = src;
119119 }
120120
121121 void main()
@@ -131,7 +131,7 @@
132132 while (vbus_state() && !usb_ejected);
133133 udelay(200000);
134134 usb_exit();
135 - lcdconsole_puts("\nLoading UBI File...\n", 0, 0xffff);
 135+ lcdconsole_puts("\nLoading UBI file...\n", 0, 0xffff);
136136 int found = 0;
137137 uint16_t cluster;
138138 uint32_t size;
@@ -146,8 +146,9 @@
147147 ramdisk[1 + fatsectors][i] = 0xe5;
148148 found++;
149149 }
150 - else totalclusters += (*((uint32_t*)&ramdisk[1 + fatsectors][i + 28])
151 - + RAMDISK_SECTORSIZE - 1) / RAMDISK_SECTORSIZE;
 150+ else if (*((uint16_t*)&ramdisk[1 + fatsectors][i + 26]))
 151+ totalclusters += (*((uint32_t*)&ramdisk[1 + fatsectors][i + 28])
 152+ + RAMDISK_SECTORSIZE - 1) / RAMDISK_SECTORSIZE;
152153 if (!found)
153154 {
154155 lcdconsole_puts("No UBI file found!", 0, 0xffff);