reactos/lib/rtl
diff -u -r1.7 -r1.8
--- unicode.c 12 Aug 2004 16:43:37 -0000 1.7
+++ unicode.c 13 Sep 2004 16:58:58 -0000 1.8
@@ -540,8 +540,10 @@
Radix = 10;
if ((Radix != 2) && (Radix != 8) &&
- (Radix != 10) && (Radix != 16))
+ (Radix != 10) && (Radix != 16))
+ {
return STATUS_INVALID_PARAMETER;
+ }
tp = temp;
while (v || tp == temp)
@@ -556,7 +558,64 @@
}
if (tp - temp >= Length)
+ {
+ return STATUS_BUFFER_TOO_SMALL;
+ }
+
+ sp = String;
+ while (tp > temp)
+ *sp++ = *--tp;
+ *sp = 0;
+
+ return STATUS_SUCCESS;
+}
+
+
+/*
+ * @implemented
+ */
+NTSTATUS
+STDCALL
+RtlIntegerToUnicode(
+ IN ULONG Value,
+ IN ULONG Base OPTIONAL,
+ IN ULONG Length OPTIONAL,
+ IN OUT LPWSTR String
+ )
+{
+ ULONG Radix;
+ WCHAR temp[33];
+ ULONG v = Value;
+ ULONG i;
+ PWCHAR tp;
+ PWCHAR sp;
+
+ Radix = Base;
+ if (Radix == 0)
+ Radix = 10;
+
+ if ((Radix != 2) && (Radix != 8) &&
+ (Radix != 10) && (Radix != 16))
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ tp = temp;
+ while (v || tp == temp)
+ {
+ i = v % Radix;
+ v = v / Radix;
+ if (i < 10)
+ *tp = i + L'0';
+ else
+ *tp = i + L'a' - 10;
+ tp++;
+ }
+
+ if (tp - temp >= Length)
+ {
return STATUS_BUFFER_TOO_SMALL;
+ }
sp = String;
while (tp > temp)
@@ -600,22 +659,6 @@
return Status;
}
-/*
- * @unimplemented
- */
-NTSTATUS
-STDCALL
-RtlIntegerToUnicode(
- IN ULONG Value,
- IN ULONG Base OPTIONAL,
- IN ULONG Length OPTIONAL,
- IN OUT LPWSTR String
- )
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
/*
* @implemented