pike.git
/
src
/
combine_path.h
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/combine_path.h:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: combine_path.h,v 1.
14
2004
/
01
/
12
22
:
56
:
48
marcus
Exp $
+
|| $Id: combine_path.h,v 1.
15
2009
/
10
/
25
12:
03
:
25
mast
Exp $
*/ /* * Combine path template. * */ #undef IS_SEP #undef IS_ANY_SEP #undef IS_ABS
pike.git/src/combine_path.h:32:
#ifdef NT_COMBINE_PATH #define IS_SEP(X) ( (X) == '/' || (X) == '\\' ) static int find_absolute(PCHARP s) { int c0=INDEX_PCHARP(s,0); int c1=c0?INDEX_PCHARP(s,1):0;
-
if(
isalpha
(c0) && c1==':' && IS_SEP(INDEX_PCHARP(s,2)))
+
/* The following used to use isalpha(c0), but it apparently can
+
* index out-of-bound memory in the msvc 9.0 crt when given 16-bit
+
* char values (known to occur with 0x20ac, at least). Besides, a
+
* drive letter is limited to a..z, so this is faster and more
+
* correct. */
+
if((
(
c0
>= 'A' && c0 <= 'Z'
)
||
+
(c0 >= 'a'
&&
c0 <= 'z')) &&
+
c1==':' && IS_SEP(INDEX_PCHARP(s,2)))
return 3; if(IS_SEP(c0) && IS_SEP(c1)) { int l; for(l=2;INDEX_PCHARP(s,l) && !IS_SEP(INDEX_PCHARP(s,l));l++); return INDEX_PCHARP(s,l)? l+1:l; } return 0;