Commit 90606aab authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov

[ios] исправлены падения при конвертации на устройствах

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62731 954022d7-b5bf-4e40-9824-e11837661b57
parent 6093b1ad
...@@ -1197,7 +1197,13 @@ public: ...@@ -1197,7 +1197,13 @@ public:
} }
} }
sText = XmlUtils::EncodeXmlString(sText); sText = XmlUtils::EncodeXmlString(sText);
CString sTextXml;sTextXml.Format(_T("<w:lvlText w:val=\"%ls\"/>"), sText);
//CString sTextXml;sTextXml.Format(_T("<w:lvlText w:val=\"%ls\"/>"), sText);
CString sTextXml(_T("<w:lvlText w:val=\""));
sTextXml += sText;
sTextXml += _T("\"/>");
oWriter.WriteString(sTextXml); oWriter.WriteString(sTextXml);
} }
if(bJc) if(bJc)
......
...@@ -476,42 +476,55 @@ namespace NSBinPptxRW ...@@ -476,42 +476,55 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteUSHORT(const _UINT16& lValue) void CBinaryFileWriter::WriteUSHORT(const _UINT16& lValue)
{ {
CheckBufferSize(UINT16_SIZEOF); CheckBufferSize(UINT16_SIZEOF);
#ifdef _IOS
*((_UINT16*)m_pStreamCur) = lValue; memcpy(m_pStreamCur, &lValue, sizeof(_UINT16));
#else
*((_UINT16*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT16_SIZEOF; m_lPosition += UINT16_SIZEOF;
m_pStreamCur += UINT16_SIZEOF; m_pStreamCur += UINT16_SIZEOF;
} }
void CBinaryFileWriter::WriteULONG(const _UINT32& lValue) void CBinaryFileWriter::WriteULONG(const _UINT32& lValue)
{ {
CheckBufferSize(UINT32_SIZEOF); CheckBufferSize(UINT32_SIZEOF);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lValue; memcpy(m_pStreamCur, &lValue, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
} }
void CBinaryFileWriter::WriteLONG(const _INT32& lValue) void CBinaryFileWriter::WriteLONG(const _INT32& lValue)
{ {
CheckBufferSize(INT32_SIZEOF); CheckBufferSize(INT32_SIZEOF);
#ifdef _IOS
*((_INT32*)m_pStreamCur) = lValue; memcpy(m_pStreamCur, &lValue, sizeof(_INT32));
#else
*((_INT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += INT32_SIZEOF; m_lPosition += INT32_SIZEOF;
m_pStreamCur += INT32_SIZEOF; m_pStreamCur += INT32_SIZEOF;
} }
void CBinaryFileWriter::WriteLONG64(const _INT64& lValue) void CBinaryFileWriter::WriteLONG64(const _INT64& lValue)
{ {
CheckBufferSize(INT64_SIZEOF); CheckBufferSize(INT64_SIZEOF);
#ifdef _IOS
*((_INT64*)m_pStreamCur) = lValue; memcpy(m_pStreamCur, &lValue, sizeof(_INT64));
#else
*((_INT64*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += INT64_SIZEOF; m_lPosition += INT64_SIZEOF;
m_pStreamCur += INT64_SIZEOF; m_pStreamCur += INT64_SIZEOF;
} }
void CBinaryFileWriter::WriteINT(const _INT32& lValue) void CBinaryFileWriter::WriteINT(const _INT32& lValue)
{ {
CheckBufferSize(INT32_SIZEOF); CheckBufferSize(INT32_SIZEOF);
#ifdef _IOS
*((_INT32*)m_pStreamCur) = lValue; memcpy(m_pStreamCur, &lValue, sizeof(_INT32));
#else
*((_INT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += INT32_SIZEOF; m_lPosition += INT32_SIZEOF;
m_pStreamCur += INT32_SIZEOF; m_pStreamCur += INT32_SIZEOF;
} }
...@@ -540,13 +553,11 @@ namespace NSBinPptxRW ...@@ -540,13 +553,11 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteDoubleReal(const double& dValue) void CBinaryFileWriter::WriteDoubleReal(const double& dValue)
{ {
CheckBufferSize(DOUBLE_SIZEOF); CheckBufferSize(DOUBLE_SIZEOF);
#ifdef _IOS #ifdef _IOS
memcpy(m_pStreamCur, &dValue, sizeof(double)); memcpy(m_pStreamCur, &dValue, sizeof(double));
#else #else
*((double*)m_pStreamCur) = dValue; // EXC_ARM_DA_ALIGN on ios *((double*)m_pStreamCur) = dValue; // EXC_ARM_DA_ALIGN on ios
#endif #endif
m_lPosition += DOUBLE_SIZEOF; m_lPosition += DOUBLE_SIZEOF;
m_pStreamCur += DOUBLE_SIZEOF; m_pStreamCur += DOUBLE_SIZEOF;
} }
...@@ -561,9 +572,11 @@ namespace NSBinPptxRW ...@@ -561,9 +572,11 @@ namespace NSBinPptxRW
lSizeMem = lSize * sizeof(UTF16); lSizeMem = lSize * sizeof(UTF16);
CheckBufferSize(UINT32_SIZEOF + lSizeMem); CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lSizeMem; memcpy(m_pStreamCur, &lSizeMem, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSizeMem; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
...@@ -590,9 +603,11 @@ namespace NSBinPptxRW ...@@ -590,9 +603,11 @@ namespace NSBinPptxRW
lSizeMem = lSize * sizeof(wchar_t); lSizeMem = lSize * sizeof(wchar_t);
CheckBufferSize(UINT32_SIZEOF + lSizeMem); CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lSizeMem; memcpy(m_pStreamCur, &lSizeMem, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSizeMem; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
...@@ -615,8 +630,11 @@ namespace NSBinPptxRW ...@@ -615,8 +630,11 @@ namespace NSBinPptxRW
_INT32 lSizeMem = lSize * sizeof(char); _INT32 lSizeMem = lSize * sizeof(char);
CheckBufferSize(UINT32_SIZEOF + lSizeMem); CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lSizeMem; memcpy(m_pStreamCur, &lSizeMem, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSizeMem; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
...@@ -650,15 +668,17 @@ namespace NSBinPptxRW ...@@ -650,15 +668,17 @@ namespace NSBinPptxRW
_INT32 lSizeMem = lSize * sizeof(UTF16); _INT32 lSizeMem = lSize * sizeof(UTF16);
CheckBufferSize(UINT32_SIZEOF + lSizeMem); CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lSize; memcpy(m_pStreamCur, &lSize, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSize; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
memcpy(m_pStreamCur, sBuffer, lSizeMem); memcpy(m_pStreamCur, sBuffer, lSizeMem);
m_lPosition += lSizeMem; m_lPosition += lSizeMem;
m_pStreamCur += lSizeMem; m_pStreamCur += lSizeMem;
} }
void CBinaryFileWriter::WriteStringW2_4(const WCHAR* sBuffer) void CBinaryFileWriter::WriteStringW2_4(const WCHAR* sBuffer)
...@@ -667,8 +687,11 @@ namespace NSBinPptxRW ...@@ -667,8 +687,11 @@ namespace NSBinPptxRW
_INT32 lSizeMem = lSize * sizeof(wchar_t); _INT32 lSizeMem = lSize * sizeof(wchar_t);
CheckBufferSize(UINT32_SIZEOF + lSizeMem); CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
*((_UINT32*)m_pStreamCur) = lSize; memcpy(m_pStreamCur, &lSize, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSize; // EXC_ARM_DA_ALIGN on ios
#endif
m_lPosition += UINT32_SIZEOF; m_lPosition += UINT32_SIZEOF;
m_pStreamCur += UINT32_SIZEOF; m_pStreamCur += UINT32_SIZEOF;
...@@ -812,7 +835,11 @@ namespace NSBinPptxRW ...@@ -812,7 +835,11 @@ namespace NSBinPptxRW
{ {
*pData = (BYTE)m_arMainTables[i].Type; *pData = (BYTE)m_arMainTables[i].Type;
++pData; ++pData;
*((_INT32*)pData) = m_arMainTables[i].SeekPos; #ifdef _IOS
memcpy(pData, &m_arMainTables[i].SeekPos, sizeof(_INT32));
#else
*((_INT32*)pData) = m_arMainTables[i].SeekPos; // EXC_ARM_DA_ALIGN on ios
#endif
pData += 4; pData += 4;
} }
} }
...@@ -1496,8 +1523,12 @@ namespace NSBinPptxRW ...@@ -1496,8 +1523,12 @@ namespace NSBinPptxRW
{ {
if (m_lPos + 1 >= m_lSize) if (m_lPos + 1 >= m_lSize)
return 0; return 0;
#ifdef _IOS
_UINT16 res = *((_UINT16*)m_pDataCur); _UINT16 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT16));
#else
_UINT16 res = *((_UINT16*)m_pDataCur); // EXC_ARM_DA_ALIGN on ios
#endif
m_lPos += 2; m_lPos += 2;
m_pDataCur += 2; m_pDataCur += 2;
return res; return res;
...@@ -1508,8 +1539,12 @@ namespace NSBinPptxRW ...@@ -1508,8 +1539,12 @@ namespace NSBinPptxRW
{ {
if (m_lPos + 3 >= m_lSize) if (m_lPos + 3 >= m_lSize)
return 0; return 0;
#ifdef _IOS
_UINT32 res = *((_UINT32*)m_pDataCur); _UINT32 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT32));
#else
_UINT32 res = *((_UINT32*)m_pDataCur); // EXC_ARM_DA_ALIGN on ios
#endif
m_lPos += 4; m_lPos += 4;
m_pDataCur += 4; m_pDataCur += 4;
return res; return res;
...@@ -1518,8 +1553,12 @@ namespace NSBinPptxRW ...@@ -1518,8 +1553,12 @@ namespace NSBinPptxRW
{ {
if (m_lPos + 7 >= m_lSize) if (m_lPos + 7 >= m_lSize)
return 0; return 0;
#ifdef _IOS
_INT64 res = *((_INT64*)m_pDataCur); _INT64 res = 0;
memcpy(&res, m_pDataCur, sizeof(_INT64));
#else
_INT64 res = *((_INT64*)m_pDataCur); // EXC_ARM_DA_ALIGN on ios
#endif
m_lPos += 8; m_lPos += 8;
m_pDataCur += 8; m_pDataCur += 8;
return res; return res;
...@@ -1538,13 +1577,17 @@ namespace NSBinPptxRW ...@@ -1538,13 +1577,17 @@ namespace NSBinPptxRW
} // 8 byte } // 8 byte
double CBinaryFileReader::GetDoubleReal() double CBinaryFileReader::GetDoubleReal()
{ {
if (m_lPos + DOUBLE_SIZEOF > m_lSize) if (m_lPos + DOUBLE_SIZEOF > m_lSize)
return 0; return 0;
#ifdef _IOS
double res = *((double*)m_pDataCur); double res = 0.0;
m_lPos += DOUBLE_SIZEOF; memcpy(&res, m_pDataCur, sizeof(double));
m_pDataCur += DOUBLE_SIZEOF; #else
return res; double res = *((double*)m_pDataCur); // EXC_ARM_DA_ALIGN on ios
#endif
m_lPos += DOUBLE_SIZEOF;
m_pDataCur += DOUBLE_SIZEOF;
return res;
} }
//String //String
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment