- fix a few warnings

- make it compilable with msvc and gcc4.1.1

svn path=/trunk/; revision=25078
This commit is contained in:
Johannes Anderwald 2006-12-07 08:54:16 +00:00
parent 87084dffa3
commit 3315995e54
5 changed files with 14 additions and 12 deletions

View file

@ -2044,7 +2044,7 @@ option_as_string(unsigned int code, unsigned char *data, int len)
for (; dp < data + len; dp++) {
if (!isascii(*dp) || !isprint(*dp)) {
if (dp + 1 != data + len || *dp != 0) {
snprintf(op, opleft, "\\%03o", *dp);
_snprintf(op, opleft, "\\%03o", *dp);
op += 4;
opleft -= 4;
}

View file

@ -1,4 +1,4 @@
<module name="dhcp" type="win32gui" installbase="system32" installname="dhcp.exe" allowwarnings="true">
<module name="dhcp" type="win32cui" installbase="system32" installname="dhcp.exe" allowwarnings="true">
<include base="dhcp">.</include>
<include base="dhcp">include</include>
<define name="__USE_W32API" />

View file

@ -9,6 +9,7 @@
#include <iphlpapi.h>
#include <dhcpcsdk.h>
#include <stdio.h>
#include <io.h>
#include <setjmp.h>
#include "stdint.h"
#include "predec.h"

View file

@ -566,7 +566,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
!isprint(*dp)) {
if (dp + 1 != data + len ||
*dp != 0) {
snprintf(op, opleft,
_snprintf(op, opleft,
"\\%03o", *dp);
op += 4;
opleft -= 4;
@ -602,7 +602,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 4;
break;
case 'l':
opcount = snprintf(op, opleft, "%ld",
opcount = _snprintf(op, opleft, "%ld",
(long)getLong(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@ -610,7 +610,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 4;
break;
case 'L':
opcount = snprintf(op, opleft, "%ld",
opcount = _snprintf(op, opleft, "%ld",
(unsigned long)getULong(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@ -618,7 +618,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 4;
break;
case 's':
opcount = snprintf(op, opleft, "%d",
opcount = _snprintf(op, opleft, "%d",
getShort(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@ -626,7 +626,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 2;
break;
case 'S':
opcount = snprintf(op, opleft, "%d",
opcount = _snprintf(op, opleft, "%d",
getUShort(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@ -634,20 +634,20 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 2;
break;
case 'b':
opcount = snprintf(op, opleft, "%d",
opcount = _snprintf(op, opleft, "%d",
*(char *)dp++);
if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
break;
case 'B':
opcount = snprintf(op, opleft, "%d", *dp++);
opcount = _snprintf(op, opleft, "%d", *dp++);
if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
break;
case 'x':
opcount = snprintf(op, opleft, "%x", *dp++);
opcount = _snprintf(op, opleft, "%x", *dp++);
if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;

View file

@ -100,6 +100,7 @@ int read_client_conf(void) {
/* What a strage dance */
struct client_config *config;
char ComputerName [MAX_COMPUTERNAME_LENGTH + 1];
LPSTR lpCompName;
DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0];
if ((ifi!= NULL) && (ifi->client->config != NULL))
@ -113,12 +114,12 @@ int read_client_conf(void) {
GetComputerName(ComputerName, & ComputerNameSize);
/* This never gets freed since it's only called once */
LPSTR lpCompName =
lpCompName =
HeapAlloc(GetProcessHeap(), 0, strlen(ComputerName) + 1);
if (lpCompName !=NULL) {
GetComputerName(lpCompName, & ComputerNameSize);
/* Send our hostname, some dhcpds use this to update DNS */
config->send_options[DHO_HOST_NAME].data = strlwr(lpCompName);
config->send_options[DHO_HOST_NAME].data = (u_int8_t*)strlwr(lpCompName);
config->send_options[DHO_HOST_NAME].len = strlen(ComputerName);
debug("Hostname: %s, length: %d",
config->send_options[DHO_HOST_NAME].data,