wininet: Implement InternetCreateUrlA/W with test cases

Andreas Mohr andi at rhlx01.fht-esslingen.de
Tue Nov 1 05:35:00 CST 2005


Hi,

On Fri, Oct 28, 2005 at 09:48:08AM -0700, Juan Lang wrote:
> Hi James,
> 
> +/* max port num is 655936 => 6 digits */
> 
> Actually, it's 65535.  A correct comment would be appreciated ;)
> 
> +    *lpdwUrlLength += strlen("://");
> 
> You should use sizeof instead to avoid the call to strlen.  Same for other
> lengths you use, like "@" and ":".
OK, done! ;)

ChangeLog:
Replace all Wine instances of doing a strlen() on a string literal
by its equivalent but much less onerous sizeof() - 1.

Andreas

-- 
"The user-friendly computer is a red herring. The user-friendliness of
a book just makes it easier to turn pages. There's nothing
user-friendly about learning to read."
-Alan Kay
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/advapi32/tests/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/tests/security.c,v
retrieving revision 1.22
diff -u -r1.22 security.c
--- dlls/advapi32/tests/security.c	29 Jun 2005 20:14:16 -0000	1.22
+++ dlls/advapi32/tests/security.c	1 Nov 2005 11:26:34 -0000
@@ -277,17 +277,17 @@
     ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
      "LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n",
      GetLastError());
-    ok(cchName == strlen("SeCreateTokenPrivilege") + 1,
+    ok(cchName == sizeof("SeCreateTokenPrivilege"),
      "LookupPrivilegeNameA returned an incorrect required length for\n"
      "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
-     strlen("SeCreateTokenPrivilege") + 1);
+     sizeof("SeCreateTokenPrivilege"));
     /* check a known value and its returned length on success */
     cchName = sizeof(buf);
     ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) &&
-     cchName == strlen("SeCreateTokenPrivilege"),
+     cchName == sizeof("SeCreateTokenPrivilege") - 1,
      "LookupPrivilegeNameA returned an incorrect output length for\n"
      "SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
-     (int)strlen("SeCreateTokenPrivilege"));
+     (int)sizeof("SeCreateTokenPrivilege") - 1);
     /* check known values */
     for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++)
     {
Index: dlls/comctl32/tests/tab.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/tests/tab.c,v
retrieving revision 1.6
diff -u -r1.6 tab.c
--- dlls/comctl32/tests/tab.c	23 Aug 2005 10:05:54 -0000	1.6
+++ dlls/comctl32/tests/tab.c	1 Nov 2005 11:26:34 -0000
@@ -106,7 +106,7 @@
 
     hdc = GetDC(hwTab);
     hOldFont = SelectObject(hdc, (HFONT)SendMessage(hwTab, WM_GETFONT, 0, 0));
-    GetTextExtentPoint32A(hdc, "Tab 1", strlen("Tab 1"), &size);
+    GetTextExtentPoint32A(hdc, "Tab 1", sizeof("Tab 1") - 1, &size);
     trace("Tab1 text size: size.cx=%ld size.cy=%ld\n", size.cx, size.cy);
     SelectObject(hdc, hOldFont);
     ReleaseDC(hwTab, hdc);
Index: dlls/kernel/tests/atom.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/atom.c,v
retrieving revision 1.12
diff -u -r1.12 atom.c
--- dlls/kernel/tests/atom.c	11 Oct 2005 19:58:38 -0000	1.12
+++ dlls/kernel/tests/atom.c	1 Nov 2005 11:26:34 -0000
@@ -161,7 +161,7 @@
     /* Get the name of the atom we added above */
     memset( buf, '.', sizeof(buf) );
     len = GlobalGetAtomNameA( atom, buf, 10 );
-    ok( len == strlen("foobar"), "bad length %d\n", len );
+    ok( len == sizeof("foobar") - 1, "bad length %d\n", len );
     ok( !memcmp( buf, "foobar\0...", 10 ), "bad buffer contents\n" );
 
     /* Repeat, unicode-style */
@@ -416,7 +416,7 @@
     /* Get the name of the atom we added above */
     memset( buf, '.', sizeof(buf) );
     len = GetAtomNameA( atom, buf, 10 );
-    ok( len == strlen("foobar"), "bad length %d\n", len );
+    ok( len == sizeof("foobar") - 1, "bad length %d\n", len );
     ok( !memcmp( buf, "foobar\0...", 10 ), "bad buffer contents\n" );
 
     /* Repeat, unicode-style */
Index: dlls/msacm/driver.c
===================================================================
RCS file: /home/wine/wine/dlls/msacm/driver.c,v
retrieving revision 1.26
diff -u -r1.26 driver.c
--- dlls/msacm/driver.c	12 Sep 2005 14:12:47 -0000	1.26
+++ dlls/msacm/driver.c	1 Nov 2005 11:26:35 -0000
@@ -364,7 +364,7 @@
         adod.dwVersion = acmGetVersion();
         adod.dwFlags = fdwOpen;
         adod.dwError = 0;
-        len = strlen("Drivers32") + 1;
+        len = sizeof("Drivers32");
         adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
         MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len);
         adod.pszAliasName = padid->pszDriverAlias;
