patchmldonkey, a multi-networks file-sharing client - Patches: patch #4477, win: prevented some compiler...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #4477: win: prevented some compiler warnings (os_stubs_c.c, gdstubs.c, md4.c)

Submitter:  Schlumpf <schlumpf_>
Submitted:  Thu 29 Sep 2005 11:11:14 AM UTC
   
 
Category:  Bug fixes Priority:  5 - Normal
Status:  Done Assigned to:  None
Open/Closed:  Closed

Jump to the original submission

Sun 09 Oct 2005 03:53:43 PM UTC, comment #17: 

Applied 2005/10/09

spiralvoice <spiralvoice>
Group administrator
Sun 09 Oct 2005 10:37:43 AM UTC, comment #16: 

patch updated

spiralvoice <spiralvoice>
Group administrator
Sun 09 Oct 2005 09:50:19 AM UTC, comment #15: 

png.h is the file included here

spiralvoice <spiralvoice>
Group administrator
Sun 09 Oct 2005 09:49:51 AM UTC, comment #14: 

+#include <png.h>

spiralvoice <spiralvoice>
Group administrator
Sun 09 Oct 2005 09:44:20 AM UTC, comment #13: 

Is this a good idea if png support is not available?

--- mldonkey-main/src/utils/cdk/gdstubs.c       2005-08-01 22:09:13.000000000 +0200
+++ mldonkey-work/src/utils/cdk/gdstubs.c       2005-10-06 19:22:01.845206400 +0200
@@ -466,13 +466,14 @@
   return Val_unit;
 }

+#include <png.h>
+

spiralvoice <spiralvoice>
Group administrator
Sun 09 Oct 2005 08:45:35 AM UTC, comment #12: 


>Most warnings just aren't important. If the warnings annoy you I believe you can turn them off as a compiler option

Thats not really the right way, hide Errors instead of fix them, also when the most are not important.

>Correct code should be more important

then please be so kind and regard previous patches, else it isn`t very helpful at applying the stuff to CVS.
You change the Declaration without remove the cast from 'ret', after apply file #5290 and #5295 we had an DWORD variable that`s also be casted to an ulong.

Schlumpf <schlumpf_>
Group Member
Sat 08 Oct 2005 04:05:00 PM UTC, comment #11: 

Additional 2 line patch (dword.patch) changes it to use DWORD.

Most warnings just aren't important.  If the warnings annoy you I believe you can turn them off as a compiler option.  Correct code should be more important. Overflowing a long from an unsigned long (as stated, SetFilePointer returns a DWORD which is unsigned)seemed like something that should be fixed.

Anonymous
Sat 08 Oct 2005 10:11:14 AM UTC, comment #10: 

@anonymous
please comment your change at task #4757 again

Schlumpf <schlumpf_>
Group Member
Sat 08 Oct 2005 09:21:25 AM UTC, comment #9: 

@anonymous
this change can be done at then next patch, for now it`s fixed with cast 'ret', as is said in comment #2 it doesen`t make any difference to me what we use, the result is the same.

there are still other warnings to fix, how good are your C skills? perhaps you can help to fix the remaining compiler warnings?

@spiralvoice
think file #5290 ready to apply, file #5261 can be deletet.
for the other remaining warnings (and the 'small change' from anonymous) i open a new task on the tasktracker.

Schlumpf <schlumpf_>
Group Member
Thu 06 Oct 2005 07:29:30 PM UTC, comment #8: 

small change:

