Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide dealloc function to ipodpatcher.

On Windows the sector buffer is allocated using VirtualAlloc, thus releasing
this buffer should be done using VirtualFree. Provide an additional function
for deallocating the buffer so users of ipodpatcher do not need to know about
this.

Change-Id: Ibb0fc575a185148a389e63935e86a392bf8d180d

+27 -4
+10
rbutil/ipodpatcher/ipodio-posix.c
··· 367 367 return 0; 368 368 } 369 369 370 + int ipod_dealloc_buffer(struct ipod_t* ipod) 371 + { 372 + if (ipod->sectorbuf == NULL) { 373 + return -1; 374 + } 375 + free(ipod->sectorbuf); 376 + ipod->sectorbuf = NULL; 377 + return 0; 378 + } 379 + 370 380 int ipod_seek(struct ipod_t* ipod, unsigned long pos) 371 381 { 372 382 off_t res;
+13
rbutil/ipodpatcher/ipodio-win32.c
··· 170 170 return 0; 171 171 } 172 172 173 + int ipod_dealloc_buffer(struct ipod_t* ipod) 174 + { 175 + if (ipod->sectorbuf == NULL) { 176 + return -1; 177 + } 178 + if(!VirtualFree(ipod->sectorbuf, 0, MEM_RELEASE)) { 179 + ipod_print_error(" Error releasing buffer "); 180 + return -1; 181 + } 182 + ipod->sectorbuf = NULL; 183 + return 0; 184 + } 185 + 173 186 int ipod_seek(struct ipod_t* ipod, unsigned long pos) 174 187 { 175 188 if (SetFilePointer(ipod->dh, pos, NULL, FILE_BEGIN)==0xffffffff) {
+1
rbutil/ipodpatcher/ipodio.h
··· 107 107 ssize_t ipod_read(struct ipod_t* ipod, int nbytes); 108 108 ssize_t ipod_write(struct ipod_t* ipod, int nbytes); 109 109 int ipod_alloc_buffer(struct ipod_t* ipod, int bufsize); 110 + int ipod_dealloc_buffer(struct ipod_t* ipod); 110 111 111 112 /* In fat32format.c */ 112 113 int format_partition(struct ipod_t* ipod, int partition);
+1
rbutil/ipodpatcher/main.c
··· 614 614 } 615 615 #endif 616 616 617 + ipod_dealloc_buffer(&ipod); 617 618 return 0; 618 619 }
+1 -2
rbutil/rbutilqt/base/autodetection.cpp
··· 162 162 else { 163 163 qDebug() << "[Autodetect] ipodpatcher: no Ipod found." << n; 164 164 } 165 - free(ipod.sectorbuf); 166 - ipod.sectorbuf = NULL; 165 + ipod_dealloc_buffer(&ipod); 167 166 168 167 // try sansapatcher 169 168 // initialize sector buffer. Needed.
+1 -2
rbutil/rbutilqt/base/bootloaderinstallipod.cpp
··· 37 37 BootloaderInstallIpod::~BootloaderInstallIpod() 38 38 { 39 39 if(ipod.sectorbuf) { 40 - free(ipod.sectorbuf); 41 - ipod.sectorbuf = NULL; 40 + ipod_dealloc_buffer(&ipod); 42 41 } 43 42 } 44 43