From: Petri H. <phi...@us...> - 2014-03-11 08:42:04
|
# HG changeset patch # User Petri Hintukainen <phi...@us...> # Date 1394527285 -7200 # Node ID d78d299fc16accc022973784201579c9271e8de4 # Branch default # Parent 9a61ca1483f1e5dd7637a0623815983da88b3dc8 libw32dll: fix const issues Casting const away is usually bad idea. It does not fix the cause (incorrect types). Also, casting const away issues warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type diff --git a/src/libw32dll/DirectShow/DS_AudioDecoder.c b/src/libw32dll/DirectShow/DS_AudioDecoder.c --- a/src/libw32dll/DirectShow/DS_AudioDecoder.c +++ b/src/libw32dll/DirectShow/DS_AudioDecoder.c @@ -33,7 +33,7 @@ typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); -DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf) +DS_AudioDecoder * DS_AudioDecoder_Open(const char* dllname, GUID* guid, WAVEFORMATEX* wf) //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf) { DS_AudioDecoder *this; --git a/src/libw32dll/DirectShow/DS_AudioDecoder.h b/src/libw32dll/DirectShow/DS_AudioDecoder.h --- a/src/libw32dll/DirectShow/DS_AudioDecoder.h +++ b/src/libw32dll/DirectShow/DS_AudioDecoder.h @@ -4,7 +4,7 @@ typedef struct _DS_AudioDecoder DS_AudioDecoder; //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf); -DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf); +DS_AudioDecoder * DS_AudioDecoder_Open(const char* dllname, GUID* guid, WAVEFORMATEX* wf); void DS_AudioDecoder_Destroy(DS_AudioDecoder *this); --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c --- a/src/libw32dll/DirectShow/DS_VideoDecoder.c +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c @@ -82,7 +82,7 @@ }; -DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) +DS_VideoDecoder * DS_VideoDecoder_Open(const char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) { DS_VideoDecoder *this; HRESULT result; --git a/src/libw32dll/DirectShow/DS_VideoDecoder.h b/src/libw32dll/DirectShow/DS_VideoDecoder.h --- a/src/libw32dll/DirectShow/DS_VideoDecoder.h +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.h @@ -5,7 +5,7 @@ int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this); -DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto); +DS_VideoDecoder * DS_VideoDecoder_Open(const char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto); void DS_VideoDecoder_Destroy(DS_VideoDecoder *this); --git a/src/libw32dll/common.c b/src/libw32dll/common.c --- a/src/libw32dll/common.c +++ b/src/libw32dll/common.c @@ -2,10 +2,10 @@ #include <dirent.h> #endif -static char *get_win32_codecs_path(config_values_t *cfg) { +static const char *get_win32_codecs_path(config_values_t *cfg) { DIR *dir; - char *path, *cfgpath; - const char *listpath[] = { "", + const char *path, *cfgpath; + const char * const listpath[] = { "", "/usr/lib/codecs", "/usr/local/lib/codecs", "/usr/lib/win32", @@ -25,7 +25,7 @@ while (listpath[i]) { if (i == 0) path = cfgpath; - else path = (char *)listpath[i]; + else path = listpath[i]; if ((dir = opendir(path)) != NULL) { closedir(dir); --git a/src/libw32dll/dmo/DMO_AudioDecoder.c b/src/libw32dll/dmo/DMO_AudioDecoder.c --- a/src/libw32dll/dmo/DMO_AudioDecoder.c +++ b/src/libw32dll/dmo/DMO_AudioDecoder.c @@ -38,7 +38,7 @@ typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); extern void print_wave_header(WAVEFORMATEX *h); -DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels) +DMO_AudioDecoder * DMO_AudioDecoder_Open(const char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels) //DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf) { DMO_AudioDecoder *this; --git a/src/libw32dll/dmo/DMO_AudioDecoder.h b/src/libw32dll/dmo/DMO_AudioDecoder.h --- a/src/libw32dll/dmo/DMO_AudioDecoder.h +++ b/src/libw32dll/dmo/DMO_AudioDecoder.h @@ -4,7 +4,7 @@ typedef struct _DMO_AudioDecoder DMO_AudioDecoder; //DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf); -DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels); +DMO_AudioDecoder * DMO_AudioDecoder_Open(const char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels); void DMO_AudioDecoder_Destroy(DMO_AudioDecoder *this); --git a/src/libw32dll/dmo/DMO_VideoDecoder.c b/src/libw32dll/dmo/DMO_VideoDecoder.c --- a/src/libw32dll/dmo/DMO_VideoDecoder.c +++ b/src/libw32dll/dmo/DMO_VideoDecoder.c @@ -90,7 +90,7 @@ {0}, }; -DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) +DMO_VideoDecoder * DMO_VideoDecoder_Open(const char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) { DMO_VideoDecoder *this; HRESULT result; --git a/src/libw32dll/dmo/DMO_VideoDecoder.h b/src/libw32dll/dmo/DMO_VideoDecoder.h --- a/src/libw32dll/dmo/DMO_VideoDecoder.h +++ b/src/libw32dll/dmo/DMO_VideoDecoder.h @@ -5,7 +5,7 @@ int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this); -DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto); +DMO_VideoDecoder * DMO_VideoDecoder_Open(const char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto); void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this); --git a/src/libw32dll/qtx/qtxsdk/components.h b/src/libw32dll/qtx/qtxsdk/components.h --- a/src/libw32dll/qtx/qtxsdk/components.h +++ b/src/libw32dll/qtx/qtxsdk/components.h @@ -673,12 +673,12 @@ printf("=========================================================\n"); } -static inline void dump_Rect(char* title,Rect *r){ +static inline void dump_Rect(const char* title,Rect *r){ printf("%s: %d;%d - %d;%d\n",title, (int)r->top,(int)r->left,(int)r->bottom,(int)r->right); } -static inline void dump_MatrixRecord(char* title, MatrixRecord *m){ +static inline void dump_MatrixRecord(const char* title, MatrixRecord *m){ printf("%s: [%ld %ld %ld][%ld %ld %ld][%ld %ld %ld]\n",title, m->matrix[0][0],m->matrix[0][1],m->matrix[0][2], m->matrix[1][0],m->matrix[1][1],m->matrix[1][2], --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -134,7 +134,7 @@ */ static pthread_mutex_t win32_codec_mutex; static pthread_once_t once_control = PTHREAD_ONCE_INIT; -static char* win32_codec_name; +static const char* win32_codec_name; #define VIDEOBUFSIZE 128*1024 @@ -801,7 +801,7 @@ int i; for (i = 1; i <= num_decoders; i++) { - win32_codec_name = (char *)get_vids_codec_name (this, buf->type, i); + win32_codec_name = get_vids_codec_name (this, buf->type, i); if( this->driver_type == DRIVER_STD ) w32v_init_codec (this, buf->type); @@ -1206,7 +1206,7 @@ wf.cbSize = 0; this->ldt_fs = Setup_LDT_Keeper(); - win32_codec_name = (char *)get_auds_codec_name (this, buftype); + win32_codec_name = get_auds_codec_name (this, buftype); if( this->driver_type == DRIVER_STD ) { --git a/src/libw32dll/wine/pe_image.c b/src/libw32dll/wine/pe_image.c --- a/src/libw32dll/wine/pe_image.c +++ b/src/libw32dll/wine/pe_image.c @@ -212,7 +212,7 @@ FARPROC proc = RVA(addr); if (snoop) { - if (!ename) ename = "@"; +// if (!ename) ename = "@"; // proc = SNOOP_GetProcAddress(wm->module,ename,ordinal,proc); TRACE("SNOOP_GetProcAddress n/a\n"); @@ -245,7 +245,7 @@ PE_MODREF *pem; unsigned int load_addr = wm->module; int i,characteristics_detection=1; - char *modname; + const char *modname; assert(wm->type==MODULE32_PE); pem = &(wm->binfmt.pe); --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -79,7 +79,7 @@ } #endif -char* win32_def_path = WIN32_PATH; +const char* win32_def_path = WIN32_PATH; static void do_cpuid(unsigned int ax, unsigned int *regs) { --git a/src/libw32dll/wine/win32.h b/src/libw32dll/wine/win32.h --- a/src/libw32dll/wine/win32.h +++ b/src/libw32dll/wine/win32.h @@ -7,7 +7,7 @@ #include "winbase.h" #include "com.h" -extern char* win32_def_path; +extern const char* win32_def_path; extern void my_garbagecollection(void); |