Skip to content

Commit 3438285

Browse files
rapperskullthrimbor
authored andcommitted
Use strcasecmp when useful
1 parent 76a7fb7 commit 3438285

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

extract-xiso.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@
266266
#include <unistd.h>
267267
#endif
268268

269+
#if defined(_MSC_VER)
270+
#define strcasecmp _stricmp
271+
#define strncasecmp _strnicmp
272+
#else
273+
#include <strings.h>
274+
#endif
275+
269276

270277
#if defined( __DARWIN__ )
271278
#define exiso_target "macos-x"
@@ -323,7 +330,7 @@
323330
#define S_ISREG( x ) ( ( x ) & _S_IFREG )
324331

325332
#include "win32/getopt.c"
326-
#ifdef _MSC_VER
333+
#if defined(_MSC_VER)
327334
#include "win32/asprintf.c"
328335
#endif
329336
#define lseek _lseeki64
@@ -1110,7 +1117,7 @@ int decode_xiso( char *in_xiso, char *in_path, modes in_mode, char **out_iso_pat
11101117
len = (int) strlen( name );
11111118

11121119
// create a directory of the same name as the file we are working on, minus the ".iso" portion
1113-
if ( len > 4 && name[ len - 4 ] == '.' && ( name[ len - 3 ] | 0x20 ) == 'i' && ( name[ len - 2 ] | 0x20 ) == 's' && ( name[ len - 1 ] | 0x20 ) == 'o' ) {
1120+
if (len > 4 && strcasecmp(&name[len - 4], ".iso") == 0) {
11141121
name[ len -= 4 ] = 0;
11151122
if ( ( short_name = strdup( name ) ) == nil ) mem_err();
11161123
name[ len ] = '.';
@@ -1785,7 +1792,7 @@ int write_file( dir_node_avl *in_avl, write_tree_context *in_context, int in_dep
17851792
break;
17861793
}
17871794
bytes -= n;
1788-
if (s_media_enable && (len = strlen(in_avl->filename)) >= 4 && in_avl->filename[len - 4] == '.' && (in_avl->filename[len - 3] | 0x20) == 'x' && (in_avl->filename[len - 2] | 0x20) == 'b' && (in_avl->filename[len - 1] | 0x20) == 'e') {
1795+
if (s_media_enable && (len = strlen(in_avl->filename)) >= 4 && strcasecmp(&in_avl->filename[len - 4], ".xbe") == 0) {
17891796
for (buf[n += i] = 0, p = buf; (p = boyer_moore_search(p, n - (p - buf))) != nil; p += XISO_MEDIA_ENABLE_LENGTH) p[XISO_MEDIA_ENABLE_BYTE_POS] = XISO_MEDIA_ENABLE_BYTE;
17901797
if (bytes) {
17911798
i = XISO_MEDIA_ENABLE_LENGTH - 1;

0 commit comments

Comments
 (0)