Commit in reactos/lib/shlwapi on MAIN
path.c+981.7 -> 1.8
shlwapi.spec+2-21.12 -> 1.13
+100-2
2 modified files
Implement PathIsCharValidA/W

reactos/lib/shlwapi
path.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- path.c	19 Sep 2004 10:46:48 -0000	1.7
+++ path.c	24 Sep 2004 15:17:20 -0000	1.8
@@ -3960,3 +3960,101 @@
     return S_OK;
   return E_FAIL;
 }
+
+#define PATH_CHAR_CLASS_LETTER      0x0001
+#define PATH_CHAR_CLASS_ASTERIX     0x0002
+#define PATH_CHAR_CLASS_DOT         0x0004
+#define PATH_CHAR_CLASS_BACKSLASH   0x0008
+#define PATH_CHAR_CLASS_COLON       0x0010
+#define PATH_CHAR_CLASS_SEMICOLON   0x0020
+#define PATH_CHAR_CLASS_COMMA       0x0040
+#define PATH_CHAR_CLASS_SPACE       0x0080
+#define PATH_CHAR_CLASS_OTHER_VALID 0x0100
+#define PATH_CHAR_CLASS_DOUBLEQUOTE 0x0200
+
+/*************************************************************************
+ * PathIsValidCharAW     [internal]
+ *
+ * Check if a char is of a certain class
+ */
+static BOOL WINAPI PathIsValidCharAW(unsigned Ch, DWORD Class)
+{
+  static struct
+  {
+    char Ch;
+    DWORD Class;
+  } CharClass[] =
+  {
+    { ' ', PATH_CHAR_CLASS_SPACE },
+    { '!', PATH_CHAR_CLASS_OTHER_VALID },
+    { '"', PATH_CHAR_CLASS_DOUBLEQUOTE },
+    { '#', PATH_CHAR_CLASS_OTHER_VALID },
+    { '$', PATH_CHAR_CLASS_OTHER_VALID },
+    { '%', PATH_CHAR_CLASS_OTHER_VALID },
+    { '&', PATH_CHAR_CLASS_OTHER_VALID },
+    { '\'', PATH_CHAR_CLASS_OTHER_VALID },
+    { '(', PATH_CHAR_CLASS_OTHER_VALID },
+    { ')', PATH_CHAR_CLASS_OTHER_VALID },
+    { '*', PATH_CHAR_CLASS_ASTERIX },
+    { '+', PATH_CHAR_CLASS_OTHER_VALID },
+    { ',', PATH_CHAR_CLASS_COMMA },
+    { '-', PATH_CHAR_CLASS_OTHER_VALID },
+    { '.', PATH_CHAR_CLASS_DOT },
+    { ':', PATH_CHAR_CLASS_COLON },
+    { ';', PATH_CHAR_CLASS_SEMICOLON },
+    { '=', PATH_CHAR_CLASS_OTHER_VALID },
+    { '?', PATH_CHAR_CLASS_LETTER },
+    { '@', PATH_CHAR_CLASS_OTHER_VALID },
+    { '[', PATH_CHAR_CLASS_OTHER_VALID },
+    { '\\', PATH_CHAR_CLASS_BACKSLASH },
+    { ']', PATH_CHAR_CLASS_OTHER_VALID },
+    { '^', PATH_CHAR_CLASS_OTHER_VALID },
+    { '_', PATH_CHAR_CLASS_OTHER_VALID },
+    { '`', PATH_CHAR_CLASS_OTHER_VALID },
+    { '{', PATH_CHAR_CLASS_OTHER_VALID },
+    { '}', PATH_CHAR_CLASS_OTHER_VALID },
+    { '~', PATH_CHAR_CLASS_OTHER_VALID },
+    { 0x7f, PATH_CHAR_CLASS_OTHER_VALID }
+  };
+  unsigned Index;
+
+  if (('A' <= Ch && Ch <= 'Z') || ('a' <= Ch && Ch <= 'z'))
+  {
+    return (Class & PATH_CHAR_CLASS_LETTER);
+  }
+
+  if (('0' <= Ch && Ch <= '9') || 0x80 <= Ch)
+  {
+    return (Class & PATH_CHAR_CLASS_OTHER_VALID);
+  }
+
+  for (Index = 0; Index < sizeof(CharClass) / sizeof(CharClass[0]); Index++)
+  {
+    if (Ch == CharClass[Index].Ch)
+    {
+      return (Class & CharClass[Index].Class);
+    }
+  }
+
+  return FALSE;
+}
+
+/*************************************************************************
+ * @     [SHLWAPI.455]
+ *
+ * Check if an Ascii char is of a certain class
+ */
+BOOL WINAPI PathIsValidCharA(char Ch, DWORD Class)
+{
+  return PathIsValidCharAW((unsigned) Ch, Class);
+}
+
+/*************************************************************************
+ * @     [SHLWAPI.456]
+ *
+ * Check if an Unicode char is of a certain class
+ */
+BOOL WINAPI PathIsValidCharW(WCHAR Ch, DWORD Class)
+{
+  return PathIsValidCharAW((unsigned) Ch, Class);
+}

reactos/lib/shlwapi
shlwapi.spec 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- shlwapi.spec	24 Sep 2004 11:12:44 -0000	1.12
+++ shlwapi.spec	24 Sep 2004 15:17:20 -0000	1.13
@@ -452,8 +452,8 @@
 452 stub -noname CharUpperNoDBCSW
 453 stub -noname CharLowerNoDBCSA
 454 stub -noname CharLowerNoDBCSW
-455 stub -noname PathIsValidCharA
-456 stub -noname PathIsValidCharW
+455 stdcall -noname PathIsValidCharA(long long)
+456 stdcall -noname PathIsValidCharW(long long)
 457 stub -noname GetLongPathNameWrapW
 458 stub -noname GetLongPathNameWrapA
 459 stdcall SHExpandEnvironmentStringsA(str ptr long) kernel32.ExpandEnvironmentStringsA
CVSspam 0.2.8