Sync to Wine-20050524:
[reactos.git] / reactos / lib / msi / table.c
index cf0718b..b0fe75b 100644 (file)
@@ -35,8 +35,6 @@
 #include "msipriv.h"\r
 #include "winnls.h"\r
 \r
-#include "wine/unicode.h"\r
-\r
 #include "query.h"\r
 \r
 WINE_DEFAULT_DEBUG_CHANNEL(msi);\r
@@ -98,7 +96,7 @@ static LPWSTR encode_streamname(BOOL bTable, LPCWSTR in)
     LPWSTR out, p;\r
 \r
     if( !bTable )\r
-        count = strlenW( in )+2;\r
+        count = lstrlenW( in )+2;\r
     out = HeapAlloc( GetProcessHeap(), 0, count*sizeof(WCHAR) );\r
     p = out;\r
 \r
@@ -231,13 +229,13 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME );\r
     if( FAILED( r ) )\r
     {\r
-        ERR("open stream failed r = %08lx!\n",r);\r
+        WARN("open stream failed r = %08lx!\n",r);\r
         goto end;\r
     }\r
 \r
     if( stat.cbSize.QuadPart >> 32 )\r
     {\r
-        ERR("Too big!\n");\r
+        WARN("Too big!\n");\r
         goto end;\r
     }\r
         \r
@@ -245,7 +243,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
     data = HeapAlloc( GetProcessHeap(), 0, sz );\r
     if( !data )\r
     {\r
-        ERR("couldn't allocate memory r=%08lx!\n",r);\r
+        WARN("couldn't allocate memory r=%08lx!\n",r);\r
         ret = ERROR_NOT_ENOUGH_MEMORY;\r
         goto end;\r
     }\r
@@ -254,7 +252,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
     if( FAILED( r ) || ( count != sz ) )\r
     {\r
         HeapFree( GetProcessHeap(), 0, data );\r
-        ERR("read stream failed r = %08lx!\n",r);\r
+        WARN("read stream failed r = %08lx!\n",r);\r
         goto end;\r
     }\r
 \r
@@ -305,13 +303,13 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME );\r
     if( FAILED( r ) )\r
     {\r
-        ERR("open stream failed r = %08lx!\n",r);\r
+        WARN("open stream failed r = %08lx!\n",r);\r
         goto end;\r
     }\r
 \r
     if( stat.cbSize.QuadPart >> 32 )\r
     {\r
-        ERR("Too big!\n");\r
+        WARN("Too big!\n");\r
         goto end;\r
     }\r
         \r
@@ -319,7 +317,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
     data = HeapAlloc( GetProcessHeap(), 0, sz );\r
     if( !data )\r
     {\r
-        ERR("couldn't allocate memory r=%08lx!\n",r);\r
+        WARN("couldn't allocate memory r=%08lx!\n",r);\r
         ret = ERROR_NOT_ENOUGH_MEMORY;\r
         goto end;\r
     }\r
@@ -328,7 +326,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
     if( FAILED( r ) || ( count != sz ) )\r
     {\r
         HeapFree( GetProcessHeap(), 0, data );\r
-        ERR("read stream failed r = %08lx!\n",r);\r
+        WARN("read stream failed r = %08lx!\n",r);\r
         goto end;\r
     }\r
 \r
