Skip to content

Commit 75136cd

Browse files
authored
Merge pull request #299 from fjtrujy/fixSamplesGCC15
Fix majority of the warning in the PSPSDK samples
2 parents a116123 + c665eed commit 75136cd

File tree

14 files changed

+40
-27
lines changed

14 files changed

+40
-27
lines changed

src/samples/debug/prxdecrypt/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ int extract_file(const char* name, const char* dstname)
104104

105105
if(size >= 0)
106106
{
107-
printf("Extracted file - size %d\n", size);
107+
printf("Extracted file - size %ld\n", size);
108108
fd = sceIoOpen(dstname, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
109109
if(fd >= 0)
110110
{

src/samples/gu/vertex/Makefile.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ TARGET = vertex
22
OBJS = vertex.o ../common/callbacks.o ../common/menu.o
33

44
INCDIR =
5-
CFLAGS = -Wall
5+
CFLAGS = -Wall -ffast-math
66
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
77
ASFLAGS = $(CFLAGS)
88

src/samples/gu/vertex/vertex.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void generateVertexBuffer(int vertexFormat, void* vertices, int batchSize)
131131
memset(current,0,vertexSize);
132132

133133
// TODO: render something nice
134-
/*
134+
135135
float x = cosf((i * batchScale) * (GU_PI*2));
136136
float y = sinf((i * batchScale) * (GU_PI*2));
137137

@@ -180,7 +180,7 @@ void generateVertexBuffer(int vertexFormat, void* vertices, int batchSize)
180180
}
181181
break;
182182
}
183-
*/
183+
184184
current = current + vertexSize;
185185
}
186186
}
@@ -253,7 +253,7 @@ int main(int argc, char* argv[])
253253

254254
// run sample
255255

256-
int val = 0;
256+
int frame = 0;
257257
SceCtrlData oldPad;
258258
memset(&oldPad,0,sizeof(SceCtrlData));
259259

@@ -598,7 +598,7 @@ int main(int argc, char* argv[])
598598

599599
pspDebugScreenSetOffset((int)fbp0);
600600
pspDebugScreenSetXY(0,0);
601-
pspDebugScreenPrintf("Mask: 0x%08x, Size: %u", vertexMask, vertexSize,val);
601+
pspDebugScreenPrintf("Mask: 0x%08x, Size: %u, frame: %d", vertexMask, vertexSize, frame);
602602
if (avgVertexSpeed)
603603
pspDebugScreenPrintf(", %.2f million vertices / sec.",avgVertexSpeed);
604604
else
@@ -613,7 +613,7 @@ int main(int argc, char* argv[])
613613
fbp1 = fbp0;
614614
fbp0 = sceGuSwapBuffers();
615615

616-
val++;
616+
frame++;
617617
}
618618

619619
sceGuTerm();

src/samples/kernel/kdumper/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void dump_cop0_regs(void)
171171
printf("Cop0 regs\n");
172172
for(i = 0; i < 32; i+=4)
173173
{
174-
printf("$%02d: %08X, $%02d: %08X, $%02d: %08X $%02d: %08X\n",
174+
printf("$%02d: %08lX, $%02d: %08lX, $%02d: %08lX $%02d: %08lX\n",
175175
i, regs[i], i+1, regs[i+1], i+2, regs[i+2], i+3, regs[i+3]);
176176
}
177177
}

src/samples/me/basic/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
5353
pspDebugScreenSetXY(0, 0);
5454
pspDebugScreenPrintf("ME Basic Example, press Home to exit\n");
5555
sceKernelDcacheWritebackInvalidateAll();
56-
pspDebugScreenPrintf("ME Counter: %08x\n", *count);
56+
pspDebugScreenPrintf("ME Counter: %08lx\n", *count);
5757
sceCtrlReadBufferPositive(&ctl, 1);
5858
if(ctl.Buttons & PSP_CTRL_HOME)
5959
{

src/samples/net/simple/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ int net_thread(SceSize args, void *argp)
246246
start_server(info.ip);
247247
}
248248
} while (0);
249+
250+
return 0;
249251
}
250252
/* Simple thread */
251253
int main(int argc, char **argv)

src/samples/net/wlanscan_elf/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const char *caps[8] = {
7878
void print_apsum(struct ScanData *pData)
7979
{
8080
char name[33];
81-
int loop;
8281
strncpy(name, pData->name, 32);
8382
name[32] = 0;
8483
printf("RSSI:%02d ", pData->rssi);

src/samples/prx/prx_loader/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ int main(void)
8787
SceUID modid;
8888
SceModule *mod;
8989
int i;
90-
int ret;
9190
int fd;
91+
int ret = -1;
9292

9393
pspDebugScreenInit();
9494

@@ -126,5 +126,5 @@ int main(void)
126126
/* Let's bug out */
127127
sceKernelExitDeleteThread(0);
128128

129-
return 0;
129+
return ret >= 0 ? 0 : ret;
130130
}

src/samples/savedata/decrypt/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ PSP_MODULE_INFO("SaveDecrypt", 0, 1, 1);
2727
#define printf pspDebugScreenPrintf
2828

2929
const char *decrypted = "ms0:/PLAIN.BIN";
30-
#if 0
30+
#define USE_OLD_FORMAT 0
31+
#if USE_OLD_FORMAT
3132
/* Old format save with no key, supported by 1.0+ firmware */
3233
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
3334
const unsigned char *gamekey = NULL;
@@ -66,12 +67,16 @@ int main(int argc, char *argv[])
6667

6768
printf("Will decrypt: %s\n", encrypted);
6869
printf(" Using key:");
69-
if(gamekey) {
70+
#if USE_OLD_FORMAT
71+
{
72+
printf(" none");
73+
}
74+
#else
75+
{
7076
for (i = 0; i < 0x10; i++)
7177
printf(" %02x", gamekey[i]);
72-
} else {
73-
printf(" none");
7478
}
79+
#endif
7580
printf("\n\n");
7681
printf(" Output file: %s\n\n", decrypted);
7782
printf("Press X to continue, or O to quit.\n\n");

src/samples/savedata/encrypt/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ PSP_MODULE_INFO("SaveEncrypt", 0, 1, 1);
2626

2727
#define printf pspDebugScreenPrintf
2828

29-
#if 0
29+
#define USE_OLD_FORMAT 0
30+
#if USE_OLD_FORMAT
3031
/* Old format save with no key, supported by 1.0+ firmware */
3132
const char *plaintext = "ms0:/PLAIN.BIN";
3233
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
@@ -71,12 +72,16 @@ int main(int argc, char *argv[])
7172

7273
printf(" Will encrypt: %s\n", plaintext);
7374
printf(" Using key:");
74-
if(gamekey) {
75+
#if USE_OLD_FORMAT
76+
{
77+
printf(" none");
78+
}
79+
#else
80+
{
7581
for (i = 0; i < 0x10; i++)
7682
printf(" %02x", gamekey[i]);
77-
} else {
78-
printf(" none");
7983
}
84+
#endif
8085
printf("\n\n");
8186
printf(" Output file: %s\n", encrypted);
8287
printf("Update hashes: %s\n\n", paramsfo);

0 commit comments

Comments
 (0)