Commit graph

121 commits

Author SHA1 Message Date
Sam Lantinga
d2b922f555 Fixed bug #1090 (SDL_BlitCopyOverlap() assumes memcpy() operates in order)
Even if we're blitting between two different surfaces their pixels might still overlap, because of SDL_CreateRGBSurfaceFrom(), so always use SDL_BlitCopy() and check for overlap in that function.

When handling overlapping surfaces, don't assume that memcpy() iterates forward, instead use memmove() correctly, and provide a fallback implementation of SDL_memmove() that handles the different cases.

Fixed a bug with SDL_memset() not completely filling lengths that aren't a multiple of 4.
Optimized SDL_memcpy() a bit using the same technique as SDL_memset().
2011-02-16 15:25:10 -08:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
b4497865bd Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c

--HG--
rename : src/SDL_android.cpp => src/core/android/SDL_android.cpp
rename : src/SDL_android.h => src/core/android/SDL_android.h
2011-01-24 21:20:30 -08:00
Sam Lantinga
10b8372bd3 Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008 2011-01-24 15:46:11 -08:00
Sam Lantinga
f3716d8a4e Fixed size_t warnings on 64-bit build 2011-01-22 15:58:21 -08:00
Sam Lantinga
9d25ba272a Fixed bug #925
Changed "win32" to "windows"

