View Issue Details

IDProjectCategoryView StatusLast Update
0002206ScribusInternalpublic2005-07-16 19:04
Reporterjghali Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindowsOS Version2000 SP4
Product Version1.3.0cvs 
Fixed in Version1.3.0cvs 
Summary0002206: Little patches for improved msvc compatibility
DescriptionHere are little patches which fix following points :
- on win32, use Sleep instead of usleep
- scfonts.cpp : fix a naming conflict ( NO_ERROR => FONT_NO_ERROR)
- util.cpp : fix for use 3 parameters md5_buffer function on msvc
- fileunzip.cpp : declare adequate headers in case of msvc compiler
- scimape.cpp : DWORD EmbedLen = 0 => unsigned int EmbedLen = 0;
        LPBYTE EmbedBuffer => unsigned char* EmbedBuffer;
- use bool instead of int to avoid compiler warnings when necessary
TagsNo tags attached.
Patch

Relationships

related to 0000015 closedjghali Windows Port 

Activities

2005-07-08 14:49

 

patches_msvc_compat.diff (5,688 bytes)   
Index: scribus/fileunzip.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/fileunzip.cpp,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 fileunzip.cpp
--- scribus/fileunzip.cpp	5 Jul 2005 16:45:57 -0000	1.1.2.4
+++ scribus/fileunzip.cpp	8 Jul 2005 16:00:05 -0000
@@ -36,7 +36,13 @@
 # include <unistd.h>
 #endif
 
-# include <utime.h>
+#ifndef _MSC_VER
+#include <utime.h>
+#else
+#include <direct.h>
+#include <time.h>
+#include <sys/utime.h>
+#endif
 
 #include <iostream>
 #include "unzip.h"
@@ -87,7 +93,11 @@
 int mymkdir(char* dirname)
 {
     int ret=0;
+#ifndef _MSC_VER
     ret = mkdir (dirname,0775);
+#else
+	ret = _mkdir(dirname);
+#endif
     return ret;
 }
 
