Просмотр исходного кода

* unicode2ascii: give an internalerror when trying to convert to UTF-8, as
this routine does not support this (and isn't/shouldn't be used for that
purpose in the compiler)

git-svn-id: trunk@31882 -

Jonas Maebe 9 лет назад
Родитель
Сommit
525685617c
1 измененных файлов с 6 добавлено и 23 удалено
  1. 6 23
      compiler/widestr.pas

+ 6 - 23
compiler/widestr.pas

@@ -252,11 +252,15 @@ unit widestr;
         dest   : pchar;
         i      : longint;
       begin
+        { can't implement that here, because the memory size for p() cannot
+          be changed here, and we may need more bytes than have been allocated }
+        if cp=CP_UTF8 then
+          internalerrorproc(2015092701);
+
         if (cp = 0) or (cp=CP_NONE) then
           m:=getmap(current_settings.sourcecodepage)
         else
           m:=getmap(cp);
-         // !!!! MBCS
         source:=tcompilerwidecharptr(r^.data);
         dest:=p;
         for i:=1 to r^.len do
@@ -266,28 +270,7 @@ unit widestr;
            inc(source);
          end;
       end;
-(*
-      var
-        source : tcompilerwidecharptr;
-        dest   : pchar;
-        i      : longint;
-      begin
-        { This routine must work the same as the
-          the routine in the RTL to have the same compile time (for constant strings)
-          and runtime conversion (for variables) }
-        source:=tcompilerwidecharptr(r^.data);
-        dest:=p;
-        for i:=1 to r^.len do
-         begin
-           if word(source^)<128 then
-            dest^:=char(word(source^))
-           else
-            dest^:='?';
-           inc(dest);
-           inc(source);
-         end;
-      end;
-*)
+
 
     function hasnonasciichars(const p: pcompilerwidestring): boolean;
       var