@@ -364,7 +362,7 @@ static UINT write_stream_data( IStorage *stg, LPCWSTR stname,
     HeapFree( GetProcessHeap(), 0, encname );\r
     if( FAILED( r ) )\r
     {\r
-        ERR("open stream failed r = %08lx\n",r);\r
+        WARN("open stream failed r = %08lx\n",r);\r
         return ret;\r
     }\r
 \r
@@ -372,7 +370,7 @@ static UINT write_stream_data( IStorage *stg, LPCWSTR stname,
     r = IStream_SetSize( stm, size );\r
     if( FAILED( r ) )\r
     {\r
-        ERR("Failed to SetSize\n");\r
+        WARN("Failed to SetSize\n");\r
         goto end;\r
     }\r
 \r
@@ -380,14 +378,14 @@ static UINT write_stream_data( IStorage *stg, LPCWSTR stname,
     r = IStream_Seek( stm, pos, STREAM_SEEK_SET, NULL );\r
     if( FAILED( r ) )\r
     {\r
-        ERR("Failed to Seek\n");\r
+        WARN("Failed to Seek\n");\r
         goto end;\r
     }\r
 \r
     r = IStream_Write(stm, data, sz, &count );\r
     if( FAILED( r ) || ( count != sz ) )\r
     {\r
-        ERR("Failed to Write\n");\r
+        WARN("Failed to Write\n");\r
         goto end;\r
     }\r
 \r
@@ -438,7 +436,7 @@ UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **ptable)
 \r
     if( rawsize % row_size )\r
     {\r
-        ERR("Table size is invalid %d/%d\n", rawsize, row_size );\r
+        WARN("Table size is invalid %d/%d\n", rawsize, row_size );\r
         return ERROR_FUNCTION_FAILED;\r
     }\r
 \r
@@ -773,13 +771,13 @@ UINT save_string_table( MSIDATABASE *db )
     pool = HeapAlloc( GetProcessHeap(), 0, poolsize );\r
     if( ! pool )\r
     {\r
-        ERR("Failed to alloc pool %d bytes\n", poolsize );\r
+        WARN("Failed to alloc pool %d bytes\n", poolsize );\r
         goto err;\r
     }\r
     data = HeapAlloc( GetProcessHeap(), 0, datasize );\r
     if( ! data )\r
     {\r
-        ERR("Failed to alloc data %d bytes\n", poolsize );\r
+        WARN("Failed to alloc data %d bytes\n", poolsize );\r
         goto err;\r
     }\r
 \r
@@ -923,7 +921,7 @@ static UINT get_tablecolumns( MSIDATABASE *db,
     r = get_table( db, szColumns, &table);\r
     if( r != ERROR_SUCCESS )\r
     {\r
-        ERR("table %s not available\n", debugstr_w(szColumns));\r
+        WARN("table %s not available\n", debugstr_w(szColumns));\r
         return r;\r
     }\r
 \r
@@ -932,7 +930,7 @@ static UINT get_tablecolumns( MSIDATABASE *db,
     if( r != ERROR_SUCCESS )\r
     {\r
         release_table( db, table );\r
-        ERR("Couldn't find id for %s\n", debugstr_w(szTableName));\r
+        WARN("Couldn't find id for %s\n", debugstr_w(szTableName));\r
         return r;\r
     }\r
 \r
@@ -1001,7 +999,7 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name )
     r = get_table( db, szTables, &table);\r
     if( r != ERROR_SUCCESS )\r
     {\r
-        ERR("table %s not available\n", debugstr_w(szTables));\r
+        TRACE("table %s not available\n", debugstr_w(szTables));\r
         return FALSE;\r
     }\r
 \r
@@ -1016,7 +1014,7 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name )
     if (i!=count)\r
         return TRUE;\r
 \r
-    ERR("Searched %d tables, but %d was not found\n", count, table_id );\r
+    TRACE("Searched %d tables, but %d was not found\n", count, table_id );\r
 \r
     return FALSE;\r
 }\r
@@ -1117,11 +1115,11 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt
     if( !sval )\r
         return ERROR_INVALID_PARAMETER;\r
 \r
-    len = strlenW( tv->name ) + 2 + strlenW( sval );\r
+    len = lstrlenW( tv->name ) + 2 + lstrlenW( sval );\r
     full_name = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );\r
-    strcpyW( full_name, tv->name );\r
-    strcatW( full_name, szDot );\r
-    strcatW( full_name, sval );\r
+    lstrcpyW( full_name, tv->name );\r
+    lstrcatW( full_name, szDot );\r
+    lstrcatW( full_name, sval );\r
 \r
     r = db_get_raw_stream( tv->db, full_name, stm );\r
     if( r )\r
@@ -1397,7 +1395,7 @@ UINT MSI_CommitTables( MSIDATABASE *db )
     r = save_string_table( db );\r
     if( r != ERROR_SUCCESS )\r
     {\r
-        ERR("failed to save string table r=%08x\n",r);\r
+        WARN("failed to save string table r=%08x\n",r);\r
         return r;\r
     }\r
 \r
@@ -1406,7 +1404,7 @@ UINT MSI_CommitTables( MSIDATABASE *db )
         r = save_table( db, table );\r
         if( r != ERROR_SUCCESS )\r
         {\r
-            ERR("failed to save table %s (r=%08x)\n",\r
+            WARN("failed to save table %s (r=%08x)\n",\r
                   debugstr_w(table->name), r);\r
             return r;\r
         }\r