From 16decd0fa415b8b729c2bdccb8e04d0ace3c141a Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Wed, 5 Nov 2014 17:01:47 +0000 Subject: [PATCH] linux build ... reading ok git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59455 954022d7-b5bf-4e40-9824-e11837661b57 --- Common/DocxFormat/Source/DocxFormat/Rels.h | 2 +- .../Source/SystemUtility/FileSystem/FilePosix.cpp | 2 +- .../DocxFormat/Source/SystemUtility/SystemUtility.h | 5 ++++- DesktopEditor/common/File.h | 13 ++++++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Common/DocxFormat/Source/DocxFormat/Rels.h b/Common/DocxFormat/Source/DocxFormat/Rels.h index ebe1c8bbc9..de4d2d268c 100644 --- a/Common/DocxFormat/Source/DocxFormat/Rels.h +++ b/Common/DocxFormat/Source/DocxFormat/Rels.h @@ -193,7 +193,7 @@ namespace OOX XmlUtils::CXmlNode oNode; - if ( oNode.FromXmlFile2( oFilePath.GetPath() ) && _T("Relationships") == oNode.GetName() ) + if ( oNode.FromXmlFile2( oRelsPath.GetPath() ) && _T("Relationships") == oNode.GetName() ) { XmlUtils::CXmlNodes oNodes; if ( oNode.GetNodes( _T("Relationship"), oNodes ) ) diff --git a/Common/DocxFormat/Source/SystemUtility/FileSystem/FilePosix.cpp b/Common/DocxFormat/Source/SystemUtility/FileSystem/FilePosix.cpp index 86832d7b9d..ae159dd679 100644 --- a/Common/DocxFormat/Source/SystemUtility/FileSystem/FilePosix.cpp +++ b/Common/DocxFormat/Source/SystemUtility/FileSystem/FilePosix.cpp @@ -6,7 +6,7 @@ namespace FileSystem { std::wstring path_wstring; path_wstring = path; std::string path_string = stringWstingToUtf8String(path_wstring); - return (-1 == access (path_string.c_str(), F_OK)); + return (0 == access (path_string.c_str(), F_OK)); } bool File::Exists(const String& path) { return Exists(path.c_str()); diff --git a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h index 40e0dd64a2..9e28df90e9 100644 --- a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h +++ b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h @@ -115,7 +115,10 @@ namespace OOX int nCurrentSlash = -1; int nCurrentW = 0; bool bIsUp = false; - +#ifndef _WIN32 + if (pData[nCurrent] == (TCHAR)'/') + pDataNorm[nCurrentW++] = (TCHAR) FILE_SEPARATOR_CHAR; +#endif while (nCurrent < nLen) { if (pData[nCurrent] == (TCHAR) '\\' || pData[nCurrent] == (TCHAR)'/') diff --git a/DesktopEditor/common/File.h b/DesktopEditor/common/File.h index d7dae224ed..b82bfb88ba 100644 --- a/DesktopEditor/common/File.h +++ b/DesktopEditor/common/File.h @@ -236,7 +236,7 @@ namespace NSFile { if (NULL == pData) { - pData = new BYTE[6 * lCount + 3 + 1]; + pData = new BYTE[6 * lCount + 3 + 1 + 64]; } BYTE* pCodesCur = pData; @@ -443,8 +443,15 @@ namespace NSFile BYTE* pUtf8 = NULL; LONG lLen = 0; CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); - m_pFile = fopen((char*)pUtf8, "rb"); - delete [] pUtf8; + m_pFile = fopen((char*)pUtf8, "rb"); + + if (NULL == m_pFile) + { + printf("Error: %s\n", strerror(errno)); + m_pFile = fopen((char*)sFileName.c_str(), "rb"); + } + + delete [] pUtf8; #endif if (NULL == m_pFile) return false;