Index: scribus/filewatcher.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/filewatcher.cpp,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 filewatcher.cpp
--- scribus/filewatcher.cpp	5 Jul 2005 16:45:57 -0000	1.1.2.4
+++ scribus/filewatcher.cpp	8 Jul 2005 16:03:31 -0000
@@ -7,6 +7,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
 FileWatcher::FileWatcher( QWidget* parent) : QObject(parent)
 {
 	watchedFiles.clear();
@@ -106,13 +110,21 @@
 			else
 			{
 				uint sizeo = it.data().info.size();
+			#ifndef _WIN32
 				usleep(100);
+			#else
+				Sleep(1);
+			#endif
 				it.data().info.refresh();
 				uint sizen = it.data().info.size();
 				while (sizen != sizeo)
 				{
 					sizeo = sizen;
+				#ifndef _WIN32
 					usleep(100);
+				#else
+					Sleep(1);
+				#endif
 					it.data().info.refresh();
 					sizen = it.data().info.size();
 				}
Index: scribus/scfonts.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/scfonts.cpp,v
retrieving revision 1.15.2.22
diff -u -r1.15.2.22 scfonts.cpp
--- scribus/scfonts.cpp	1 Jul 2005 17:27:58 -0000	1.15.2.22
+++ scribus/scfonts.cpp	8 Jul 2005 16:05:23 -0000
@@ -550,14 +550,14 @@
 	static const char* PSFONT_ADOBE2_HEAD  = "%!PS-Adobe-2.0 Font";
 	static const char* PSFONT_ADOBE21_HEAD  = "%!PS-Adobe-2.1 Font";
 	static const char* PSFONT_ADOBE3_HEAD  = "%!PS-Adobe-3.0 Resource-Font";
-	static const int   NO_ERROR = 0;
+	static const int   FONT_NO_ERROR = 0;
 	
 	const FT_Stream fts = face->stream;
 	char buf[128];
 	
 	fmt = Foi::UNKNOWN_FORMAT;
 	type = Foi::UNKNOWN_TYPE;
-	if (FT_Stream_Seek(fts, 0L) == NO_ERROR && FT_Stream_Read(fts, reinterpret_cast<FT_Byte *>(buf), 128) == NO_ERROR) 
+	if (FT_Stream_Seek(fts, 0L) == FONT_NO_ERROR && FT_Stream_Read(fts, reinterpret_cast<FT_Byte *>(buf), 128) == FONT_NO_ERROR) 
 	{
 		if(strncmp(buf,T42_HEAD,strlen(T42_HEAD)) == 0) 
 		{
Index: scribus/scimage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/scimage.cpp,v
retrieving revision 1.1.2.24
diff -u -r1.1.2.24 scimage.cpp
--- scribus/scimage.cpp	5 Jul 2005 21:32:31 -0000	1.1.2.24
+++ scribus/scimage.cpp	8 Jul 2005 16:28:14 -0000
@@ -3030,8 +3030,8 @@
 		jpeg_read_header(&cinfo, true);
 		jpeg_start_decompress(&cinfo);
 #ifdef HAVE_CMS
-		DWORD EmbedLen = 0;
-		LPBYTE EmbedBuffer;
+		unsigned int EmbedLen = 0;
+		unsigned char* EmbedBuffer;
 		if (read_jpeg_marker(ICC_MARKER,&cinfo, &EmbedBuffer, &EmbedLen) && useEmbedded && CMSuse && useProf)
 		{
 			const char *Descriptor;
Index: scribus/scribusview.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/scribusview.cpp,v
retrieving revision 1.76.2.234
diff -u -r1.76.2.234 scribusview.cpp
--- scribus/scribusview.cpp	6 Jul 2005 20:58:31 -0000	1.76.2.234
+++ scribus/scribusview.cpp	8 Jul 2005 16:33:58 -0000
@@ -6250,7 +6250,7 @@
 void ScribusView::AdvanceSel(PageItem *currItem, int oldPos, int len, int dir, int expandSel, int state)
 {
 	int i;
-	int isSpace;
+	bool isSpace;
 	if ( dir > 0 )
 	{
 		isSpace = currItem->itemText.at(oldPos)->ch.at(0).isSpace();
@@ -6290,7 +6290,7 @@
 void ScribusView::setNewPos(PageItem *currItem, int oldPos, int len, int dir)
 {
 	int i;
-	int isSpace;
+	bool isSpace;
 	if ( dir > 0 && oldPos < len )
 	{
 		isSpace = currItem->itemText.at(oldPos)->ch.at(0).isSpace();
@@ -6328,10 +6328,10 @@
 void ScribusView::ExpandSel(PageItem *currItem, int dir, int oldPos)
 {
 	int len = currItem->itemText.count();
-	int rightSel = false; // assume left right and actual char not selected
-	int leftSel  = false;
-	int actSel   = false;
-	int selMode  = false;
+	bool rightSel = false; // assume left right and actual char not selected
+	bool leftSel  = false;
+	bool actSel   = false;
+	bool selMode  = false;
 
 	if ( dir == -1 || dir == 1 )
 		selMode = true;
Index: scribus/util.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/util.cpp,v
retrieving revision 1.52.2.94
diff -u -r1.52.2.94 util.cpp
--- scribus/util.cpp	5 Jul 2005 16:45:57 -0000	1.52.2.94
+++ scribus/util.cpp	8 Jul 2005 16:16:50 -0000
@@ -35,7 +35,15 @@
 #include <unistd.h>
 #endif
 
+#if defined(_WIN32)
+#if defined(_MSC_VER)
+#define __STDC__ 1 // hack to get md5_buffer correctly identified
+#endif
+#include <windows.h>
+#endif
+
 #include "md5.h"
+
 #include <setjmp.h>
 #include "qprocess.h"
 #include "scpaths.h"
@@ -139,7 +147,11 @@
 	/* start was OK */
 	/* wait a little bit */
 	while( proc->isRunning() )
+#ifndef _WIN32
 		usleep(5000);
+#else
+		Sleep(5);
+#endif
 
 	int ex = proc->exitStatus();
 	delete proc;
patches_msvc_compat.diff (5,688 bytes)   

cbradney

2005-07-08 15:28

administrator   ~0005446

Applied ok. Thanks :).

Issue History

Date Modified Username Field Change
2005-07-08 14:49 jghali New Issue
2005-07-08 14:49 jghali File Added: patches_msvc_compat.diff
2005-07-08 15:24 cbradney Status new => assigned
2005-07-08 15:24 cbradney Assigned To => cbradney
2005-07-08 15:28 cbradney Status assigned => resolved
2005-07-08 15:28 cbradney Fixed in Version => 1.3.0cvs
2005-07-08 15:28 cbradney Resolution open => fixed
2005-07-08 15:28 cbradney Note Added: 0005446
2005-07-09 18:43 cbradney Status resolved => closed
2005-07-16 19:04 ringerc Relationship added related to 0000015