Fixed invalid API usage, ...

This commit is contained in:
Armin Novak 2013-08-30 16:29:25 +02:00
parent b190a16c5d
commit 4331fa1f8b
5 changed files with 67 additions and 35 deletions

View File

@ -400,7 +400,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT16 color16; UINT16 color16;
HGDI_BITMAP hSrcBmp; HGDI_BITMAP hSrcBmp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
/* D = (S & P) | (~S & D) */ /* D = (S & P) | (~S & D) */

View File

@ -160,7 +160,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* srcp; BYTE* srcp;
BYTE* dstp; BYTE* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
if ((hdcDest->selectedObject != hdcSrc->selectedObject) || if ((hdcDest->selectedObject != hdcSrc->selectedObject) ||
@ -224,7 +224,7 @@ static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -274,7 +274,7 @@ static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -302,7 +302,7 @@ static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -330,7 +330,7 @@ static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -358,7 +358,7 @@ static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -386,7 +386,7 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -419,7 +419,7 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT32 color32; UINT32 color32;
HGDI_BITMAP hSrcBmp; HGDI_BITMAP hSrcBmp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
/* D = (S & P) | (~S & D) */ /* D = (S & P) | (~S & D) */
@ -484,7 +484,7 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT32* patp; UINT32* patp;
UINT32 color32; UINT32 color32;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
/* D = (S & D) | (~S & P) */ /* D = (S & D) | (~S & P) */
@ -541,7 +541,7 @@ static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT32* patp; UINT32* patp;
UINT32 color32; UINT32 color32;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
/* D = S ^ (P & (D ^ S)) */ /* D = S ^ (P & (D ^ S)) */
@ -597,7 +597,7 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT32* dstp; UINT32* dstp;
UINT32* patp; UINT32* patp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -627,7 +627,7 @@ static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -706,7 +706,7 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT32* dstp; UINT32* dstp;
UINT32* patp; UINT32* patp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -736,7 +736,7 @@ static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* srcp; UINT32* srcp;
UINT32* dstp; UINT32* dstp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)
@ -870,7 +870,7 @@ static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* dstp; UINT32* dstp;
UINT32* patp; UINT32* patp;
if (!hdcDst || !hdcSrc) if (!hdcDest || !hdcSrc)
return 1; return 1;
for (y = 0; y < nHeight; y++) for (y = 0; y < nHeight; y++)

View File

@ -86,6 +86,9 @@ BOOL FilePatternMatchSubExpressionA(LPCSTR lpFileName, size_t cchFileName,
{ {
LPSTR lpMatch; LPSTR lpMatch;
if (!lpFileName)
return FALSE;
if (*lpWildcard == '*') if (*lpWildcard == '*')
{ {
/* /*

View File

@ -31,8 +31,8 @@
#define WINPR_HKLM_HIVE "/etc/winpr/HKLM.reg" #define WINPR_HKLM_HIVE "/etc/winpr/HKLM.reg"
void reg_print_key(Reg* reg, RegKey* key); static void reg_print_key(Reg* reg, RegKey* key);
void reg_print_value(Reg* reg, RegVal* value); static void reg_print_value(Reg* reg, RegVal* value);
struct reg_data_type struct reg_data_type
{ {
@ -41,7 +41,7 @@ struct reg_data_type
DWORD type; DWORD type;
}; };
struct reg_data_type REG_DATA_TYPE_TABLE[] = static struct reg_data_type REG_DATA_TYPE_TABLE[] =
{ {
{ "\"", 1, REG_SZ }, { "\"", 1, REG_SZ },
{ "dword:", 6, REG_DWORD }, { "dword:", 6, REG_DWORD },
@ -55,7 +55,7 @@ struct reg_data_type REG_DATA_TYPE_TABLE[] =
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };
char* REG_DATA_TYPE_STRINGS[] = static char* REG_DATA_TYPE_STRINGS[] =
{ {
"REG_NONE", "REG_NONE",
"REG_SZ", "REG_SZ",
@ -71,7 +71,7 @@ char* REG_DATA_TYPE_STRINGS[] =
"REG_QWORD" "REG_QWORD"
}; };
void reg_load_start(Reg* reg) static void reg_load_start(Reg* reg)
{ {
long int file_size; long int file_size;
@ -79,6 +79,10 @@ void reg_load_start(Reg* reg)
file_size = ftell(reg->fp); file_size = ftell(reg->fp);
fseek(reg->fp, 0, SEEK_SET); fseek(reg->fp, 0, SEEK_SET);
reg->line = NULL;
reg->next_line = NULL;
reg->buffer = NULL;
if (file_size < 1) if (file_size < 1)
return; return;
@ -87,24 +91,41 @@ void reg_load_start(Reg* reg)
if (fread(reg->buffer, file_size, 1, reg->fp) != 1) if (fread(reg->buffer, file_size, 1, reg->fp) != 1)
{ {
free(reg->buffer); free(reg->buffer);
reg->buffer = NULL;
return; return;
} }
reg->buffer[file_size] = '\n'; reg->buffer[file_size] = '\n';
reg->buffer[file_size + 1] = '\0'; reg->buffer[file_size + 1] = '\0';
reg->line = NULL;
reg->next_line = strtok(reg->buffer, "\n"); reg->next_line = strtok(reg->buffer, "\n");
} }
void reg_load_finish(Reg* reg) static void reg_load_finish(Reg* reg)
{ {
free(reg->buffer); if (!reg)
reg->buffer = NULL; return;
reg->line = NULL;
if (reg->buffer)
{
free(reg->buffer);
reg->buffer = NULL;
}
if (reg->line)
{
free(reg->line);
reg->line = NULL;
}
if (reg->next_line)
{
free(reg->next_line);
reg->next_line = NULL;
}
} }
RegVal* reg_load_value(Reg* reg, RegKey* key) static RegVal* reg_load_value(Reg* reg, RegKey* key)
{ {
int index; int index;
char* p[5]; char* p[5];
@ -181,16 +202,19 @@ RegVal* reg_load_value(Reg* reg, RegKey* key)
return value; return value;
} }
BOOL reg_load_has_next_line(Reg* reg) static BOOL reg_load_has_next_line(Reg* reg)
{ {
if (!reg) if (!reg)
return FALSE; return 0;
return (reg->next_line != NULL) ? 1 : 0; return (reg->next_line != NULL) ? 1 : 0;
} }
char* reg_load_get_next_line(Reg* reg) static char* reg_load_get_next_line(Reg* reg)
{ {
if (!reg)
return NULL;
reg->line = reg->next_line; reg->line = reg->next_line;
reg->next_line = strtok(NULL, "\n"); reg->next_line = strtok(NULL, "\n");
reg->line_length = strlen(reg->line); reg->line_length = strlen(reg->line);
@ -198,12 +222,12 @@ char* reg_load_get_next_line(Reg* reg)
return reg->line; return reg->line;
} }
char* reg_load_peek_next_line(Reg* reg) static char* reg_load_peek_next_line(Reg* reg)
{ {
return reg->next_line; return reg->next_line;
} }
void reg_insert_key(Reg* reg, RegKey* key, RegKey* subkey) static void reg_insert_key(Reg* reg, RegKey* key, RegKey* subkey)
{ {
char* name; char* name;
char* path; char* path;
@ -229,7 +253,7 @@ void reg_insert_key(Reg* reg, RegKey* key, RegKey* subkey)
free(path); free(path);
} }
RegKey* reg_load_key(Reg* reg, RegKey* key) static RegKey* reg_load_key(Reg* reg, RegKey* key)
{ {
char* p[2]; char* p[2];
int length; int length;
@ -303,7 +327,7 @@ void reg_load(Reg* reg)
reg_load_finish(reg); reg_load_finish(reg);
} }
void reg_unload_value(Reg* reg, RegVal* value) static void reg_unload_value(Reg* reg, RegVal* value)
{ {
if (value->type == REG_DWORD) if (value->type == REG_DWORD)
{ {
@ -321,7 +345,7 @@ void reg_unload_value(Reg* reg, RegVal* value)
free(value); free(value);
} }
void reg_unload_key(Reg* reg, RegKey* key) static void reg_unload_key(Reg* reg, RegKey* key)
{ {
RegVal* pValue; RegVal* pValue;
RegVal* pValueNext; RegVal* pValueNext;

View File

@ -16,6 +16,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef REGISTRY_REG_H_
#define REGISTRY_REG_H_
#include <winpr/registry.h> #include <winpr/registry.h>
@ -62,3 +64,6 @@ struct _reg_key
}; };
Reg* reg_open(BOOL read_only); Reg* reg_open(BOOL read_only);
void reg_close(Reg *reg);
#endif