aboutsummaryrefslogtreecommitdiff
path: root/src/Serialize.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-21 18:11:55 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-21 21:31:11 +0700
commit325dca9f212f9fd44cd10a8180529970c7a08c72 (patch)
treee1cfaec078dfa49f4d51d05eef8a5b0967843a41 /src/Serialize.cpp
parent10f5376de856ecead4e8bbf66f19157f36f7a382 (diff)
downloadblackshades-325dca9f212f9fd44cd10a8180529970c7a08c72.tar.gz
Remove trailing whitespaces and duplicated blank lines1.2.0
Diffstat (limited to 'src/Serialize.cpp')
-rw-r--r--src/Serialize.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/Serialize.cpp b/src/Serialize.cpp
index 589dcb9..443e935 100644
--- a/src/Serialize.cpp
+++ b/src/Serialize.cpp
@@ -10,16 +10,16 @@ int ReadBool(int fd, int count, bool *b)
{
while (count--) {
unsigned char buf[1];
-
+
if (read(fd, buf, 1) != 1) {
STUB_FUNCTION;
}
-
+
*b = (buf[0] != 0) ? true : false;
-
+
b++;
}
-
+
return 1;
}
@@ -27,16 +27,16 @@ int ReadShort(int fd, int count, short *s)
{
while (count--) {
unsigned char buf[2];
-
+
if (read(fd, buf, 2) != 2) {
STUB_FUNCTION;
}
-
+
*s = (short)((buf[0] << 8) | buf[1]);
-
+
s++;
}
-
+
return 1;
}
@@ -44,16 +44,16 @@ int ReadInt(int fd, int count, int *s)
{
while (count--) {
unsigned char buf[4];
-
+
if (read(fd, buf, 4) != 4) {
STUB_FUNCTION;
}
-
+
*s = (int)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
-
+
s++;
}
-
+
return 1;
}
@@ -65,15 +65,15 @@ union intfloat {
int ReadFloat(int fd, int count, float *f)
{
union intfloat infl;
-
+
while (count--) {
ReadInt(fd, 1, &(infl.i));
-
+
*f = infl.f;
-
+
f++;
}
-
+
return 1;
}
@@ -83,10 +83,10 @@ int ReadXYZ(int fd, int count, XYZ *xyz)
ReadFloat(fd, 1, &(xyz->x));
ReadFloat(fd, 1, &(xyz->y));
ReadFloat(fd, 1, &(xyz->z));
-
+
xyz++;
}
-
+
return 1;
}
@@ -99,9 +99,9 @@ int ReadTexturedTriangle(int fd, int count, TexturedTriangle *tt)
ReadFloat(fd, 1, &(tt->r));
ReadFloat(fd, 1, &(tt->g));
ReadFloat(fd, 1, &(tt->b));
-
+
tt++;
}
-
+
return count;
}