freemyipod r875 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r874‎ | r875 | r876 >
Date:11:46, 27 July 2013
Author:theseven
Status:new
Tags:
Comment:
emCORE installers for iPod Nano 2G and iPod Classic: Add missing static keywords.
Modified paths:
  • /apps/installer-ipodclassic/main.c (modified) (history)
  • /apps/installer-ipodnano2g/main.c (modified) (history)

Diff [purge]

Index: apps/installer-ipodclassic/main.c
@@ -27,7 +27,7 @@
2828 #include "libmkfat32.h"
2929
3030
31 -void main(int argc, const char** argv);
 31+static void main(int argc, const char** argv);
3232 EMCORE_APP_HEADER("emCORE installer", main, 127)
3333
3434
@@ -49,9 +49,9 @@
5050 extern uint32_t commonscript[];
5151
5252
53 -struct wakeup eventwakeup;
54 -volatile int button;
55 -volatile int scrollpos;
 53+static struct wakeup eventwakeup;
 54+static volatile int button;
 55+static volatile int scrollpos;
5656
5757
5858 #define SHA1CONFIG (*((volatile uint32_t*)(0x38000000)))
@@ -59,7 +59,7 @@
6060 #define SHA1RESULT ((volatile uint32_t*)(0x38000020))
6161 #define SHA1DATAIN ((volatile uint32_t*)(0x38000040))
6262
63 -void sha1(void* data, uint32_t size, void* hash)
 63+static void sha1(void* data, uint32_t size, void* hash)
6464 {
6565 int i, space;
6666 bool done = false;
@@ -105,7 +105,7 @@
106106 }
107107
108108
109 -void handler(void* user, enum button_event eventtype, int which, int value)
 109+static void handler(void* user, enum button_event eventtype, int which, int value)
110110 {
111111 if (eventtype == BUTTON_PRESS) button |= 1 << which;
112112 if (eventtype == BUTTON_RELEASE) button &= ~(1 << which);
@@ -114,18 +114,18 @@
115115 wakeup_signal(&eventwakeup);
116116 }
117117
118 -void fat32_progressbar_init(void* user, int max)
 118+static void fat32_progressbar_init(void* user, int max)
119119 {
120120 progressbar_init((struct progressbar_state*)user,
121121 15, 304, 135, 159, 0x77ff, 0xe8, 0x125f, 0, max);
122122 }
123123
124 -void fat32_progressbar_update(void* user, int current)
 124+static void fat32_progressbar_update(void* user, int current)
125125 {
126126 progressbar_setpos((struct progressbar_state*)user, current, false);
127127 }
128128
129 -void main(int argc, const char** argv)
 129+static void main(int argc, const char** argv)
