vsrcinfo.cpp
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 4k
Category:

Symbian

Development Platform:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: vsrcinfo.cpp,v 1.4.28.3 2004/07/09 01:48:16 hubbe Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. #include "hlxclib/string.h"
  50. #include "hxcom.h" /* IUnknown */
  51. #include "hxtypes.h" 
  52. #include "growingq.h"
  53. #include "timerep.h"
  54. #include "vsrcinfo.h"
  55. #include "safestring.h"
  56. void 
  57. QueueModificationTime(CBigByteGrowingQueue* pQ, UINT32 ulModTime)
  58. {
  59.     if ( ulModTime )
  60.     {
  61. pQ->EnQueue(z_pLastModified);
  62. UTCTimeRep t(ulModTime);
  63. pQ->EnQueue(t.asRFC1123String());
  64. pQ->EnQueue(z_pEndLine);
  65.     }
  66. }
  67. void
  68. QueueFileSize(CBigByteGrowingQueue* pQ, UINT32 ulFileSize)
  69. {
  70.     char buf[14]; /* Flawfinder: ignore */
  71.     if ( ulFileSize )
  72.     {
  73. pQ->EnQueue(z_pFileSize);
  74. UINT32 num;
  75. BOOL first = TRUE;
  76. // billions.
  77. num = (ulFileSize / 1000000000);
  78. if ( num )
  79. {
  80.     SafeSprintf(buf, sizeof(buf), "%u", num);
  81.     pQ->EnQueue(buf);
  82.     pQ->EnQueue(",");
  83.     first = FALSE;
  84. }
  85. ulFileSize %= 1000000000;
  86. // millions
  87. num = (ulFileSize / 1000000);
  88. if ( (num) || !first )
  89. {
  90.     if ( first )
  91.     {
  92. SafeSprintf(buf, sizeof(buf), "%u", num);
  93. first = FALSE;
  94.     }
  95.     else
  96.     {
  97. SafeSprintf(buf, sizeof(buf), "%03u", num);
  98.     }
  99.     pQ->EnQueue(buf);
  100.     pQ->EnQueue(",");
  101. }
  102. ulFileSize %= 1000000;
  103. // thousands
  104. num = (ulFileSize / 1000);
  105. if ( (num) || !first )
  106. {
  107.     if ( first )
  108.     {
  109. SafeSprintf(buf, sizeof(buf), "%u", num);
  110. first = FALSE;
  111.     }
  112.     else
  113.     {
  114. SafeSprintf(buf, sizeof(buf), "%03u", num);
  115.     }
  116.     pQ->EnQueue(buf);
  117.     pQ->EnQueue(",");
  118. }
  119. // whats left...
  120. ulFileSize %= 1000;
  121. if ( first )
  122. {
  123.     SafeSprintf(buf, sizeof(buf), "%u", ulFileSize);
  124.     first = FALSE;
  125. }
  126. else
  127. {
  128.     SafeSprintf(buf, sizeof(buf), "%03u", ulFileSize);
  129. }
  130. pQ->EnQueue(buf);
  131. pQ->EnQueue(" Bytes");
  132. pQ->EnQueue(z_pEndLine);
  133.     }
  134. }