Skip to content

Commit c94e5d2

Browse files
FIX: Typos
FIX: Parsing Error
1 parent 80724de commit c94e5d2

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

OpenGL/uopengl_ascii_font.pas

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uOpenGL_ASCII_Font.pas ??.??.???? *)
33
(* *)
4-
(* Version : 0.04 *)
4+
(* Version : 0.05 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -29,6 +29,7 @@
2929
(* 0.02 - Added Billboarded/ 3D-Mode rendering *)
3030
(* 0.03 - Disable Lighting on Textout *)
3131
(* 0.04 - Suppurt UTF8 Strings *)
32+
(* 0.05 - CurrentColor nicht nach Außen ändern *)
3233
(* *)
3334
(******************************************************************************)
3435
(* *)
@@ -41,7 +42,7 @@
4142
(* werden : *)
4243
(* *)
4344
(* glPointSize(max(OpenGLControl1.Width / 640, OpenGLControl1.Height / 480)); *)
44-
(* !! Gilt seit ver 0.02 nicht mehr !! *)
45+
(* !! Gilt seit ver 0.02 nicht mehr !! *)
4546
(* *)
4647
(******************************************************************************)
4748
Unit uOpenGL_ASCII_Font;
@@ -233,12 +234,14 @@
233234
sc: Single;
234235
light: Boolean;
235236
// f: GLfloat; <-- Alte Variante mittels glPoints
237+
currentColor: TVector4;
236238
Begin
237239
// glGetFloatv(GL_POINT_SIZE, @f); // Bakup der Point Size, diese wird hier Verändert !! <-- Alte Variante mittels glPoints
238240
light := glIsEnabled(GL_LIGHTING);
239241
If light Then Begin
240242
glDisable(GL_LIGHTING); // Deaktivieren der Beleuchtung, die können wir hier nun wirklich nicht gebrauchen..
241243
End;
244+
glGetFloatv(GL_CURRENT_COLOR, @currentColor);
242245
glPushMatrix();
243246
glTranslatef(x, y, 0);
244247
glColor3fv(@fColor);
@@ -269,6 +272,7 @@
269272
glPopMatrix();
270273
glPopMatrix();
271274
// glPointSize(f); <-- Alte Variante mittels glPoints
275+
glColor4fv(@currentColor);
272276
If light Then Begin
273277
glenable(GL_LIGHTING);
274278
End;

data_control/udomxml.pas

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uDomXML 07.10.2016 *)
33
(* *)
4-
(* Version : 0.09 *)
4+
(* Version : 0.10 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -32,6 +32,7 @@
3232
(* 0.07 - ExpandEmptyNodes *)
3333
(* 0.08 - Erste implementierung zu "escaping" *)
3434
(* 0.09 - generisches AddChild für TDomnode *)
35+
(* 0.10 - FIX scan for invalid characters in Attributes *)
3536
(* *)
3637
(* Known Bugs : -Unsinnige Fehlermeldung wenn gar keine gültige xml Datei *)
3738
(* geparst werden soll. *)
@@ -171,6 +172,31 @@
171172
result := StringReplace(result, '&#38;', '&', [rfReplaceAll]);
172173
End;
173174

175+
(*
176+
* Konvertiert einen String in einen String der in einem XML-Attribut stehen darf
177+
* & -> &amp; , ...
178+
*)
179+
180+
Function StringToXMLAttributeString(Value: String): String;
181+
Begin
182+
result := value;
183+
result := StringReplace(result, '&', '&amp;', [rfReplaceAll]);
184+
result := StringReplace(result, '<', '&lt;', [rfReplaceAll]);
185+
result := StringReplace(result, '"', '&quot;', [rfReplaceAll]);
186+
End;
187+
188+
(*
189+
* Umkehrfunktion zu StringToXMLAttributeString
190+
*)
191+
192+
Function XMLAttributeStringToString(Value: String): String;
193+
Begin
194+
result := value;
195+
result := StringReplace(result, '&quot;', '"', [rfReplaceAll, rfIgnoreCase]);
196+
result := StringReplace(result, '&lt;', '<', [rfReplaceAll, rfIgnoreCase]);
197+
result := StringReplace(result, '&amp;', '&', [rfReplaceAll, rfIgnoreCase]);
198+
End;
199+
174200
{ TDOMXML }
175201

176202
Procedure TDOMXML.Clear;
@@ -412,7 +438,7 @@
412438
If (Not inString) And ((ord(Buffer[Index]) <= 32) Or (Buffer[Index] = '>') Or (Buffer[Index] = '/') Or (isProcessingNode And (Buffer[Index] = '?'))) Then Begin
413439
setlength(result.fAttributes, High(result.fAttributes) + 2);
414440
result.fAttributes[High(result.fAttributes)].AttributeName := an;
415-
result.fAttributes[High(result.fAttributes)].AttributeValue := StringReplace(t, '&quot;', '"', [rfReplaceAll, rfIgnoreCase]);
441+
result.fAttributes[High(result.fAttributes)].AttributeValue := XMLAttributeStringToString(t);
416442
t := '';
417443
If (ord(Buffer[Index]) <= 32) Then Begin // Es folgt ein weiteres Attribut
418444
state := ReadNameAttr;
@@ -539,7 +565,7 @@
539565
s := '<' + Node.NodeName;
540566
End;
541567
For i := 0 To High(Node.fAttributes) Do Begin
542-
s := s + ' ' + Node.fAttributes[i].AttributeName + '="' + StringReplace(Node.fAttributes[i].AttributeValue, '"', '&quot;', [rfReplaceAll, rfIgnoreCase]) + '"';
568+
s := s + ' ' + Node.fAttributes[i].AttributeName + '="' + StringToXMLAttributeString(Node.fAttributes[i].AttributeValue) + '"';
543569
End;
544570
// Ein Node mit nur Attributen
545571
If (High(Node.fNodes) = -1) And (trim(Node.NodeValue) = '') Then Begin
@@ -844,3 +870,4 @@
844870

845871
End.
846872

873+

data_control/uvectormath.pas

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373

7474
Const
7575
Epsilon = 0.00390625; // = 1 / 256, Unterscheiden sich 2 Float Werte um weniger als Epsilon, dann werden sie als Gleich angesehen
76+
7677
Type
7778

7879
(*

0 commit comments

Comments
 (0)