130130 {
131131 uint32_t i, j, k, rc;
132132 uint32_t dummy;
Index: apps/installer-ipodnano2g/main.c
@@ -31,7 +31,7 @@
3232 #define BOOTNOTE_FILENAME "/Notes/" STR(BASENAME) ".bootnote"
3333
3434
35 -void main(int argc, const char** argv);
 35+static void main(int argc, const char** argv);
3636 EMCORE_APP_HEADER("emCORE installer", main, 127)
3737
3838
@@ -52,20 +52,20 @@
5353 extern uint32_t commonscript[];
5454
5555
56 -uint32_t fat32_ok;
57 -uint32_t fat32_startsector;
58 -uint32_t fat32_secperclus;
59 -uint32_t fat32_database;
60 -uint32_t fat32_fatbase;
61 -uint32_t fat32_fatsize;
62 -uint32_t fat32_fatcount;
63 -uint32_t fat32_sectorcount;
64 -uint32_t fat32_clustercount;
65 -uint32_t fat32_rootdirclus;
 56+static uint32_t fat32_ok;
 57+static uint32_t fat32_startsector;
 58+static uint32_t fat32_secperclus;
 59+static uint32_t fat32_database;
 60+static uint32_t fat32_fatbase;
 61+static uint32_t fat32_fatsize;
 62+static uint32_t fat32_fatcount;
 63+static uint32_t fat32_sectorcount;
 64+static uint32_t fat32_clustercount;
 65+static uint32_t fat32_rootdirclus;
6666
67 -struct wakeup eventwakeup;
68 -volatile int button;
69 -volatile int scrollpos;
 67+static struct wakeup eventwakeup;
 68+static volatile int button;
 69+static volatile int scrollpos;
7070
7171
7272 #define nor ((uint8_t*)0x24000000)
@@ -72,7 +72,7 @@
7373 #define norword ((uint32_t*)0x24000000)
7474
7575
76 -void handler(void* user, enum button_event eventtype, int which, int value)
 76+static void handler(void* user, enum button_event eventtype, int which, int value)
7777 {
7878 if (eventtype == BUTTON_PRESS) button |= 1 << which;
7979 if (eventtype == BUTTON_RELEASE) button &= ~(1 << which);
@@ -81,13 +81,13 @@
8282 wakeup_signal(&eventwakeup);
8383 }
8484
85 -uint32_t freeret(uint32_t rc, void* ptr)
 85+static uint32_t freeret(uint32_t rc, void* ptr)
8686 {
8787 free(ptr);
8888 return rc;
8989 }
9090
91 -int decryptfw(void* image, uint32_t offset)
 91+static int decryptfw(void* image, uint32_t offset)
9292 {
9393 uint32_t size = ((uint32_t*)image)[5];
9494 if (size > 0x800000) return 0;
@@ -97,7 +97,7 @@
9898 return size;
9999 }
100100
101 -uint32_t getfw(const char* filename, uint32_t* sector, int* size)
 101+static uint32_t getfw(const char* filename, uint32_t* sector, int* size)
102102 {
103103 uint32_t i;
104104 uint32_t* buffer = memalign(0x10, 0x800);
@@ -131,7 +131,7 @@
132132 return freeret(2, buffer);
133133 }
134134
135 -uint32_t readfw(const char* filename, void** address, int* size)
 135+static uint32_t readfw(const char* filename, void** address, int* size)
136136 {
137137 uint32_t sector;
138138 uint32_t rc = getfw(filename, &sector, size);
@@ -145,7 +145,7 @@
146146 return 0;
147147 }
148148
149 -uint32_t getapplenor(const char* filename, void** address, int* size)
 149+static uint32_t getapplenor(const char* filename, void** address, int* size)
150150 {
151151 uint32_t i;
152152 for (i = 0xffe00; i < 0x100000; i += 0x28)
@@ -158,7 +158,7 @@
159159 return 1;
160160 }
161161
162 -uint32_t readapplenor(const char* filename, void** address, int* size)
 162+static uint32_t readapplenor(const char* filename, void** address, int* size)
163163 {
164164 void* noraddr;
165165 uint32_t rc = getapplenor(filename, &noraddr, size);
@@ -171,8 +171,8 @@
172172 return 0;
173173 }
174174
175 -uint32_t fat32_resize_patchdirs(uint32_t clusterchain, uint32_t clustoffset,
176 - struct progressbar_state* progressbar, int min, int len)
 175+static uint32_t fat32_resize_patchdirs(uint32_t clusterchain, uint32_t clustoffset,
 176+ struct progressbar_state* progressbar, int min, int len)
177177 {
178178 uint32_t i, j, rc;
179179 uint32_t* buffer = (uint32_t*)memalign(0x10, 0x800);
@@ -236,7 +236,7 @@
237237 return 0;
238238 }
239239
240 -uint32_t fat32_resize_fulldisk(struct progressbar_state* progressbar)
 240+static uint32_t fat32_resize_fulldisk(struct progressbar_state* progressbar)
241241 {
242242 uint32_t i, j, rc;
243243 uint32_t fatsectors = 1;
@@ -418,7 +418,7 @@
419419 return 0;
420420 }
421421
422 -uint32_t fat32_init()
 422+static uint32_t fat32_init()
423423 {
424424 uint32_t i;
425425 fat32_ok = 0;
@@ -474,7 +474,7 @@
475475 return 0;
476476 }
477477
478 -void main(int argc, const char** argv)
 478+static void main(int argc, const char** argv)
479479 {
480480 uint32_t i, j, k, rc;
481481 uint32_t dummy;