Index: dlls/msi/tests/db.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/tests/db.c,v
retrieving revision 1.16
diff -u -r1.16 db.c
--- dlls/msi/tests/db.c	28 Sep 2005 11:59:40 -0000	1.16
+++ dlls/msi/tests/db.c	1 Nov 2005 11:26:35 -0000
@@ -175,7 +175,7 @@
     len = 0;
     r = MsiDecomposeDescriptorA(desc, prod, feature, comp, &len);
     ok(r == ERROR_SUCCESS, "returned wrong error\n");
-    ok(len == (strlen(desc) - strlen("extra")), "length wrong\n");
+    ok(len == (strlen(desc) - sizeof("extra") - 1), "length wrong\n");
 }
 
 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
Index: dlls/shell32/shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.74
diff -u -r1.74 shlexec.c
--- dlls/shell32/shlexec.c	18 Oct 2005 14:11:17 -0000	1.74
+++ dlls/shell32/shlexec.c	1 Nov 2005 11:26:35 -0000
@@ -595,7 +595,7 @@
     if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY))
     {
        strcpyW(filetype, wszFolder);
-       filetypelen = 6;    /* strlen("Folder") */
+       filetypelen = sizeof("Folder") - 1;
     }
     else
     {
Index: dlls/shell32/tests/shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/shlfileop.c,v
retrieving revision 1.22
diff -u -r1.22 shlfileop.c
--- dlls/shell32/tests/shlfileop.c	11 Oct 2005 19:26:47 -0000	1.22
+++ dlls/shell32/tests/shlfileop.c	1 Nov 2005 11:26:36 -0000
@@ -52,7 +52,7 @@
     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
     ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
     WriteFile(file, name, strlen(name), &written, NULL);
-    WriteFile(file, "\n", strlen("\n"), &written, NULL);
+    WriteFile(file, "\n", sizeof("\n") - 1, &written, NULL);
     CloseHandle(file);
 }
 