--HG--
rename : include/SDL_config_win32.h => include/SDL_config_windows.h
rename : src/events/scancodes_win32.h => src/events/scancodes_windows.h
rename : src/haptic/win32/SDL_syshaptic.c => src/haptic/windows/SDL_syshaptic.c
rename : src/joystick/win32/SDL_dxjoystick.c => src/joystick/windows/SDL_dxjoystick.c
rename : src/joystick/win32/SDL_dxjoystick_c.h => src/joystick/windows/SDL_dxjoystick_c.h
rename : src/joystick/win32/SDL_mmjoystick.c => src/joystick/windows/SDL_mmjoystick.c
rename : src/loadso/win32/SDL_sysloadso.c => src/loadso/windows/SDL_sysloadso.c
rename : src/main/win32/SDL_win32_main.c => src/main/windows/SDL_windows_main.c
rename : src/main/win32/version.rc => src/main/windows/version.rc
rename : src/thread/win32/SDL_sysmutex.c => src/thread/windows/SDL_sysmutex.c
rename : src/thread/win32/SDL_syssem.c => src/thread/windows/SDL_syssem.c
rename : src/thread/win32/SDL_systhread.c => src/thread/windows/SDL_systhread.c
rename : src/thread/win32/SDL_systhread_c.h => src/thread/windows/SDL_systhread_c.h
rename : src/thread/win32/win_ce_semaphore.c => src/thread/windows/win_ce_semaphore.c
rename : src/thread/win32/win_ce_semaphore.h => src/thread/windows/win_ce_semaphore.h
rename : src/timer/win32/SDL_systimer.c => src/timer/windows/SDL_systimer.c
rename : src/video/win32/SDL_ceddrawrender.c => src/video/windows/SDL_ceddrawrender.c
rename : src/video/win32/SDL_ceddrawrender.h => src/video/windows/SDL_ceddrawrender.h
rename : src/video/win32/SDL_d3drender.c => src/video/windows/SDL_d3drender.c
rename : src/video/win32/SDL_d3drender.h => src/video/windows/SDL_d3drender.h
rename : src/video/win32/SDL_gapirender.c => src/video/windows/SDL_gapirender.c
rename : src/video/win32/SDL_gapirender.h => src/video/windows/SDL_gapirender.h
rename : src/video/win32/SDL_gapirender_c.h => src/video/windows/SDL_gapirender_c.h
rename : src/video/win32/SDL_gdirender.c => src/video/windows/SDL_gdirender.c
rename : src/video/win32/SDL_gdirender.h => src/video/windows/SDL_gdirender.h
rename : src/video/win32/SDL_msctf.h => src/video/windows/SDL_msctf.h
rename : src/video/win32/SDL_vkeys.h => src/video/windows/SDL_vkeys.h
rename : src/video/win32/SDL_win32clipboard.c => src/video/windows/SDL_windowsclipboard.c
rename : src/video/win32/SDL_win32clipboard.h => src/video/windows/SDL_windowsclipboard.h
rename : src/video/win32/SDL_win32events.c => src/video/windows/SDL_windowsevents.c
rename : src/video/win32/SDL_win32events.h => src/video/windows/SDL_windowsevents.h
rename : src/video/win32/SDL_win32gamma.c => src/video/windows/SDL_windowsgamma.c
rename : src/video/win32/SDL_win32gamma.h => src/video/windows/SDL_windowsgamma.h
rename : src/video/win32/SDL_win32keyboard.c => src/video/windows/SDL_windowskeyboard.c
rename : src/video/win32/SDL_win32keyboard.h => src/video/windows/SDL_windowskeyboard.h
rename : src/video/win32/SDL_win32modes.c => src/video/windows/SDL_windowsmodes.c
rename : src/video/win32/SDL_win32modes.h => src/video/windows/SDL_windowsmodes.h
rename : src/video/win32/SDL_win32mouse.c => src/video/windows/SDL_windowsmouse.c
rename : src/video/win32/SDL_win32mouse.h => src/video/windows/SDL_windowsmouse.h
rename : src/video/win32/SDL_win32opengl.c => src/video/windows/SDL_windowsopengl.c
rename : src/video/win32/SDL_win32opengl.h => src/video/windows/SDL_windowsopengl.h
rename : src/video/win32/SDL_win32shape.c => src/video/windows/SDL_windowsshape.c
rename : src/video/win32/SDL_win32shape.h => src/video/windows/SDL_windowsshape.h
rename : src/video/win32/SDL_win32video.c => src/video/windows/SDL_windowsvideo.c
rename : src/video/win32/SDL_win32video.h => src/video/windows/SDL_windowsvideo.h
rename : src/video/win32/SDL_win32window.c => src/video/windows/SDL_windowswindow.c
rename : src/video/win32/SDL_win32window.h => src/video/windows/SDL_windowswindow.h
rename : src/video/win32/wmmsg.h => src/video/windows/wmmsg.h
2011-01-20 18:04:05 -08:00
Sam Lantinga
7411f7531b Fixed compiling with Visual Studio 2008 2010-08-29 14:22:22 -07:00
dewyatt
12881b428c Added SDL_wcslcpy and SDL_wcslcat. 2010-08-03 16:52:10 -04:00
dewyatt
34d5cdc704 Added SDL_utf8strlcpy to copy at UTF-8 character boundaries.
Changed SDL_SendKeyboardText and SDL_SendEditingText to use SDL_utf8strlcpy.
2010-07-13 15:05:45 -04:00
Sam Lantinga
4d3df8b3e3 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404453
2010-01-24 21:10:53 +00:00
Ryan C. Gordon
40e8b69061 Merged r4710:4711 from branches/SDL-1.2: Mac OS X SDL_stdlib qsort build fixes.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404367
2010-01-06 20:17:35 +00:00
Sam Lantinga
0833d1cda2 Updated test code to use SDL_setenv()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404340
2009-12-17 07:46:13 +00:00
Sam Lantinga
c825464c2f Allocate memory only if we're going to overwrite an environment variable
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404332
2009-12-16 16:08:17 +00:00
Ryan C. Gordon
791f5dbce4 Implemented SDL_setenv(), moved SDL_putenv() to compat.
Fixes Bugzilla #779.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404330
2009-12-16 10:59:51 +00:00
Sam Lantinga
74c8c77e81 Fixed bug #896
John Popplewell      2009-12-08 23:05:50 PST

Originally reported by AKFoerster on the mailing list.

Error decoding UTF8 Russian text to UTF-16LE on Windows, but specifically on
platforms without iconv support (the default on Windows).

Valid UTF8 characters are flagged as being overlong and then substituted by the
UNKNOWN_UNICODE character.

After studying the testiconv.c example program, reading the RFCs and putting
some printf statements in SDL_iconv.c the problem is in a test for 'Maximum
overlong sequences', specifically 4.2.1, which is carried out by the following
code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xCE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

