诸暨麻将添加redis
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

85 rindas
2.9 KiB

  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2009 Google Inc. All rights reserved.
  3. // https://developers.google.com/protocol-buffers/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. // Author: brianolson@google.com (Brian Olson)
  31. // Based on original Protocol Buffers design by
  32. // Sanjay Ghemawat, Jeff Dean, and others.
  33. //
  34. // Test program to verify that GzipInputStream is compatible with command line
  35. // gunzip or java.util.zip.GzipInputStream
  36. //
  37. // Reads gzip stream on standard input and writes decompressed data to standard
  38. // output.
  39. #include <assert.h>
  40. #include <fcntl.h>
  41. #include <stdio.h>
  42. #include <stdlib.h>
  43. #include <unistd.h>
  44. #ifdef _WIN32
  45. #ifndef STDIN_FILENO
  46. #define STDIN_FILENO 0
  47. #endif
  48. #ifndef STDOUT_FILENO
  49. #define STDOUT_FILENO 1
  50. #endif
  51. #endif
  52. #include <google/protobuf/io/gzip_stream.h>
  53. #include <google/protobuf/io/zero_copy_stream_impl.h>
  54. using google::protobuf::io::FileInputStream;
  55. using google::protobuf::io::GzipInputStream;
  56. int main(int argc, const char** argv) {
  57. FileInputStream fin(STDIN_FILENO);
  58. GzipInputStream in(&fin);
  59. while (true) {
  60. const void* inptr;
  61. int inlen;
  62. bool ok;
  63. ok = in.Next(&inptr, &inlen);
  64. if (!ok) {
  65. break;
  66. }
  67. if (inlen > 0) {
  68. int err = write(STDOUT_FILENO, inptr, inlen);
  69. if (err != inlen) {
  70. fprintf(stderr, "write unexpectedly returned %d.\n", err);
  71. return 1;
  72. }
  73. }
  74. }
  75. return 0;
  76. }