Review Request 124760: Do not overwrite _WIN32_WINNT in our custom shared-mime-info unistd.c

Kevin Funk kfunk at kde.org
Tue Aug 18 17:51:18 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124760/#review84005
-----------------------------------------------------------


We have a patch that fixes a crash in shared-mime-info:

```
>From 83e045ee8df2ab408af585712d11db960d4de502 Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold at gmail.com>
Date: Tue, 18 Aug 2015 19:36:44 +0300
Subject: [PATCH] Fix update-mime-info. VS was picking wrong function types for
 opendir/readdir because there was no prototypes for them in dirent.h, which
 lead to crash. The second crash was due to writing 8-byte intptr_t value
 returned by _findfirst() into a 4-byte long variable. No idea how it was
 working before.

---
 portage/win32libs/shared-mime-info/dirent.c | 2 +-
 portage/win32libs/shared-mime-info/dirent.h | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/portage/win32libs/shared-mime-info/dirent.c b/portage/win32libs/shared-mime-info/dirent.c
index 2ca945a..c35ae29 100644
--- a/portage/win32libs/shared-mime-info/dirent.c
+++ b/portage/win32libs/shared-mime-info/dirent.c
@@ -83,7 +83,7 @@ DIR * opendir(const char *dir)
 {
     DIR *dp;
     char *filespec;
-    long handle;
+    intptr_t handle;
     int index;
 
     filespec = malloc(strlen(dir) + 2 + 1);
diff --git a/portage/win32libs/shared-mime-info/dirent.h b/portage/win32libs/shared-mime-info/dirent.h
index b98296a..bb4b837 100644
--- a/portage/win32libs/shared-mime-info/dirent.h
+++ b/portage/win32libs/shared-mime-info/dirent.h
@@ -73,7 +73,7 @@ struct dirent {
 
 /* typedef DIR - not the same as Unix */
 typedef struct {
-    long handle;                /* _findfirst/_findnext handle */
+    intptr_t handle;                /* _findfirst/_findnext handle */
     short offset;                /* offset into directory */
     short finished;             /* 1 if there are not more files */
     struct _finddata_t fileinfo;  /* from _findfirst/_findnext */
@@ -81,6 +81,11 @@ typedef struct {
     struct dirent dent;         /* the dirent to return */
 } DIR;
 
+#ifndef __MINGW32__
+DIR * opendir(const char *dir);
+struct dirent * readdir(DIR *dp);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.3.msysgit.0
```

Does that tackle the same issue? Do you know?

- Kevin Funk


On Aug. 15, 2015, 10:47 p.m., Michael Abrahams wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124760/
> -----------------------------------------------------------
> 
> (Updated Aug. 15, 2015, 10:47 p.m.)
> 
> 
> Review request for kdewin.
> 
> 
> Repository: emerge
> 
> 
> Description
> -------
> 
> These additions are part of my recent work building Krita on Windows with MSVC2013 and KDE Frameworks 5.
> 
> 
> Diffs
> -----
> 
>   portage/win32libs/shared-mime-info/unistd.c 440b9e9 
> 
> Diff: https://git.reviewboard.kde.org/r/124760/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Abrahams
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-windows/attachments/20150818/97595e9f/attachment-0001.html>


More information about the Kde-windows mailing list