Here is the 2-byte encoding of a character in range 00000080 - 000007FF
    110xxxxx 10xxxxxx

The line in question is supposed to be checking for an overlong sequence which
would be less than
    11000001 10111111

which should be represented as a single byte.

BUT, the mask value (0xCE) is wrong, it isn't checking the top-most bit:
    11000001     value
    11001110     mask (incorrect)
       ^
and should be (0xDE):
    11000001     value
    11011110     mask (correct)

making the above code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xDE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

I can supply a test program and/or a patch if required,

best regards,
John Popplewell

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404283
2009-12-11 08:03:43 +00:00
Sam Lantinga
bda0828ef8 Fixed bug #797
Ryan C. Gordon      2009-09-19 08:25:21 PDT

This line in SDL_iconv_string (src/stdlib/SDL_iconv.c) ...

        if (!fromcode || !*fromcode) {
            tocode = "UTF-8";
        }

Is probably supposed to assign to "fromcode" and not "tocode".

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403912
2009-09-26 10:36:55 +00:00
Sam Lantinga
56d28e32b9 Fixed compiling on 64-bit Windows
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403785
2009-09-06 04:40:54 +00:00
Sam Lantinga
d036689ab0 Fixed issues building 64-bit Windows binary
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403783
2009-09-05 23:37:35 +00:00
Sam Lantinga
e526b61873 Von: Thomas Zimmermann
Betreff: [SDL] [PATCH] Make static variables const
Datum: Tue, 19 May 2009 19:45:37 +0200

Hi,

this is a set of simple changes which make some of SDL's internal static
arrays constant. The purpose is to shrink the number of write-able
static bytes and thus increase the number of memory pages shared between
SDL applications.

The patch set is against trunk@4513. Each of the attached patch files is
specific to a sub-system. The set is completed by a second mail, because
of the list's 40 KiB limit.

The files readelf-r4513.txt and readelf-const-patch.txt where made by
calling 'readelf -S libSDL.so'. They show the difference in ELF sections
without and with the patch. Some numbers measured on my x86-64:

Before

 [13] .rodata           PROGBITS         00000000000eaaa0  000eaaa0
      0000000000008170  0000000000000000   A       0     0     32
 [19] .data.rel.ro      PROGBITS         00000000003045e0  001045e0
      00000000000023d0  0000000000000000  WA       0     0     32
 [23] .data             PROGBITS         00000000003076e0  001076e0
      0000000000004988  0000000000000000  WA       0     0     32

After

 [13] .rodata           PROGBITS         00000000000eaaa0  000eaaa0
      0000000000009a50  0000000000000000   A       0     0     32
 [19] .data.rel.ro      PROGBITS         0000000000306040  00106040
      0000000000002608  0000000000000000  WA       0     0     32
 [23] .data             PROGBITS         0000000000309360  00109360
      0000000000002e88  0000000000000000  WA       0     0     32

The size of the write-able data section decreased considerably. Some
entries became const-after-relocation, while most of its content went
straight into the read-only data section.

Best regards, Thomas

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403618
2009-06-03 04:37:27 +00:00
Sam Lantinga
0c30a927ed Updated copyright date
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403321
2008-12-08 00:27:32 +00:00
Sam Lantinga
4bab1880be Added software fallback for YUV overlay code when YUV textures aren't available.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403242
2008-11-24 23:25:36 +00:00
Sam Lantinga
809f6ba3b4 Updated Visual C++ build
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403216
2008-09-15 07:34:36 +00:00
Sam Lantinga
ede44c4b85 Final merge of Google Summer of Code 2008 work...
Port SDL 1.3 to the Nintendo DS
by Darren Alton, mentored by Sam Lantinga

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403188
2008-08-27 15:10:03 +00:00
Sam Lantinga
87f2e5ee92 indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402567
2007-07-23 01:17:38 +00:00
Sam Lantinga
b22dc76535 Fixed bug #428
This fix is overkill, but approved by Doug Lea, and he'll be releasing a
new version of his malloc.c sometime next month.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402547
2007-07-16 00:08:35 +00:00
Ryan C. Gordon
280618d6f5 Reverted r3255:3256. Don't actually need it unless the build is broken. :)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402525
2007-07-14 07:05:19 +00:00
Ryan C. Gordon
73619c3660 Merged r3255:3256 from branches/SDL-1.2: stdlib problem with SDL_memcpy macro.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402522
2007-07-14 06:46:33 +00:00
Sam Lantinga
942236ea2a Merged Ryan's patch from revision 3238 in SDL 1.2
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402507
2007-07-12 08:07:30 +00:00
Sam Lantinga
fc3b506099 Whoops, needed to remove the other version of getlocale()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402504
2007-07-12 07:55:18 +00:00
Sam Lantinga
fc4cf4c9fc Fixed bug #455
If passed "" for the character set, let iconv_open() interpret it as
locale.

