A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

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

Fix dangerous casts

On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is
not valid. In any case, one should use intptr_t and ptrdiff_t when casting
to integers. This commit attempts to fix all instances reported by GCC.
When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h

Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc

authored by

Amaury Pouly and committed by
Gerrit Rockbox
d7871914 1245c5fe

+69 -66
+1 -1
apps/gui/skin_engine/skin_parser.c
··· 2493 2493 skin_buffer = wps_buffer; 2494 2494 wps_buffer = (char*)buf; 2495 2495 } 2496 - skin_buffer = (void *)(((unsigned long)skin_buffer + 3) & ~3); 2496 + skin_buffer = ALIGN_UP(skin_buffer, 4); /* align on 4-byte boundary */ 2497 2497 buffersize -= 3; 2498 2498 #ifdef HAVE_BACKDROP_IMAGE 2499 2499 backdrop_filename = "-";
+1 -1
apps/misc.c
··· 215 215 count++; 216 216 if (next) 217 217 { 218 - pos = buf_size - ((long)next - (long)buf) - 1; 218 + pos = buf_size - ((intptr_t)next - (intptr_t)buf) - 1; 219 219 memmove(buf, next, pos); 220 220 } 221 221 else
+2 -2
apps/plugins/doom/d_deh.c
··· 2082 2082 S_sfx[indexnum].priority = (int)value; 2083 2083 else 2084 2084 if (!strcasecmp(key,deh_sfxinfo[3])) // Zero 1 2085 - S_sfx[indexnum].link = (sfxinfo_t *)((long) value); 2085 + S_sfx[indexnum].link = (sfxinfo_t *)((intptr_t) value); 2086 2086 else 2087 2087 if (!strcasecmp(key,deh_sfxinfo[4])) // Zero 2 2088 2088 S_sfx[indexnum].pitch = (int)value; ··· 2091 2091 S_sfx[indexnum].volume = (int)value; 2092 2092 else 2093 2093 if (!strcasecmp(key,deh_sfxinfo[6])) // Zero 4 2094 - S_sfx[indexnum].data = (void *) ((long) value); // killough 5/3/98: changed cast 2094 + S_sfx[indexnum].data = (void *) ((intptr_t) value); // killough 5/3/98: changed cast 2095 2095 else 2096 2096 if (!strcasecmp(key,deh_sfxinfo[7])) // Neg. One 1 2097 2097 S_sfx[indexnum].usefulness = (int)value;
+1 -1
apps/plugins/doom/d_main.c
··· 807 807 // for statistics driver 808 808 extern void* statcopy; 809 809 810 - statcopy = (void*)(long)atoi(myargv[p+1]); 810 + statcopy = (void*)(intptr_t)atoi(myargv[p+1]); 811 811 printf ("External statistics registered.\n"); 812 812 } 813 813
+15 -15
apps/plugins/doom/p_saveg.c
··· 44 44 45 45 // Pads save_p to a 4-byte boundary 46 46 // so that the load/save works on SGI&Gecko. 47 - #define PADSAVEP() do { save_p += (4 - ((unsigned long) save_p & 3)) & 3; } while (0) 47 + #define PADSAVEP() do { save_p += (4 - ((intptr_t) save_p & 3)) & 3; } while (0) 48 48 // 49 49 // P_ArchivePlayers 50 50 // ··· 95 95 for (j=0 ; j<NUMPSPRITES ; j++) 96 96 if (players[i]. psprites[j].state) 97 97 players[i]. psprites[j].state = 98 - &states[ (unsigned long)players[i].psprites[j].state ]; 98 + &states[ (intptr_t)players[i].psprites[j].state ]; 99 99 } 100 100 } 101 101 ··· 270 270 number_of_thinkers = 0; 271 271 for (th = thinkercap.next ; th != &thinkercap ; th=th->next) 272 272 if (th->function == P_MobjThinker) 273 - th->prev = (thinker_t *)(long)(++number_of_thinkers); 273 + th->prev = (thinker_t *)(intptr_t)(++number_of_thinkers); 274 274 } 275 275 276 276 // phares 9/13/98: Moved this code outside of P_ArchiveThinkers so the ··· 448 448 PADSAVEP(); 449 449 memcpy (mobj, save_p, sizeof(mobj_t)); 450 450 save_p += sizeof(mobj_t); 451 - mobj->state = states + (unsigned long) mobj->state; 451 + mobj->state = states + (intptr_t) mobj->state; 452 452 453 453 if (mobj->player) 454 - (mobj->player = &players[(unsigned long) mobj->player - 1]) -> mo = mobj; 454 + (mobj->player = &players[(intptr_t) mobj->player - 1]) -> mo = mobj; 455 455 456 456 P_SetThingPosition (mobj); 457 457 mobj->info = &mobjinfo[mobj->type]; ··· 770 770 ceiling_t *ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL); 771 771 memcpy (ceiling, save_p, sizeof(*ceiling)); 772 772 save_p += sizeof(*ceiling); 773 - ceiling->sector = &sectors[(unsigned long)ceiling->sector]; 773 + ceiling->sector = &sectors[(intptr_t)ceiling->sector]; 774 774 ceiling->sector->ceilingdata = ceiling; //jff 2/22/98 775 775 776 776 if (ceiling->thinker.function) ··· 787 787 vldoor_t *door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL); 788 788 memcpy (door, save_p, sizeof(*door)); 789 789 save_p += sizeof(*door); 790 - door->sector = &sectors[(unsigned long)door->sector]; 790 + door->sector = &sectors[(intptr_t)door->sector]; 791 791 792 792 //jff 1/31/98 unarchive line remembered by door as well 793 - door->line = (long)door->line!=-1? &lines[(unsigned long)door->line] : NULL; 793 + door->line = (intptr_t)door->line!=-1? &lines[(intptr_t)door->line] : NULL; 794 794 795 795 door->sector->ceilingdata = door; //jff 2/22/98 796 796 door->thinker.function = T_VerticalDoor; ··· 804 804 floormove_t *floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL); 805 805 memcpy (floor, save_p, sizeof(*floor)); 806 806 save_p += sizeof(*floor); 807 - floor->sector = &sectors[(unsigned long)floor->sector]; 807 + floor->sector = &sectors[(intptr_t)floor->sector]; 808 808 floor->sector->floordata = floor; //jff 2/22/98 809 809 floor->thinker.function = T_MoveFloor; 810 810 P_AddThinker (&floor->thinker); ··· 817 817 plat_t *plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL); 818 818 memcpy (plat, save_p, sizeof(*plat)); 819 819 save_p += sizeof(*plat); 820 - plat->sector = &sectors[(unsigned long)plat->sector]; 820 + plat->sector = &sectors[(intptr_t)plat->sector]; 821 821 plat->sector->floordata = plat; //jff 2/22/98 822 822 823 823 if (plat->thinker.function) ··· 834 834 lightflash_t *flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL); 835 835 memcpy (flash, save_p, sizeof(*flash)); 836 836 save_p += sizeof(*flash); 837 - flash->sector = &sectors[(unsigned long)flash->sector]; 837 + flash->sector = &sectors[(intptr_t)flash->sector]; 838 838 flash->thinker.function = T_LightFlash; 839 839 P_AddThinker (&flash->thinker); 840 840 break; ··· 846 846 strobe_t *strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL); 847 847 memcpy (strobe, save_p, sizeof(*strobe)); 848 848 save_p += sizeof(*strobe); 849 - strobe->sector = &sectors[(unsigned long)strobe->sector]; 849 + strobe->sector = &sectors[(intptr_t)strobe->sector]; 850 850 strobe->thinker.function = T_StrobeFlash; 851 851 P_AddThinker (&strobe->thinker); 852 852 break; ··· 858 858 glow_t *glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL); 859 859 memcpy (glow, save_p, sizeof(*glow)); 860 860 save_p += sizeof(*glow); 861 - glow->sector = &sectors[(unsigned long)glow->sector]; 861 + glow->sector = &sectors[(intptr_t)glow->sector]; 862 862 glow->thinker.function = T_Glow; 863 863 P_AddThinker (&glow->thinker); 864 864 break; ··· 870 870 fireflicker_t *flicker = Z_Malloc (sizeof(*flicker), PU_LEVEL, NULL); 871 871 memcpy (flicker, save_p, sizeof(*flicker)); 872 872 save_p += sizeof(*flicker); 873 - flicker->sector = &sectors[(unsigned long)flicker->sector]; 873 + flicker->sector = &sectors[(intptr_t)flicker->sector]; 874 874 flicker->thinker.function = T_FireFlicker; 875 875 P_AddThinker (&flicker->thinker); 876 876 break; ··· 883 883 elevator_t *elevator = Z_Malloc (sizeof(*elevator), PU_LEVEL, NULL); 884 884 memcpy (elevator, save_p, sizeof(*elevator)); 885 885 save_p += sizeof(*elevator); 886 - elevator->sector = &sectors[(unsigned long)elevator->sector]; 886 + elevator->sector = &sectors[(intptr_t)elevator->sector]; 887 887 elevator->sector->floordata = elevator; //jff 2/22/98 888 888 elevator->sector->ceilingdata = elevator; //jff 2/22/98 889 889 elevator->thinker.function = T_MoveElevator;
+2 -2
apps/plugins/doom/z_zone.c
··· 252 252 253 253 // Align on cache boundary 254 254 255 - zone = (memblock_t *) ((unsigned long)zonebase + CACHE_ALIGN - 256 - ((unsigned long)zonebase & (CACHE_ALIGN-1))); 255 + zone = (memblock_t *) ((intptr_t)zonebase + CACHE_ALIGN - 256 + ((intptr_t)zonebase & (CACHE_ALIGN-1))); 257 257 258 258 rover = zone; // Rover points to base of zone mem 259 259 zone->next = zone->prev = zone; // Single node
+2 -2
apps/plugins/goban/util.c
··· 73 73 void * 74 74 align_buffer (void *buffer, size_t * buffer_size) 75 75 { 76 - unsigned int wasted = (-(long) buffer) & 3; 76 + unsigned int wasted = (-(intptr_t) buffer) & 3; 77 77 78 78 if (!buffer || !buffer_size) 79 79 { ··· 88 88 89 89 *buffer_size -= wasted; 90 90 91 - return (void *) (((char *) buffer) + wasted); 91 + return PTR_ADD(buffer, wasted); 92 92 } 93 93 94 94
+1 -1
apps/plugins/lib/simple_viewer.c
··· 69 69 w = 1; 70 70 #else 71 71 unsigned short ch; 72 - n = ((long)rb->utf8decode(ptr, &ch) - (long)ptr); 72 + n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr); 73 73 if (rb->is_diacritic(ch, NULL)) 74 74 w = 0; 75 75 else
+2 -1
apps/plugins/lib/strncpy.c
··· 41 41 #include <limits.h> 42 42 #include "plugin.h" 43 43 #include "_ansi.h" 44 + #include <stdint.h> 44 45 45 46 /*SUPPRESS 560*/ 46 47 /*SUPPRESS 530*/ 47 48 48 49 /* Nonzero if either X or Y is not aligned on a "long" boundary. */ 49 50 #define ROCKBOX_UNALIGNED(X, Y) \ 50 - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) 51 + (((uintptr_t)X & (sizeof (long) - 1)) | ((uintptr_t)Y & (sizeof (long) - 1))) 51 52 52 53 #if LONG_MAX == 2147483647L 53 54 #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+8 -8
apps/plugins/lrcplayer.c
··· 545 545 c = rb->utf8seek(cr.str, 1); 546 546 w = 1; 547 547 #else 548 - c = ((long)rb->utf8decode(cr.str, &ch) - (long)cr.str); 548 + c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str); 549 549 if (rb->is_diacritic(ch, NULL)) 550 550 w = 0; 551 551 else ··· 885 885 lrc_line->time_start = (time/10)*10; 886 886 lrc_line->old_time_start = lrc_line->time_start; 887 887 add_lrc_line(lrc_line, NULL); 888 - file_offset += (long)tagend - (long)str; 888 + file_offset += (intptr_t)tagend - (intptr_t)str; 889 889 str = tagend; 890 890 } 891 891 if (!first_lrc_line) ··· 908 908 if (!tagend) break; 909 909 *tagend = 0; 910 910 time = get_time_value(tagstart+1, false, 911 - file_offset + ((long)tagstart - (long)str)); 911 + file_offset + ((intptr_t)tagstart - (intptr_t)str)); 912 912 *tagend++ = '>'; 913 913 if (time < 0) 914 914 { ··· 923 923 return false; 924 924 nword++; 925 925 } 926 - file_offset += (long)tagend - (long)str; 926 + file_offset += (intptr_t)tagend - (intptr_t)str; 927 927 tagstart = str = tagend; 928 928 time_start = time; 929 929 } ··· 1159 1159 } 1160 1160 } 1161 1161 if(ff_found) *ff_found = _ff_found; 1162 - return (long)wp - (long)tag; 1162 + return (intptr_t)wp - (intptr_t)tag; 1163 1163 } 1164 1164 1165 1165 static int read_unsynched(int fd, void *buf, int len, bool *ff_found) ··· 1471 1471 utf_decode = rb->utf16BEdecode; 1472 1472 } 1473 1473 } 1474 - bytesread -= (long)p - (long)tag; 1474 + bytesread -= (intptr_t)p - (intptr_t)tag; 1475 1475 tag = p; 1476 1476 1477 1477 while ( bytesread > 0 ··· 1529 1529 lrc_line->old_time_start = -1; 1530 1530 if(is_crlf) p += chsiz; 1531 1531 } 1532 - bytesread -= (long)p - (long)tag; 1532 + bytesread -= (intptr_t)p - (intptr_t)tag; 1533 1533 tag = p; 1534 1534 if(!add_lrc_line(lrc_line, utf8line)) 1535 1535 break; ··· 2922 2922 #endif 2923 2923 2924 2924 lrc_buffer = rb->plugin_get_buffer(&lrc_buffer_size); 2925 - lrc_buffer = (void *)(((long)lrc_buffer+3)&~3); /* 4 bytes aligned */ 2925 + lrc_buffer = ALIGN_UP(lrc_buffer, 4); /* 4 bytes aligned */ 2926 2926 lrc_buffer_size = (lrc_buffer_size - 4)&~3; 2927 2927 2928 2928 reset_current_data();
+1 -1
apps/plugins/mikmod/mikmod_internals.h
··· 703 703 704 704 /*========== SIMD mixing helper functions =============*/ 705 705 706 - #define IS_ALIGNED_16(ptr) (!(((int)(ptr)) & 15)) 706 + #define IS_ALIGNED_16(ptr) (!(((intptr_t)(ptr)) & 15)) 707 707 708 708 /* Altivec helper function */ 709 709 #if defined HAVE_ALTIVEC
+1 -1
apps/plugins/solitaire.c
··· 1547 1547 return -1; 1548 1548 1549 1549 retval = 0; /* Assume good case */ 1550 - if( ( rb->lseek( fd, -sizeof( int ), SEEK_END ) == -((ssize_t)sizeof( int ))-1 ) 1550 + if( ( rb->lseek( fd, -(off_t)sizeof( int ), SEEK_END ) == -((ssize_t)sizeof( int ))-1 ) 1551 1551 || ( rb->read( fd, &checksum, sizeof( int ) ) < ((ssize_t)sizeof( int )) ) 1552 1552 || ( rb->lseek( fd, 0, SEEK_SET ) == -1 ) 1553 1553 || save_read( fd, &cur_card, sizeof( int ), &checksum )
+1 -1
apps/plugins/zxbox/snapshot.c
··· 362 362 GET_DATA(ch); 363 363 if(p + times > end) { 364 364 put_msg("Warning: Repeat parameter too large in snapshot"); 365 - times = (int) ((long) end - (long) p); 365 + times = (int) ((intptr_t) end - (intptr_t) p); 366 366 } 367 367 for(j = 0; j < times; j++) *p++ = ch; 368 368 }
+1 -1
apps/plugins/zxbox/tapefile.c
··· 216 216 }; 217 217 218 218 219 - #define PTRDIFF(pe, ps) ((int) (((long) (pe) - (long) (ps)) / sizeof(*pe))) 219 + #define PTRDIFF(pe, ps) pe - ps 220 220 221 221 static char tzxheader[] = {'Z','X','T','a','p','e','!',0x1A}; 222 222
+1 -1
apps/plugins/zxbox/z80.c
··· 48 48 /*exit(1);*/ 49 49 } 50 50 51 - return (byte *) (( (long) bigmem & ~((long) 0xFFFF)) + 0x10000); 51 + return (byte *) (( (intptr_t) bigmem & ~((intptr_t) 0xFFFF)) + 0x10000); 52 52 } 53 53 54 54
+1 -1
apps/recorder/keyboard.c
··· 255 255 256 256 len = strlen(state->text); 257 257 utf8 = utf8encode(ch, tmp); 258 - j = (long)utf8 - (long)tmp; 258 + j = (intptr_t)utf8 - (intptr_t)tmp; 259 259 260 260 if (len + j < state->buflen) 261 261 {
+5 -5
apps/tagcache.c
··· 930 930 while (*list) 931 931 { 932 932 sep = strchr(list, '|'); 933 - l = sep ? (long)sep - (long)list : (int)strlen(list); 933 + l = sep ? (intptr_t)sep - (intptr_t)list : (int)strlen(list); 934 934 if ((l==len) && !strncasecmp(str, list, len)) 935 935 return true; 936 936 list += sep ? l + 1 : l; ··· 2362 2362 /* Avoid processing this entry again. */ 2363 2363 idx.flag |= FLAG_RESURRECTED; 2364 2364 2365 - lseek(masterfd, -sizeof(struct index_entry), SEEK_CUR); 2365 + lseek(masterfd, -(off_t)sizeof(struct index_entry), SEEK_CUR); 2366 2366 if (ecwrite_index_entry(masterfd, &idx) != sizeof(struct index_entry)) 2367 2367 { 2368 2368 logf("masterfd writeback fail #1"); ··· 3432 3432 struct index_entry idx; 3433 3433 char tag_data[TAG_MAXLEN+32]; 3434 3434 int idx_id; 3435 - long masterfd = (long)parameters; 3435 + long masterfd = (long)(intptr_t)parameters; 3436 3436 const int import_tags[] = { tag_playcount, tag_rating, tag_playtime, 3437 3437 tag_lastplayed, tag_commitid, tag_lastelapsed, 3438 3438 tag_lastoffset }; ··· 3526 3526 3527 3527 filenametag_fd = open_tag_fd(&tch, tag_filename, false); 3528 3528 3529 - fast_readline(clfd, buf, sizeof buf, (long *)masterfd, 3529 + fast_readline(clfd, buf, sizeof buf, (void *)(intptr_t)masterfd, 3530 3530 parse_changelog_line); 3531 3531 3532 3532 close(clfd); ··· 3665 3665 } 3666 3666 3667 3667 myidx.flag |= FLAG_DELETED; 3668 - lseek(masterfd, -sizeof(struct index_entry), SEEK_CUR); 3668 + lseek(masterfd, -(off_t)sizeof(struct index_entry), SEEK_CUR); 3669 3669 if (ecwrite_index_entry(masterfd, &myidx) != sizeof(struct index_entry)) 3670 3670 { 3671 3671 logf("delete_entry(): write_error #1");
+2 -1
firmware/asm/memset16.c
··· 20 20 ****************************************************************************/ 21 21 22 22 #include "string-extra.h" /* memset16() */ 23 + #include <stdint.h> 23 24 24 25 #define LBLOCKSIZE (sizeof(long)/2) 25 - #define ROCKBOX_UNALIGNED(X) ((long)X & (sizeof(long) - 1)) 26 + #define ROCKBOX_UNALIGNED(X) ((uintptr_t)X & (sizeof(long) - 1)) 26 27 #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) 27 28 28 29 void memset16(void *dst, int val, size_t len)
+5 -5
firmware/drivers/lcd-16bit-common.c
··· 94 94 { 95 95 do 96 96 { 97 - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), 97 + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), 98 98 len * sizeof(fb_data)); 99 99 dst += step; 100 100 } ··· 122 122 123 123 static void ICODE_ATTR clearimgpixel(fb_data *address) 124 124 { 125 - *address = *(fb_data *)((long)address + lcd_backdrop_offset); 125 + *address = *PTR_ADD(address, lcd_backdrop_offset); 126 126 } 127 127 128 128 static void ICODE_ATTR flippixel(fb_data *address) ··· 244 244 break; 245 245 246 246 case OPT_COPY: 247 - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), 247 + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), 248 248 len * sizeof(fb_data)); 249 249 break; 250 250 ··· 395 395 do 396 396 { 397 397 if (!(data & 0x01)) 398 - *dst = *(fb_data *)((long)dst + bo); 398 + *dst = *PTR_ADD(dst, bo); 399 399 400 400 dst += ROW_INC; 401 401 UPDATE_SRC; ··· 435 435 do 436 436 { 437 437 *dst = (data & 0x01) ? fg 438 - : *(fb_data *)((long)dst + bo); 438 + : *PTR_ADD(dst, bo); 439 439 dst += ROW_INC; 440 440 UPDATE_SRC; 441 441 }
+1 -1
firmware/drivers/lcd-16bit.c
··· 139 139 break; 140 140 141 141 case OPT_COPY: 142 - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), 142 + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), 143 143 width * sizeof(fb_data)); 144 144 break; 145 145
+1 -1
firmware/drivers/lcd-color-common.c
··· 148 148 lcd_backdrop = backdrop; 149 149 if (backdrop) 150 150 { 151 - lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer; 151 + lcd_backdrop_offset = (intptr_t)backdrop - (intptr_t)lcd_framebuffer; 152 152 lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop; 153 153 } 154 154 else
+2 -2
firmware/kernel/queue.c
··· 418 418 wr = q->write++ & QUEUE_LENGTH_MASK; 419 419 420 420 KERNEL_ASSERT((q->write - q->read) <= QUEUE_LENGTH, 421 - "queue_post ovf q=%08lX", (long)q); 421 + "queue_post ovf q=%p", q); 422 422 423 423 q->events[wr].id = id; 424 424 q->events[wr].data = data; ··· 450 450 wr = q->write++ & QUEUE_LENGTH_MASK; 451 451 452 452 KERNEL_ASSERT((q->write - q->read) <= QUEUE_LENGTH, 453 - "queue_send ovf q=%08lX", (long)q); 453 + "queue_send ovf q=%p", q); 454 454 455 455 q->events[wr].id = id; 456 456 q->events[wr].data = data;
+1 -1
firmware/target/hosted/filesystem-win32.c
··· 251 251 else 252 252 { 253 253 /* Convert OS handle to fd; the fd now owns it */ 254 - int osfd = _open_osfhandle((long)h, O_RDONLY); 254 + int osfd = _open_osfhandle((intptr_t)h, O_RDONLY); 255 255 if (osfd >= 0) 256 256 return osfd; 257 257 }
+1 -1
lib/rbcodec/codecs/liba52/bitstream.c
··· 35 35 { 36 36 int align; 37 37 38 - align = (long)buf & 3; 38 + align = (intptr_t)buf & 3; 39 39 state->buffer_start = (uint32_t *) (buf - align); 40 40 state->bits_left = 0; 41 41 state->current_word = 0;
+3 -3
lib/rbcodec/codecs/libtremor/codebook.c
··· 293 293 if(b->endbyte < b->storage - 8) { 294 294 ogg_uint32_t *ptr; 295 295 unsigned long bit, bitend; 296 - unsigned long adr; 296 + intptr_t adr; 297 297 ogg_uint32_t cache = 0; 298 298 int cachesize = 0; 299 299 const unsigned int cachemask = (1<<book->dec_firsttablen)-1; ··· 303 303 const ogg_uint32_t *book_codelist = book->codelist; 304 304 const char *book_dec_codelengths = book->dec_codelengths; 305 305 306 - adr = (unsigned long)b->ptr; 306 + adr = (intptr_t)b->ptr; 307 307 bit = (adr&3)*8+b->endbit; 308 308 ptr = (ogg_uint32_t*)(adr&~3); 309 309 bitend = ((adr&3)+(b->storage-b->endbyte))*8; ··· 334 334 cache >>= l; 335 335 } 336 336 337 - adr=(unsigned long)b->ptr; 337 + adr=(intptr_t)b->ptr; 338 338 bit-=(adr&3)*8+cachesize; 339 339 b->endbyte+=bit/8; 340 340 b->ptr+=bit/8;
+3 -3
lib/rbcodec/metadata/id3tags.c
··· 191 191 wp++; 192 192 } 193 193 } 194 - return (long)wp - (long)tag; 194 + return (intptr_t)wp - (intptr_t)tag; 195 195 } 196 196 197 197 static int unsynchronize_frame(char* tag, int len) ··· 562 562 (*len)--; 563 563 utf8 = iso_decode(str, utf8, -1, *len); 564 564 *utf8 = 0; 565 - *len = (unsigned long)utf8 - (unsigned long)utf8buf; 565 + *len = (intptr_t)utf8 - (intptr_t)utf8buf; 566 566 break; 567 567 568 568 case 0x01: /* Unicode with or without BOM */ ··· 619 619 default: /* Plain old string */ 620 620 utf8 = iso_decode(str, utf8, -1, *len); 621 621 *utf8 = 0; 622 - *len = (unsigned long)utf8 - (unsigned long)utf8buf; 622 + *len = (intptr_t)utf8 - (intptr_t)utf8buf; 623 623 break; 624 624 } 625 625 return 0;
+4 -3
lib/tlsf/src/tlsf.c
··· 54 54 55 55 #include <stdio.h> 56 56 #include <string.h> 57 + #include <stdint.h> 57 58 58 59 #ifndef TLSF_USE_LOCKS 59 60 #define TLSF_USE_LOCKS (0) ··· 462 463 return -1; 463 464 } 464 465 465 - if (((unsigned long) mem_pool & PTR_MASK)) { 466 + if (((intptr_t) mem_pool & PTR_MASK)) { 466 467 ERROR_MSG("init_memory_pool (): mem_pool must be aligned to a word\n"); 467 468 return -1; 468 469 } ··· 522 523 lb1 = ptr->end; 523 524 524 525 /* Merging the new area with the next physically contigous one */ 525 - if ((unsigned long) ib1 == (unsigned long) lb0 + BHDR_OVERHEAD) { 526 + if ((uintptr_t) ib1 == (uintptr_t) lb0 + BHDR_OVERHEAD) { 526 527 if (tlsf->area_head == ptr) { 527 528 tlsf->area_head = ptr->next; 528 529 ptr = ptr->next; ··· 543 544 544 545 /* Merging the new area with the previous physically contigous 545 546 one */ 546 - if ((unsigned long) lb1->ptr.buffer == (unsigned long) ib0) { 547 + if ((intptr_t) lb1->ptr.buffer == (intptr_t) ib0) { 547 548 if (tlsf->area_head == ptr) { 548 549 tlsf->area_head = ptr->next; 549 550 ptr = ptr->next;