Index: dlls/winedos/dosconf.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosconf.c,v
retrieving revision 1.8
diff -u -r1.8 dosconf.c
--- dlls/winedos/dosconf.c	14 Jun 2005 11:48:57 -0000	1.8
+++ dlls/winedos/dosconf.c	1 Nov 2005 11:26:36 -0000
@@ -147,7 +147,7 @@
 {
     int loadhigh = 0;
 
-    *confline += 6; /* strlen("DEVICE") */
+    *confline += sizeof("DEVICE") - 1;
     if (!(strncasecmp(*confline, "HIGH", 4)))
     {
 	loadhigh = 1;
@@ -164,7 +164,7 @@
 
 static int DOSCONF_Dos(char **confline)
 {
-    *confline += 3; /* strlen("DOS") */
+    *confline += sizeof("DOS") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     while (**confline != '\0')
     {
@@ -193,7 +193,7 @@
 
 static int DOSCONF_Fcbs(char **confline)
 {
-    *confline += 4; /* strlen("FCBS") */
+    *confline += sizeof("FCBS") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     DOSCONF_config.fcbs = atoi(*confline);
     if (DOSCONF_config.fcbs > 255)
@@ -207,7 +207,7 @@
 
 static int DOSCONF_Break(char **confline)
 {
-    *confline += 5; /* strlen("BREAK") */
+    *confline += sizeof("BREAK") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     if (!(strcasecmp(*confline, "ON")))
         DOSCONF_config.brk_flag = 1;
@@ -217,7 +217,7 @@
 
 static int DOSCONF_Files(char **confline)
 {
-    *confline += 5; /* strlen("FILES") */
+    *confline += sizeof("FILES") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     DOSCONF_config.files = atoi(*confline);
     if (DOSCONF_config.files > 255)
@@ -240,7 +240,7 @@
     int loadhigh = 0;
 #endif
 
-    *confline += 7; /* strlen("INSTALL") */
+    *confline += sizeof("INSTALL") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     TRACE( "Installing '%s'\n", *confline );
 #if 0
@@ -251,7 +251,7 @@
 
 static int DOSCONF_Lastdrive(char **confline)
 {
-    *confline += 9; /* strlen("LASTDRIVE") */
+    *confline += sizeof("LASTDRIVE") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     DOSCONF_config.lastdrive = toupper(**confline);
     TRACE( "Lastdrive %c\n", DOSCONF_config.lastdrive );
@@ -260,7 +260,7 @@
 
 static int DOSCONF_Country(char **confline)
 {
-    *confline += 7; /* strlen("COUNTRY") */
+    *confline += sizeof("COUNTRY") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     TRACE( "Country '%s'\n", *confline );
     if (DOSCONF_config.country == NULL)
@@ -271,7 +271,7 @@
 
 static int DOSCONF_Numlock(char **confline)
 {
-    *confline += 7; /* strlen("NUMLOCK") */
+    *confline += sizeof("NUMLOCK") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     if (!(strcasecmp(*confline, "ON")))
         DOSCONF_config.flags |= DOSCONF_NUMLOCK;
@@ -284,7 +284,7 @@
 {
     char *p;
 
-    *confline += 8; /* strlen("SWITCHES") */
+    *confline += sizeof("SWITCHES") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     p = strtok(*confline, "/");
     do
@@ -300,7 +300,7 @@
 
 static int DOSCONF_Shell(char **confline)
 {
-    *confline += 5; /* strlen("SHELL") */
+    *confline += sizeof("SHELL") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     TRACE( "Shell '%s'\n", *confline );
     if (DOSCONF_config.shell == NULL)
@@ -312,7 +312,7 @@
 static int DOSCONF_Stacks(char **confline)
 {
 
-    *confline += 6; /* strlen("STACKS") */
+    *confline += sizeof("STACKS") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     DOSCONF_config.stacks_nr = atoi(strtok(*confline, ","));
     DOSCONF_config.stacks_sz = atoi((strtok(NULL, ",")));
@@ -325,7 +325,7 @@
 {
     char *p;
 
-    *confline += 7; /* strlen("BUFFERS") */
+    *confline += sizeof("BUFFERS") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     p = strtok(*confline, ",");
     DOSCONF_config.buf = atoi(p);
@@ -379,7 +379,7 @@
     fpos_t oldpos;
     char *temp;
 
-    *confline += 7; /* strlen("INCLUDE") */
+    *confline += sizeof("INCLUDE") - 1;
     if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
     fgetpos(DOSCONF_fd, &oldpos);
     fseek(DOSCONF_fd, 0, SEEK_SET);
Index: dlls/wininet/tests/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/tests/http.c,v
retrieving revision 1.29
diff -u -r1.29 http.c
--- dlls/wininet/tests/http.c	31 Oct 2005 14:06:35 -0000	1.29
+++ dlls/wininet/tests/http.c	1 Nov 2005 11:26:36 -0000
@@ -358,20 +358,20 @@
   /* 1. When extra info split out explicitly */
   zero_compsA(&urlComponents, 0, 1, 0, 0, 1, 1);
   ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed, error 0x%lx\n", GetLastError());
-  ok(urlComponents.dwUrlPathLength == strlen(TEST_URL2_PATH),".dwUrlPathLength should be %ld, but is %ld\n", (DWORD)strlen(TEST_URL2_PATH), urlComponents.dwUrlPathLength);
-  ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATH,strlen(TEST_URL2_PATH)),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATH, urlComponents.lpszUrlPath);
-  ok(urlComponents.dwHostNameLength == strlen(TEST_URL2_SERVER),".dwHostNameLength should be %ld, but is %ld\n", (DWORD)strlen(TEST_URL2_SERVER), urlComponents.dwHostNameLength);
-  ok(!strncmp(urlComponents.lpszHostName,TEST_URL2_SERVER,strlen(TEST_URL2_SERVER)),"lpszHostName should be %s but is %s\n", TEST_URL2_SERVER, urlComponents.lpszHostName);
-  ok(urlComponents.dwExtraInfoLength == strlen(TEST_URL2_EXTRA),".dwExtraInfoLength should be %ld, but is %ld\n", (DWORD)strlen(TEST_URL2_EXTRA), urlComponents.dwExtraInfoLength);
-  ok(!strncmp(urlComponents.lpszExtraInfo,TEST_URL2_EXTRA,strlen(TEST_URL2_EXTRA)),"lpszExtraInfo should be %s but is %s\n", TEST_URL2_EXTRA, urlComponents.lpszHostName);
+  ok(urlComponents.dwUrlPathLength == sizeof(TEST_URL2_PATH) - 1,".dwUrlPathLength should be %ld, but is %ld\n", (DWORD)(sizeof(TEST_URL2_PATH) - 1), urlComponents.dwUrlPathLength);
+  ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATH,sizeof(TEST_URL2_PATH) - 1),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATH, urlComponents.lpszUrlPath);
+  ok(urlComponents.dwHostNameLength == sizeof(TEST_URL2_SERVER) - 1,".dwHostNameLength should be %ld, but is %ld\n", (DWORD)(sizeof(TEST_URL2_SERVER) - 1), urlComponents.dwHostNameLength);
+  ok(!strncmp(urlComponents.lpszHostName,TEST_URL2_SERVER,sizeof(TEST_URL2_SERVER) - 1),"lpszHostName should be %s but is %s\n", TEST_URL2_SERVER, urlComponents.lpszHostName);
+  ok(urlComponents.dwExtraInfoLength == sizeof(TEST_URL2_EXTRA) - 1,".dwExtraInfoLength should be %ld, but is %ld\n", (DWORD)(sizeof(TEST_URL2_EXTRA) - 1), urlComponents.dwExtraInfoLength);
+  ok(!strncmp(urlComponents.lpszExtraInfo,TEST_URL2_EXTRA,sizeof(TEST_URL2_EXTRA) - 1),"lpszExtraInfo should be %s but is %s\n", TEST_URL2_EXTRA, urlComponents.lpszHostName);
 
   /* 2. When extra info is not split out explicitly and is in url path */
   zero_compsA(&urlComponents, 0, 1, 0, 0, 1, 0);
   ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed with GLE 0x%lx\n",GetLastError());
-  ok(urlComponents.dwUrlPathLength == strlen(TEST_URL2_PATHEXTRA),".dwUrlPathLength should be %ld, but is %ld\n", (DWORD)strlen(TEST_URL2_PATHEXTRA), urlComponents.dwUrlPathLength);
-  ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATHEXTRA,strlen(TEST_URL2_PATHEXTRA)),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATHEXTRA, urlComponents.lpszUrlPath);
-  ok(urlComponents.dwHostNameLength == strlen(TEST_URL2_SERVER),".dwHostNameLength should be %ld, but is %ld\n", (DWORD)strlen(TEST_URL2_SERVER), urlComponents.dwHostNameLength);
-  ok(!strncmp(urlComponents.lpszHostName,TEST_URL2_SERVER,strlen(TEST_URL2_SERVER)),"lpszHostName should be %s but is %s\n", TEST_URL2_SERVER, urlComponents.lpszHostName);
+  ok(urlComponents.dwUrlPathLength == sizeof(TEST_URL2_PATHEXTRA) - 1,".dwUrlPathLength should be %ld, but is %ld\n", (DWORD)(sizeof(TEST_URL2_PATHEXTRA) - 1), urlComponents.dwUrlPathLength);
+  ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATHEXTRA,sizeof(TEST_URL2_PATHEXTRA) - 1),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATHEXTRA, urlComponents.lpszUrlPath);
+  ok(urlComponents.dwHostNameLength == sizeof(TEST_URL2_SERVER) - 1,".dwHostNameLength should be %ld, but is %ld\n", (DWORD)(sizeof(TEST_URL2_SERVER) - 1), urlComponents.dwHostNameLength);
+  ok(!strncmp(urlComponents.lpszHostName,TEST_URL2_SERVER,sizeof(TEST_URL2_SERVER) - 1),"lpszHostName should be %s but is %s\n", TEST_URL2_SERVER, urlComponents.lpszHostName);
 
   /*3. Check for %20 */
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.130
diff -u -r1.130 info.c
--- dlls/winspool/info.c	24 Oct 2005 15:03:02 -0000	1.130
+++ dlls/winspool/info.c	1 Nov 2005 11:26:38 -0000
@@ -218,7 +218,7 @@
 	!strcmp(qbuf,"*")						||
 	!strstr(qbuf,"WINEPS.DRV")
     ) {
-    	char *buf = HeapAlloc(GetProcessHeap(),0,strlen(name)+strlen(devname)+strlen(",WINEPS.DRV,LPR:")+1);
+    	char *buf = HeapAlloc(GetProcessHeap(),0,strlen(name)+strlen(devname)+sizeof(",WINEPS.DRV,LPR:"));
         HKEY hkey;
 
 	sprintf(buf,"%s,WINEPS.DRV,LPR:%s",devname,name);
@@ -269,7 +269,7 @@
     nrofdests = pcupsGetDests(&dests);
     TRACE("Found %d CUPS %s:\n", nrofdests, (nrofdests == 1) ? "printer" : "printers");
     for (i=0;i<nrofdests;i++) {
-        port = HeapAlloc(GetProcessHeap(),0,strlen("LPR:")+strlen(dests[i].name)+1);
+        port = HeapAlloc(GetProcessHeap(),0,sizeof("LPR:")-1+strlen(dests[i].name)+1);
         sprintf(port,"LPR:%s",dests[i].name);
 	devline=HeapAlloc(GetProcessHeap(),0,sizeof("WINEPS.DRV,")+strlen(port));
 	sprintf(devline,"WINEPS.DRV,%s",port);
@@ -377,7 +377,7 @@
         goto end;
     }
 
-    port = HeapAlloc(GetProcessHeap(),0,strlen("LPR:")+strlen(name)+1);
+    port = HeapAlloc(GetProcessHeap(),0,sizeof("LPR:")-1+strlen(name)+1);
     sprintf(port,"LPR:%s",name);
 
     devline=HeapAlloc(GetProcessHeap(),0,sizeof("WINEPS.DRV,")+strlen(port));
Index: programs/regedit/regproc.c
===================================================================
RCS file: /home/wine/wine/programs/regedit/regproc.c,v
retrieving revision 1.22
diff -u -r1.22 regproc.c
--- programs/regedit/regproc.c	19 Aug 2005 10:08:30 -0000	1.22
+++ programs/regedit/regproc.c	1 Nov 2005 11:26:38 -0000
@@ -1227,7 +1227,7 @@
 
                     /* position of where the next character will be printed */
                     /* NOTE: yes, strlen("hex:") is used even for hex(x): */
-                    cur_pos = strlen("\"\"=") + strlen("hex:") +
+                    cur_pos = sizeof("\"\"=") - 1 + sizeof("hex:") - 1 +
                               strlen(*val_name_buf);
 
                     fputs(hex_prefix, file);
Index: programs/winecfg/drive.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/drive.c,v
retrieving revision 1.32
diff -u -r1.32 drive.c
--- programs/winecfg/drive.c	20 Oct 2005 13:16:46 -0000	1.32
+++ programs/winecfg/drive.c	1 Nov 2005 11:26:38 -0000
@@ -494,7 +494,7 @@
                           NULL);
                 WriteFile(hFile,
                           "\n",
-                          strlen("\n"),
+                          sizeof("\n") - 1,
                           &w,
                           NULL);
                 CloseHandle(hFile);
Index: tools/fnt2fon.c
===================================================================
RCS file: /home/wine/wine/tools/fnt2fon.c,v
retrieving revision 1.4
diff -u -r1.4 fnt2fon.c
--- tools/fnt2fon.c	3 Aug 2005 21:25:10 -0000	1.4
+++ tools/fnt2fon.c	1 Nov 2005 11:26:38 -0000
@@ -205,8 +205,8 @@
     memset(&rc_type, 0, sizeof(rc_type));
     fwrite(&rc_type, sizeof(rc_type), 1, ofp);
 
-    fputc(strlen("FONTDIR"), ofp);
-    fwrite("FONTDIR", strlen("FONTDIR"), 1, ofp);
+    fputc(sizeof("FONTDIR") - 1, ofp);
+    fwrite("FONTDIR", sizeof("FONTDIR") - 1, 1, ofp);
     fputc(strlen(resident_name), ofp);
     fwrite(resident_name, strlen(resident_name), 1, ofp);
 


More information about the wine-patches mailing list