Răsfoiți Sursa

ULib: update test plaintext (#4029)

stefano casazza 7 ani în urmă
părinte
comite
a9a3b89562
1 a modificat fișierele cu 22 adăugiri și 10 ștergeri
  1. 22 10
      frameworks/C++/ulib/src/plaintext.usp

+ 22 - 10
frameworks/C++/ulib/src/plaintext.usp

@@ -1,18 +1,30 @@
+<!--#declaration
+static char* ptr;
+-->
 <!--#header
 -->
 <!--#code
 char* pwbuffer = UClientImage_Base::wbuffer->data();
 
-u_put_unalignedp64(pwbuffer,    U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
-u_put_unalignedp64(pwbuffer+8,  U_MULTICHAR_CONSTANT64('L','e','n','g','t','h',':',' '));
-u_put_unalignedp32(pwbuffer+16, U_MULTICHAR_CONSTANT32('1','3','\r','\n'));
-u_put_unalignedp64(pwbuffer+20, U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
-u_put_unalignedp64(pwbuffer+28, U_MULTICHAR_CONSTANT64('T','y','p','e',':',' ','t','e'));
-u_put_unalignedp64(pwbuffer+36, U_MULTICHAR_CONSTANT64('x','t','/','p','l','a','i','n'));
-u_put_unalignedp32(pwbuffer+44, U_MULTICHAR_CONSTANT32('\r','\n','\r','\n'));
+U_INTERNAL_DUMP("pwbuffer = %#.10S", pwbuffer)
 
-UClientImage_Base::wbuffer->size_adjust_constant(U_CONSTANT_SIZE("Content-Length: 13\r\nContent-Type: text/plain\r\n\r\n") + 13);
+if (u_get_unalignedp64(pwbuffer+36) != U_MULTICHAR_CONSTANT64('x','t','/','p','l','a','i','n'))
+   {
+   u_put_unalignedp64(pwbuffer,    U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
+   u_put_unalignedp64(pwbuffer+8,  U_MULTICHAR_CONSTANT64('L','e','n','g','t','h',':',' '));
+   u_put_unalignedp32(pwbuffer+16, U_MULTICHAR_CONSTANT32('1','3','\r','\n'));
+   u_put_unalignedp64(pwbuffer+20, U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
+   u_put_unalignedp64(pwbuffer+28, U_MULTICHAR_CONSTANT64('T','y','p','e',':',' ','t','e'));
+   u_put_unalignedp64(pwbuffer+36, U_MULTICHAR_CONSTANT64('x','t','/','p','l','a','i','n'));
+   u_put_unalignedp32(pwbuffer+44, U_MULTICHAR_CONSTANT32('\r','\n','\r','\n'));
+
+   ptr = pwbuffer + U_CONSTANT_SIZE("Content-Length: 13\r\nContent-Type: text/plain\r\n\r\n");
+   }
 
-u_put_unalignedp64(pwbuffer+48, U_MULTICHAR_CONSTANT64('H','e','l','l','o',',',' ','W'));
-u_put_unalignedp64(pwbuffer+56, U_MULTICHAR_CONSTANT64('o','r','l','d','!','\0','\0','\0'));
+U_INTERNAL_ASSERT_EQUALS(u_get_unalignedp64(UClientImage_Base::wbuffer->data()), U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'))
+
+u_put_unalignedp64(ptr,   U_MULTICHAR_CONSTANT64('H','e','l','l','o',',',' ','W'));
+u_put_unalignedp64(ptr+8, U_MULTICHAR_CONSTANT64('o','r','l','d','!','\0','\0','\0'));
+
+UClientImage_Base::wbuffer->size_adjust_constant(U_CONSTANT_SIZE("Content-Length: 13\r\nContent-Type: text/plain\r\n\r\n") + 13);
 -->