Commit fcc40a07 authored by Alexandre Julliard's avatar Alexandre Julliard

itss: Build with msvcrt.

parent 193f5e93
MODULE = itss.dll
IMPORTS = uuid urlmon shlwapi ole32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
chm_lib.c \
itss.c \
......
......@@ -54,8 +54,6 @@
* *
***************************************************************************/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
......@@ -64,7 +62,7 @@
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.h"
#include "winnls.h"
#include "chm_lib.h"
#include "lzx.h"
......@@ -995,7 +993,7 @@ static UChar *_chm_find_in_PMGL(UChar *page_buf,
return NULL;
/* check if it is the right name */
if (! strcmpiW(buffer, objPath))
if (! wcsicmp(buffer, objPath))
return temp;
_chm_skip_PMGL_entry_data(&cur);
......@@ -1036,7 +1034,7 @@ static Int32 _chm_find_in_PMGI(UChar *page_buf,
return -1;
/* check if it is the right name */
if (strcmpiW(buffer, objPath) > 0)
if (wcsicmp(buffer, objPath) > 0)
return page;
/* load next value for path */
......@@ -1327,9 +1325,8 @@ static Int64 _chm_decompress_region(struct chmFile *h,
/* data request not satisfied, so... start up the decompressor machine */
if (! h->lzx_state)
{
int window_size = ffs(h->window_size) - 1;
h->lzx_last_block = -1;
h->lzx_state = LZXinit(window_size);
h->lzx_state = LZXinit(h->window_size);
}
/* decompress some data */
......@@ -1438,7 +1435,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
/* initialize pathname state */
lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN);
prefixLen = strlenW(prefixRectified);
prefixLen = lstrlenW(prefixRectified);
if (prefixLen != 0)
{
if (prefixRectified[prefixLen-1] != '/')
......@@ -1487,7 +1484,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
/* check if we should start */
if (! it_has_begun)
{
if (ui.length == 0 && strncmpiW(ui.path, prefixRectified, prefixLen) == 0)
if (ui.length == 0 && wcsnicmp(ui.path, prefixRectified, prefixLen) == 0)
it_has_begun = TRUE;
else
continue;
......@@ -1499,7 +1496,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
/* check if we should stop */
else
{
if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0)
if (wcsnicmp(ui.path, prefixRectified, prefixLen) != 0)
{
HeapFree(GetProcessHeap(), 0, page_buf);
return TRUE;
......@@ -1509,14 +1506,14 @@ BOOL chm_enumerate_dir(struct chmFile *h,
/* check if we should include this path */
if (lastPathLen != -1)
{
if (strncmpiW(ui.path, lastPath, lastPathLen) == 0)
if (wcsnicmp(ui.path, lastPath, lastPathLen) == 0)
continue;
}
strcpyW(lastPath, ui.path);
lastPathLen = strlenW(lastPath);
lstrcpyW(lastPath, ui.path);
lastPathLen = lstrlenW(lastPath);
/* get the length of the path */
ui_path_len = strlenW(ui.path)-1;
ui_path_len = lstrlenW(ui.path)-1;
/* check for DIRS */
if (ui.path[ui_path_len] == '/' && !(what & CHM_ENUMERATE_DIRS))
......
......@@ -21,7 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
......@@ -36,7 +35,6 @@
#include "rpcproxy.h"
#include "advpub.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "itsstor.h"
......
......@@ -169,16 +169,11 @@ static const ULONG position_base[51] = {
1835008, 1966080, 2097152
};
struct LZXstate *LZXinit(int window)
struct LZXstate *LZXinit(int wndsize)
{
struct LZXstate *pState=NULL;
ULONG wndsize = 1 << window;
int i, posn_slots;
/* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
/* if a previously allocated window is big enough, keep it */
if (window < 15 || window > 21) return NULL;
/* allocate state and associated window */
pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate));
if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize)))
......@@ -190,12 +185,8 @@ struct LZXstate *LZXinit(int window)
pState->window_size = wndsize;
/* calculate required position slots */
if (window == 20) posn_slots = 42;
else if (window == 21) posn_slots = 50;
else posn_slots = window << 1;
/** alternatively **/
/* posn_slots=i=0; while (i < wndsize) i += 1 << extra_bits[posn_slots++]; */
posn_slots = i = 0;
while (i < wndsize) i += 1 << extra_bits[posn_slots++];
/* initialize other state */
pState->R0 = pState->R1 = pState->R2 = 1;
......@@ -797,7 +788,7 @@ int main(int c, char **v)
int i;
int count=0;
int w = atoi(v[1]);
LZXinit(&state, w);
LZXinit(&state, 1 << w);
fout = fopen(v[2], "wb");
for (i=3; i<c; i++)
{
......
......@@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
......@@ -33,7 +32,6 @@
#include "ole2.h"
#include "wine/itss.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "itsstor.h"
......@@ -292,9 +290,9 @@ static HRESULT WINAPI ITS_IMonikerImpl_GetDisplayName(
TRACE("%p %p %p %p\n", iface, pbc, pmkToLeft, ppszDisplayName);
len = strlenW( This->szFile ) + strlenW( This->szHtml );
len = lstrlenW( This->szFile ) + lstrlenW( This->szHtml );
str = CoTaskMemAlloc( len*sizeof(WCHAR) );
sprintfW( str, szFormat, This->szFile, This->szHtml );
swprintf( str, len, szFormat, This->szFile, This->szHtml );
*ppszDisplayName = str;
......@@ -354,12 +352,12 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPCWSTR name, DWORD n )
DWORD sz;
/* szFile[1] has space for one character already */
sz = FIELD_OFFSET( ITS_IMonikerImpl, szFile[strlenW( name ) + 1] );
sz = FIELD_OFFSET( ITS_IMonikerImpl, szFile[lstrlenW( name ) + 1] );
itsmon = HeapAlloc( GetProcessHeap(), 0, sz );
itsmon->IMoniker_iface.lpVtbl = &ITS_IMonikerImpl_Vtbl;
itsmon->ref = 1;
strcpyW( itsmon->szFile, name );
lstrcpyW( itsmon->szFile, name );
itsmon->szHtml = &itsmon->szFile[n];
while( *itsmon->szHtml == ':' )
......@@ -443,11 +441,11 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_ParseDisplayName(
TRACE("%p %s %p %p\n", This,
debugstr_w( pszDisplayName ), pchEaten, ppmkOut );
if( strncmpiW( pszDisplayName, szPrefix, prefix_len ) )
if( wcsnicmp( pszDisplayName, szPrefix, prefix_len ) )
return MK_E_SYNTAX;
/* search backwards for a double colon */
for( n = strlenW( pszDisplayName ) - 3; prefix_len <= n; n-- )
for( n = lstrlenW( pszDisplayName ) - 3; prefix_len <= n; n-- )
if( ( pszDisplayName[n] == ':' ) && ( pszDisplayName[n+1] == ':' ) )
break;
......@@ -457,7 +455,7 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_ParseDisplayName(
if( !pszDisplayName[n+2] )
return MK_E_SYNTAX;
*pchEaten = strlenW( pszDisplayName ) - n - 3;
*pchEaten = lstrlenW( pszDisplayName ) - n - 3;
return ITS_IMoniker_create( ppmkOut,
&pszDisplayName[prefix_len], n-prefix_len );
......
......@@ -31,7 +31,6 @@
#include "chm_lib.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(itss);
......@@ -153,11 +152,11 @@ static LPCWSTR skip_schema(LPCWSTR url)
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
if(!strncmpiW(its_schema, url, ARRAY_SIZE(its_schema)))
if(!wcsnicmp(its_schema, url, ARRAY_SIZE(its_schema)))
return url + ARRAY_SIZE(its_schema);
if(!strncmpiW(msits_schema, url, ARRAY_SIZE(msits_schema)))
if(!wcsnicmp(msits_schema, url, ARRAY_SIZE(msits_schema)))
return url + ARRAY_SIZE(msits_schema);
if(!strncmpiW(mk_schema, url, ARRAY_SIZE(mk_schema)))
if(!wcsnicmp(mk_schema, url, ARRAY_SIZE(mk_schema)))
return url + ARRAY_SIZE(mk_schema);
return NULL;
......@@ -251,7 +250,7 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
ReleaseBindInfo(&bindinfo);
len = strlenW(ptr)+3;
len = lstrlenW(ptr)+3;
file_name = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
memcpy(file_name, ptr, len*sizeof(WCHAR));
hres = UrlUnescapeW(file_name, NULL, &len, URL_UNESCAPE_INPLACE);
......@@ -261,7 +260,7 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
return hres;
}
p = strstrW(file_name, separator);
p = wcsstr(file_name, separator);
if(!p) {
WARN("invalid url\n");
HeapFree(GetProcessHeap(), 0, file_name);
......@@ -277,7 +276,7 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
}
object_name = p+2;
len = strlenW(object_name);
len = lstrlenW(object_name);
if(*object_name != '/' && *object_name != '\\') {
memmove(object_name+1, object_name, (len+1)*sizeof(WCHAR));
......@@ -307,7 +306,7 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
}
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST,
strrchrW(object_name, '/')+1);
wcsrchr(object_name, '/')+1);
/* FIXME: Native doesn't use FindMimeFromData */
hres = FindMimeFromData(NULL, object_name, NULL, 0, NULL, 0, &mime, 0);
......@@ -487,7 +486,7 @@ static HRESULT WINAPI ITSProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult,
pcchResult, dwReserved);
base_end = strstrW(pwzBaseUrl, separator);
base_end = wcsstr(pwzBaseUrl, separator);
if(!base_end)
return 0x80041001;
base_end += 2;
......@@ -495,20 +494,20 @@ static HRESULT WINAPI ITSProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
if(!skip_schema(pwzBaseUrl))
return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
if(strchrW(pwzRelativeUrl, ':'))
if(wcschr(pwzRelativeUrl, ':'))
return STG_E_INVALIDNAME;
if(pwzRelativeUrl[0] == '#') {
base_end += strlenW(base_end);
base_end += lstrlenW(base_end);
}else if(pwzRelativeUrl[0] != '/') {
ptr = strrchrW(base_end, '/');
ptr = wcsrchr(base_end, '/');
if(ptr)
base_end = ptr+1;
else
base_end += strlenW(base_end);
base_end += lstrlenW(base_end);
}
rel_len = strlenW(pwzRelativeUrl)+1;
rel_len = lstrlenW(pwzRelativeUrl)+1;
*pcchResult = rel_len + (base_end-pwzBaseUrl);
......@@ -516,7 +515,7 @@ static HRESULT WINAPI ITSProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
return E_OUTOFMEMORY;
memcpy(pwzResult, pwzBaseUrl, (base_end-pwzBaseUrl)*sizeof(WCHAR));
strcpyW(pwzResult + (base_end-pwzBaseUrl), pwzRelativeUrl);
lstrcpyW(pwzResult + (base_end-pwzBaseUrl), pwzRelativeUrl);
return S_OK;
}
......
......@@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
......@@ -36,7 +35,6 @@
#include "itsstor.h"
#include "wine/itss.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(itss);
......@@ -167,9 +165,9 @@ static HRESULT WINAPI ITSS_IEnumSTATSTG_Next(
str = cur->ui.path;
if( *str == '/' )
str++;
len = strlenW( str ) + 1;
len = lstrlenW( str ) + 1;
rgelt->pwcsName = CoTaskMemAlloc( len*sizeof(WCHAR) );
strcpyW( rgelt->pwcsName, str );
lstrcpyW( rgelt->pwcsName, str );
/* determine the type */
if( rgelt->pwcsName[len-2] == '/' )
......@@ -345,17 +343,17 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream(
TRACE("%p %s %p %u %u %p\n", This, debugstr_w(pwcsName),
reserved1, grfMode, reserved2, ppstm );
len = strlenW( This->dir ) + strlenW( pwcsName ) + 1;
len = lstrlenW( This->dir ) + lstrlenW( pwcsName ) + 1;
path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
strcpyW( path, This->dir );
lstrcpyW( path, This->dir );
if( pwcsName[0] == '/' || pwcsName[0] == '\\' )
{
p = &path[strlenW( path ) - 1];
p = &path[lstrlenW( path ) - 1];
while( ( path <= p ) && ( *p == '/' ) )
*p-- = 0;
}
strcatW( path, pwcsName );
lstrcatW( path, pwcsName );
for(p=path; *p; p++) {
if(*p == '\\')
......@@ -417,17 +415,17 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
if( !chmfile )
return E_FAIL;
len = strlenW( This->dir ) + strlenW( pwcsName ) + 2; /* need room for a terminating slash */
len = lstrlenW( This->dir ) + lstrlenW( pwcsName ) + 2; /* need room for a terminating slash */
path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
strcpyW( path, This->dir );
lstrcpyW( path, This->dir );
if( pwcsName[0] == '/' || pwcsName[0] == '\\' )
{
p = &path[strlenW( path ) - 1];
p = &path[lstrlenW( path ) - 1];
while( ( path <= p ) && ( *p == '/' ) )
*p-- = 0;
}
strcatW( path, pwcsName );
lstrcatW( path, pwcsName );
for(p=path; *p; p++) {
if(*p == '\\')
......@@ -620,11 +618,11 @@ static HRESULT ITSS_create_chm_storage(
TRACE("%p %s\n", chmfile, debugstr_w( dir ) );
stg = HeapAlloc( GetProcessHeap(), 0,
FIELD_OFFSET( ITSS_IStorageImpl, dir[strlenW( dir ) + 1] ));
FIELD_OFFSET( ITSS_IStorageImpl, dir[lstrlenW( dir ) + 1] ));
stg->IStorage_iface.lpVtbl = &ITSS_IStorageImpl_Vtbl;
stg->ref = 1;
stg->chmfile = chmfile;
strcpyW( stg->dir, dir );
lstrcpyW( stg->dir, dir );
*ppstgOpen = &stg->IStorage_iface;
......
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