fixes for 64bit archs: don't assume a pointer is 32bit wide

This commit is contained in:
Stefan Seyfried
2012-10-06 17:49:16 +02:00
parent 4009fea6d8
commit d806eeb544
15 changed files with 39 additions and 33 deletions

View File

@@ -33,12 +33,16 @@
#ifndef __FILE_H__ #ifndef __FILE_H__
#define __FILE_H__ #define __FILE_H__
#include <config.h>
#if 0
/* this is already done by AC_SYS_LARGEFILE */
#include <features.h> /* make sure off_t has size 8 #include <features.h> /* make sure off_t has size 8
in __USE_FILE_OFFSET64 mode */ in __USE_FILE_OFFSET64 mode */
#ifndef __USE_FILE_OFFSET64 #ifndef __USE_FILE_OFFSET64
#error not using 64 bit file offsets #error not using 64 bit file offsets
#endif /* __USE_FILE__OFFSET64 */ #endif /* __USE_FILE__OFFSET64 */
#endif
#include <sys/types.h> #include <sys/types.h>

View File

@@ -24,13 +24,12 @@
#ifndef __RADIO_TOOLS_H #ifndef __RADIO_TOOLS_H
#define __RADIO_TOOLS_H #define __RADIO_TOOLS_H
#include <stdint.h>
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst); unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst);
char *rtrim(char *text); char *rtrim(char *text);
typedef long long unsigned int uint64_t;
class cTimeMs { class cTimeMs {
private: private:
uint64_t begin; uint64_t begin;

View File

@@ -839,17 +839,17 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
break; break;
case NeutrinoMessages::EVT_POPUP : case NeutrinoMessages::EVT_POPUP :
*msg = NeutrinoMessages::EVT_POPUP; *msg = NeutrinoMessages::EVT_POPUP;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case NeutrinoMessages::EVT_EXTMSG : case NeutrinoMessages::EVT_EXTMSG :
*msg = NeutrinoMessages::EVT_EXTMSG; *msg = NeutrinoMessages::EVT_EXTMSG;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case NeutrinoMessages::CHANGEMODE : // Change case NeutrinoMessages::CHANGEMODE : // Change
*msg = NeutrinoMessages::CHANGEMODE; *msg = NeutrinoMessages::CHANGEMODE;
*data = *(unsigned*) p; *data = *(unsigned long*) p;
break; break;
case NeutrinoMessages::STANDBY_TOGGLE : case NeutrinoMessages::STANDBY_TOGGLE :
*msg = NeutrinoMessages::STANDBY_TOGGLE; *msg = NeutrinoMessages::STANDBY_TOGGLE;
@@ -865,7 +865,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
break; break;
case NeutrinoMessages::EVT_START_PLUGIN : case NeutrinoMessages::EVT_START_PLUGIN :
*msg = NeutrinoMessages::EVT_START_PLUGIN; *msg = NeutrinoMessages::EVT_START_PLUGIN;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case NeutrinoMessages::LOCK_RC : case NeutrinoMessages::LOCK_RC :
@@ -1107,7 +1107,7 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n");
{ {
case CTimerdClient::EVT_ANNOUNCE_RECORD : case CTimerdClient::EVT_ANNOUNCE_RECORD :
*msg = NeutrinoMessages::ANNOUNCE_RECORD; *msg = NeutrinoMessages::ANNOUNCE_RECORD;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case CTimerdClient::EVT_ANNOUNCE_ZAPTO : case CTimerdClient::EVT_ANNOUNCE_ZAPTO :
@@ -1128,17 +1128,17 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n");
break; break;
case CTimerdClient::EVT_RECORD_START : case CTimerdClient::EVT_RECORD_START :
*msg = NeutrinoMessages::RECORD_START; *msg = NeutrinoMessages::RECORD_START;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case CTimerdClient::EVT_RECORD_STOP : case CTimerdClient::EVT_RECORD_STOP :
*msg = NeutrinoMessages::RECORD_STOP; *msg = NeutrinoMessages::RECORD_STOP;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case CTimerdClient::EVT_ZAPTO : case CTimerdClient::EVT_ZAPTO :
*msg = NeutrinoMessages::ZAPTO; *msg = NeutrinoMessages::ZAPTO;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case CTimerdClient::EVT_SHUTDOWN : case CTimerdClient::EVT_SHUTDOWN :
@@ -1155,12 +1155,12 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n");
break; break;
case CTimerdClient::EVT_REMIND : case CTimerdClient::EVT_REMIND :
*msg = NeutrinoMessages::REMIND; *msg = NeutrinoMessages::REMIND;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;
case CTimerdClient::EVT_EXEC_PLUGIN : case CTimerdClient::EVT_EXEC_PLUGIN :
*msg = NeutrinoMessages::EVT_START_PLUGIN; *msg = NeutrinoMessages::EVT_START_PLUGIN;
*data = (unsigned) p; *data = (unsigned long) p;
dont_delete_p = true; dont_delete_p = true;
break; break;

View File

@@ -108,8 +108,8 @@
*/ */
typedef uint32_t neutrino_msg_t; typedef unsigned long neutrino_msg_t;
typedef uint32_t neutrino_msg_data_t; typedef unsigned long neutrino_msg_data_t;
#define NEUTRINO_UDS_NAME "/tmp/neutrino.sock" #define NEUTRINO_UDS_NAME "/tmp/neutrino.sock"

View File

@@ -225,7 +225,7 @@ void streamts_main_thread(void * /*data*/)
pfd[tcnt].revents = 0; pfd[tcnt].revents = 0;
tcnt++; tcnt++;
exit_flag = 0; exit_flag = 0;
pthread_create (&st, NULL, streamts_live_thread, (void *) connfd); pthread_create (&st, NULL, streamts_live_thread, &connfd);
} else { } else {
if (pfd[i].revents & (POLLHUP | POLLRDHUP)) { if (pfd[i].revents & (POLLHUP | POLLRDHUP)) {
connfd = -1; connfd = -1;
@@ -259,7 +259,7 @@ void * streamts_live_thread(void *data)
int pids[MAXPIDS]; int pids[MAXPIDS];
char cbuf[512]; char cbuf[512];
char *bp; char *bp;
int fd = (int) data; int fd = *((int *)data);
FILE * fp; FILE * fp;
unsigned char demuxfd_count = 0; unsigned char demuxfd_count = 0;
@@ -370,7 +370,7 @@ void streamts_file_thread(void *data)
int tsfilelen = 0; int tsfilelen = 0;
int fileslice = 0; int fileslice = 0;
int i = 0; int i = 0;
int fd = (int) data; int fd = *((int *)data);
buf = (unsigned char *) malloc(IN_SIZE); buf = (unsigned char *) malloc(IN_SIZE);

View File

@@ -254,8 +254,8 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
int res = -1; int res = -1;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
uint32_t msg; neutrino_msg_t msg;
uint32_t data; neutrino_msg_data_t data;
bool loop=true; bool loop=true;
bool update=true; bool update=true;

View File

@@ -1351,8 +1351,8 @@ CZapitChannel* CChannelList::getPrevNextChannel(int key, unsigned int &sl)
} }
sl = cactive; sl = cactive;
channel = bouquetList->Bouquets[bactive]->channelList->getChannelFromIndex(cactive); channel = bouquetList->Bouquets[bactive]->channelList->getChannelFromIndex(cactive);
printf("CChannelList::getPrevNextChannel: selected %d total %d active bouquet %d total %d channel %x (%s)\n", printf("CChannelList::getPrevNextChannel: selected %d total %d active bouquet %d total %d channel %p (%s)\n",
cactive, chanlist.size(), bactive, bsize, (int) channel, channel ? channel->getName().c_str(): ""); cactive, chanlist.size(), bactive, bsize, channel, channel ? channel->getName().c_str(): "");
} else { } else {
if ((key == g_settings.key_quickzap_down) || (key == CRCInput::RC_left)) { if ((key == g_settings.key_quickzap_down) || (key == CRCInput::RC_left)) {
if(sl == 0) if(sl == 0)

View File

@@ -74,7 +74,7 @@ typedef struct dirent dirent_struct;
typedef struct stat stat_struct; typedef struct stat stat_struct;
#define my_stat stat #define my_stat stat
#define my_lstat lstat #define my_lstat lstat
#error not using 64 bit file offsets //#error not using 64 bit file offsets
#endif #endif
#define SMSKEY_TIMEOUT 2000 #define SMSKEY_TIMEOUT 2000

View File

@@ -682,7 +682,7 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
pos2 = -1; pos2 = -1;
ptr = strstr(&text[pos], MI_XML_TAG_PID); ptr = strstr(&text[pos], MI_XML_TAG_PID);
if (ptr) if (ptr)
pos2 = (int)ptr - (int)&text[pos]; pos2 = (int)(ptr - &text[pos]);
//pos2 = strcspn(&text[pos],MI_XML_TAG_PID); //pos2 = strcspn(&text[pos],MI_XML_TAG_PID);
if (pos2 >= 0) { if (pos2 >= 0) {
pos2 += sizeof(MI_XML_TAG_PID); pos2 += sizeof(MI_XML_TAG_PID);
@@ -697,7 +697,7 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
pos2 = -1; pos2 = -1;
ptr = strstr(&text[pos], MI_XML_TAG_ATYPE); ptr = strstr(&text[pos], MI_XML_TAG_ATYPE);
if (ptr) if (ptr)
pos2 = (int)ptr - (int)&text[pos]; pos2 = (int)(ptr - &text[pos]);
//pos2 = strcspn(&text[pos],MI_XML_TAG_ATYPE); //pos2 = strcspn(&text[pos],MI_XML_TAG_ATYPE);
if (pos2 >= 0) { if (pos2 >= 0) {
pos2 += sizeof(MI_XML_TAG_ATYPE); pos2 += sizeof(MI_XML_TAG_ATYPE);
@@ -711,7 +711,7 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
pos2 = -1; pos2 = -1;
ptr = strstr(&text[pos], MI_XML_TAG_SELECTED); ptr = strstr(&text[pos], MI_XML_TAG_SELECTED);
if (ptr) if (ptr)
pos2 = (int)ptr - (int)&text[pos]; pos2 = (int)(ptr - &text[pos]);
//pos2 = strcspn(&text[pos],MI_XML_TAG_SELECTED); //pos2 = strcspn(&text[pos],MI_XML_TAG_SELECTED);
if (pos2 >= 0) { if (pos2 >= 0) {
pos2 += sizeof(MI_XML_TAG_SELECTED); pos2 += sizeof(MI_XML_TAG_SELECTED);
@@ -726,7 +726,7 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
pos2 = -1; pos2 = -1;
ptr = strstr(&text[pos], MI_XML_TAG_NAME); ptr = strstr(&text[pos], MI_XML_TAG_NAME);
if (ptr) if (ptr)
pos2 = (int)ptr - (int)&text[pos]; pos2 = (int)(ptr - &text[pos]);
if (pos2 >= 0) { if (pos2 >= 0) {
pos2 += sizeof(MI_XML_TAG_PID); pos2 += sizeof(MI_XML_TAG_PID);
while (text[pos + pos2] != '\"' && text[pos + pos2] != 0 && text[pos + pos2] != '/') while (text[pos + pos2] != '\"' && text[pos + pos2] != 0 && text[pos + pos2] != '/')

View File

@@ -681,7 +681,7 @@ void CMoviePlayerGui::PlayFile(void)
} }
if (playstate == CMoviePlayerGui::STOPPED) { if (playstate == CMoviePlayerGui::STOPPED) {
printf("CMoviePlayerGui::PlayFile: exit, isMovieBrowser %d p_movie_info %x\n", isMovieBrowser, (int) p_movie_info); printf("CMoviePlayerGui::PlayFile: exit, isMovieBrowser %d p_movie_info %p\n", isMovieBrowser, p_movie_info);
playstate = CMoviePlayerGui::STOPPED; playstate = CMoviePlayerGui::STOPPED;
handleMovieBrowser((neutrino_msg_t) g_settings.mpkey_stop, position); handleMovieBrowser((neutrino_msg_t) g_settings.mpkey_stop, position);
} }
@@ -859,7 +859,7 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int position)
} }
else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) {
// if we have a movie information, try to save the stop position // if we have a movie information, try to save the stop position
printf("CMoviePlayerGui::handleMovieBrowser: stop, isMovieBrowser %d p_movie_info %x\n", isMovieBrowser, (int) p_movie_info); printf("CMoviePlayerGui::handleMovieBrowser: stop, isMovieBrowser %d p_movie_info %p\n", isMovieBrowser, p_movie_info);
if (isMovieBrowser && p_movie_info) { if (isMovieBrowser && p_movie_info) {
timeb current_time; timeb current_time;
ftime(&current_time); ftime(&current_time);

View File

@@ -333,7 +333,10 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
int CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) /* this is not type "int", because it does not return a code indicating success but
* instead returns altered "msg". This is different ot all other "handleMsg" functions
* and should probably be fixed somewhen... */
neutrino_msg_t CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data)
{ {
int w = x + width - xpos2; int w = x + width - xpos2;
//printf("CScanTs::handleMsg: x %d xpos2 %d width %d w %d\n", x, xpos2, width, w); //printf("CScanTs::handleMsg: x %d xpos2 %d width %d w %d\n", x, xpos2, width, w);

View File

@@ -73,7 +73,7 @@ class CScanTs : public CMenuTarget
void paintLineLocale(int x, int * y, int width, const neutrino_locale_t l); void paintLineLocale(int x, int * y, int width, const neutrino_locale_t l);
void paintLine(int x, int y, int width, const char * const txt); void paintLine(int x, int y, int width, const char * const txt);
void paintRadar(void); void paintRadar(void);
int handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data); neutrino_msg_t handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data);
int greater_xpos(int xpos, const neutrino_locale_t txt); int greater_xpos(int xpos, const neutrino_locale_t txt);
bool freqready; bool freqready;
void showSNR(); void showSNR();

View File

@@ -81,7 +81,7 @@ bool CCam::makeCaPmt(CZapitChannel * channel, uint8_t list, const CaIdVector &ca
int len; int len;
unsigned char * buffer = channel->getRawPmt(len); unsigned char * buffer = channel->getRawPmt(len);
INFO("cam %x source %d camask %d list %02x buffer", (int) this, source_demux, camask, list); INFO("cam %p source %d camask %d list %02x buffer", this, source_demux, camask, list);
if(!buffer) if(!buffer)
return false; return false;

View File

@@ -530,7 +530,7 @@ void CServiceScan::SaveServices()
bool CServiceScan::ScanProviders() bool CServiceScan::ScanProviders()
{ {
flags = (int) scan_arg; flags = *((int *)scan_arg);
scanBouquetManager = new CBouquetManager(); scanBouquetManager = new CBouquetManager();
printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no", printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no",

View File

@@ -743,7 +743,7 @@ bool CZapit::StartScan(int scan_mode)
{ {
PrepareScan(); PrepareScan();
CServiceScan::getInstance()->Start(CServiceScan::SCAN_PROVIDER, (void *) scan_mode); CServiceScan::getInstance()->Start(CServiceScan::SCAN_PROVIDER, &scan_mode);
return true; return true;
} }