OFF_T os_lseek(OS_FD fd, OFF_T ofs, int cmd)
{
  long ret;

could be changed to:

  DWORD ret;


Anonymous
Thu 06 Oct 2005 06:43:50 PM UTC, comment #7: 

When I came back from holiday I looked through all patches here.
As of comment #5 it was obvious the patch was not ready for CVS
so I postponed it, now I will apply it after testing.

spiralvoice <spiralvoice>
Group administrator
Thu 06 Oct 2005 06:33:38 PM UTC, comment #6: 

updated Patch.

- remove INVALID_SET_FILE_POINTER declaration
- change return '\o' to return 0 in os_getfilesize

- some new changes in md4.c & os_stubs.h to prevent these warnings:
  src/utils/lib/md4.c: In function `MD4Update':
src/utils/lib/md4.c:115: warning: implicit declaration of function `memcpy'
src/utils/lib/md4.c: In function `MD4Final':
src/utils/lib/md4.c:158: warning: implicit declaration of function `memset'
In file included from src/daemon/common/commonHasher_c.c:22:
src/daemon/common/../../utils/lib/os_stubs.h:83:1: warning: "SEEK_SET" redefined
In file included from src/daemon/common/commonHasher_c.c:20:
c:/Gnu/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/stdio.h:107:1: warning: this is the location of the previous definition
In file included from src/daemon/common/commonHasher_c.c:22:
src/daemon/common/../../utils/lib/os_stubs.h:84:1: warning: "SEEK_CUR" redefined
In file included from src/daemon/common/commonHasher_c.c:20:
c:/Gnu/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/stdio.h:111:1: warning: this is the location of the previous definition
In file included from src/daemon/common/commonHasher_c.c:22:
src/daemon/common/../../utils/lib/os_stubs.h:85:1: warning: "SEEK_END" redefined
In file included from src/daemon/common/commonHasher_c.c:20:
c:/Gnu/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/stdio.h:115:1: warning: this is the location of the previous definition

by the way, why is the Status now Postponed? are these work undesired

Schlumpf <schlumpf_>
Group Member
Mon 03 Oct 2005 05:08:58 PM UTC, comment #5: 

src/config/mingw/os_stubs_c.c

This file is only used with mingw.  You don't need to think about compilers/environments/systems other than mingw here.

winsock.h is included for MINGW in the os_stubs.h.

Anonymous
Mon 03 Oct 2005 10:32:21 AM UTC, comment #4: 


>Including winbase.h is probably better than manually defining
>INVALID_SET_FILE_POINTER at the top of the file, since it properly
>defines it as a DWORD.


its still included.
in os_stubs_c.c > "#include "../../utils/lib/os_stubs.h""
in os_stubs.h > "#include <winsock.h>"
in winsock.h > "#include <windows.h>"
in windows.h > "#include <winbase.h>"

but we can`t be sure that this is on all systems/compiler/environments, so the request if INVALID_SET_FILE_POINTER is defined after including os_stubs.h is  still needed as a precaution.

Schlumpf <schlumpf_>
Group Member
Sun 02 Oct 2005 04:50:25 PM UTC, comment #3: 

SetFilePointer returns a DWORD (msdn) so I think that is correct to use.

Including winbase.h is probably better than manually defining INVALID_SET_FILE_POINTER at the top of the file, since it properly defines it as a DWORD.

winbase.h:
#define INVALID_SET_FILE_POINTER  ((DWORD)-1)

Anonymous
Sun 02 Oct 2005 11:55:21 AM UTC, comment #2: 


>It would be better if you returned 0 instead of '/0' since the
>expected return type is an int64.


yep i agree with you, so this should be changed.

"ret" is declared as long, INVALID_SET_FILE_POINTER is defined as an DWORD(unsigned long) in winbase.h
This comparison is then "signed long == unsigned long" thats the reason for the compiler Warning "src/config/mingw/os_stubs_c.c:111: warning: comparison between signed and unsigned"

so its required to change the declaration of "ret" to an DWORD or make an casting to an DWORD (unsigned long), it doesen`t make any different to me what we use, so you can pick out one of the possibilities ;)

Schlumpf <schlumpf_>
Group Member
Sat 01 Oct 2005 10:01:29 PM UTC, comment #1: 

It would be better if you returned 0 instead of '/0' since the expected return type is an int64.

+    return '\0';

"ret" should be a DWORD to begin with, so casting would not be required.

+  if ((unsigned long)ret == INVALID_SET_FILE_POINTER) {

Anonymous
Thu 29 Sep 2005 11:11:14 AM UTC, original submission:  

src/utils/cdk/gdstubs.c: In function `ml_image_pngversion':
src/utils/cdk/gdstubs.c:474: warning: implicit declaration of function `png_access_version_number'
src/utils/cdk/gdstubs.c:474: warning: initialization makes pointer from integer without a cast

src/config/mingw/os_stubs_c.c: In function `os_lseek':
src/config/mingw/os_stubs_c.c:111: warning: comparison between signed and unsigned
src/config/mingw/os_stubs_c.c: In function `os_uname':
src/config/mingw/os_stubs_c.c:260: warning: int format, DWORD arg (arg 2)
src/config/mingw/os_stubs_c.c:260: warning: int format, DWORD arg (arg 3)
src/config/mingw/os_stubs_c.c:277: warning: int format, long unsigned int arg (arg 3)
src/config/mingw/os_stubs_c.c:277: warning: embedded `\0' in format
src/config/mingw/os_stubs_c.c:282: warning: int format, long unsigned int arg (arg 4)
src/config/mingw/os_stubs_c.c:282: warning: embedded `\0' in format
src/config/mingw/os_stubs_c.c:288: warning: int format, long unsigned int arg (arg 4)
src/config/mingw/os_stubs_c.c:288: warning: embedded `\0' in format
src/config/mingw/os_stubs_c.c: In function `os_getfilesize':
src/config/mingw/os_stubs_c.c:101: warning: control reaches end of non-void function

Schlumpf <schlumpf_>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #8157:  4477.patch added by spiralvoice (6KiB - application/octet-stream)
file #8000:  dword.patch added by None (507B - application/octet-stream)
file #8090:  some_c_warnings2.patch added by schlumpf_ (6KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 11 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-10-09 spiralvoice StatusNone Done
    Open/ClosedOpen Closed
2005-10-09 spiralvoice Attached File- Added 4477.patch, #5297
2005-10-09 spiralvoice Attached File#5261 Removed
2005-10-08 None Attached File- Added dword.patch, #5295
2005-10-06 spiralvoice Summarywin: prevented some compiler warnings (os_stubs_c.c gdstubs.c) win: prevented some compiler warnings (os_stubs_c.c, gdstubs.c, md4.c)
2005-10-06 spiralvoice StatusPostponed None
2005-10-06 schlumpf_ Attached File- Added some_c_warnings2.patch, #5290
2005-10-06 spiralvoice StatusWorks For Me Postponed
2005-10-01 amorphous StatusNone Works For Me
2005-09-29 schlumpf_ Attached File- Added some_c_warnings.patch, #5261

Back to the top

Powered by Savane 3.13-caa5.
Corresponding source code