Some trivial bugs

I report some trivial bugs and send patches.===================================================================
— SDL_audiocvt.c (revision 2915)
+++ SDL_audiocvt.c (working copy)
@@ -140,14 +140,14 @@

                 const Sint64 added =
                     (((Sint64) (Sint32) SDL_SwapBE32(src[0])) +
                      ((Sint64) (Sint32) SDL_SwapBE32(src[1])));
  •                *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added
    

1)));

  •                *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added /
    

2)));
}
} else {
for (i = cvt->len_cvt / 8; i; --i, src += 2) {
const Sint64 added =
(((Sint64) (Sint32) SDL_SwapLE32(src[0])) +
((Sint64) (Sint32) SDL_SwapLE32(src[1])));

  •                *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added
    

1)));

  •                *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added /
    

2)));
}
}
}

My environment is win2000 and VC8 Express Edition.
I don’t know why,
but the compiler reports a link error,
“unresolved external symbol __allshr referenced in function ???”.

===================================================================
— SDL_audio.c (revision 2915)
+++ SDL_audio.c (working copy)
@@ -342,11 +342,10 @@
return (0);
}

static SDL_AudioFormat
SDL_ParseAudioFormat(const char *string)
{
-#define CHECK_FMT_STRING(x) if (strcmp(string, #x) == 0) return AUDIO_##x
+#define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) return
AUDIO_##x
CHECK_FMT_STRING(U8);
CHECK_FMT_STRING(S8);
CHECK_FMT_STRING(U16LSB);

This is also storange to me,
but it fails in the link of strcmp.

===================================================================
— SDL_video.c (revision 2916)
+++ SDL_video.c (working copy)
@@ -1785,7 +1785,7 @@
if (!renderer->SetTextureColorMod) {
return -1;
}

  • if (r < 255 | g < 255 | b < 255) {
  • if (r < 255 || g < 255 || b < 255) {
    texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
    } else {
    texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;

===================================================================
— SDL_stdinc.h (revision 2915)
+++ SDL_stdinc.h (working copy)
@@ -223,10 +223,10 @@

endif

#endif
#ifdef HAVE_ALLOCA
-#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)count)
+#define SDL_stack_alloc(type, count) (type
)alloca(sizeof(type)(count))
#define SDL_stack_free(data)
#else
-#define SDL_stack_alloc(type, count)
(type
)SDL_malloc(sizeof(type)count)
+#define SDL_stack_alloc(type, count)
(type
)SDL_malloc(sizeof(type)*(count))
#define SDL_stack_free(data) SDL_free(data)
#endif

My environment is win2000 and VC8 Express Edition.
I don’t know why,
but the compiler reports a link error,
“unresolved external symbol __allshr referenced in function ???”.

Hmm…that’s odd that it would want to call a built-in function for
bitshifting, even with a 64-bit value…this is probably fixable with
the right compiler flag, but it’s easier to just make them divides.

Fixed in svn revision #2921.

This is also storange to me,
but it fails in the link of strcmp.

We don’t link to the Microsoft C runtime on Windows, instead supplying
our own functions…this was largely due to problems caused by linking
an SDL library built with one C runtime to an application built with a
different one. Using SDL_strcmp() does the correct thing.

Fixed in svn revision #2918.

  • if (r < 255 | g < 255 | b < 255) {
  • if (r < 255 || g < 255 || b < 255) {

Whoops, good catch. Fixed in svn revision #2917.

-#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)count)
+#define SDL_stack_alloc(type, count) (type
)alloca(sizeof(type)*(count))

Ah, macros.

Fixed in svn revision #2919 for the 1.2 branch, and #2920 for the 1.3
branch.

I should probably tell you that you should use the 1.2 branch and not
1.3 at this time unless you are explicitly experimenting with 1.3… 1.2
is the stable branch at the moment…thank you for the patches, either way.

–ryan.