This was merged from revision 3234,3235 from SDL 1.2

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402503
2007-07-12 07:52:50 +00:00
Sam Lantinga
1066adb528 Fix for bug #447 merged from SDL 1.2
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402408
2007-07-04 08:01:04 +00:00
Sam Lantinga
5d2577791f Fixed bug #349
Solaris doesn't support the LATIN1 character set alias.

Merged from 1.2 svn revision 3133f

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402406
2007-07-04 07:08:16 +00:00
Sam Lantinga
b27739c6c6 iconv() doesn't write to the data, just make compilers happy
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402390
2007-06-28 08:35:35 +00:00
Sam Lantinga
d3a9b053cd Merge iconv const changes from 1.2
I'm not entirely happy with them.  Maybe the right way to go is to leave
SDL_iconv() taking a non-const inbuf?  How often are we converting const
strings anyway?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402388
2007-06-28 06:57:08 +00:00
Sam Lantinga
554147b6c7 make indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402345
2007-06-14 13:21:29 +00:00
Ryan C. Gordon
3c55fdf88e Merged r3047:3048 from branches/SDL-1.2: SDL_revcpy() off-by-one fix.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402334
2007-06-04 11:45:10 +00:00
Ryan C. Gordon
f9ed7eaeb3 Merged r2979:2980 from branches/SDL-1.2: unsigned char in ctype funcs.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402272
2007-02-15 11:14:24 +00:00
Sam Lantinga
9eea51e280 Implemented blend modes in the D3D renderer
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401961
2006-07-19 05:03:21 +00:00
Sam Lantinga
5877021286 More of the Direct3D renderer is implemented, I'm not sure why it's not showing texture copies yet...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401948
2006-07-14 06:40:53 +00:00
Sam Lantinga
9cbad57c92 Removed libc dependency on Windows again, to fix building with Visual C++ 2005 Express Edition.
Fixed performance problem with testsprite2 on the D3D driver.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401946
2006-07-13 08:13:02 +00:00
Sam Lantinga
0f030a1802 SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401938
2006-07-10 21:04:37 +00:00
Sam Lantinga
e64b9862f0 Fixed bug #251
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401865
2006-06-20 05:55:23 +00:00
Sam Lantinga
dc00237efc Fixed uninitialized variable warnings
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401813
2006-05-17 15:08:46 +00:00
Sam Lantinga
b31509f7be Fixed some bugs in string handling
Cleaned up error message code, UTF-8 is used instead of UCS2
Added detection for MPEG Layer 3 audio for more informative errors.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401779
2006-05-11 21:03:23 +00:00
Sam Lantinga
e847bdc465 Fixed bug #175
Removed obsolete .cvsignore files... whee!

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401612
2006-03-23 21:39:58 +00:00
Sam Lantinga
7056c5dc5c RFC 3629 restricted the range of characters encoded with UTF-8 to 0000-10FFFF (the UTF-16 accessible range)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401523
2006-03-13 17:25:44 +00:00
Sam Lantinga
134ae7ea08 *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401517
2006-03-13 02:26:47 +00:00
Sam Lantinga
393b8049ba Added _strnicmp support
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401516
2006-03-13 02:12:39 +00:00
Sam Lantinga
d99aa28246 Win32 fixes
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401514
2006-03-13 02:06:33 +00:00
Sam Lantinga
293e158d84 props yo
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401507
2006-03-13 01:17:22 +00:00