Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51b5573

Browse files
committed
Fix for ODBC compile warnings.
1 parent918feb6 commit51b5573

File tree

10 files changed

+54
-45
lines changed

10 files changed

+54
-45
lines changed

‎src/interfaces/odbc/bind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ PGAPI_ParamOptions(
340340
mylog("%s: entering... %d %x\n",func,crow,pirow);
341341

342342
stmt->options.paramset_size=crow;
343-
stmt->options.param_processed_ptr=pirow;
343+
stmt->options.param_processed_ptr=(SQLUINTEGER*)pirow;
344344
returnSQL_SUCCESS;
345345
}
346346

‎src/interfaces/odbc/connection.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,7 @@ CC_get_error(ConnectionClass *self, int *number, char **message)
11301130
QResultClass*
11311131
CC_send_query(ConnectionClass*self,char*query,QueryInfo*qi,UDWORDflag)
11321132
{
1133-
QResultClass*result_in=NULL,
1134-
*cmdres=NULL,
1133+
QResultClass*cmdres=NULL,
11351134
*retres=NULL,
11361135
*res=NULL;
11371136
BOOLclear_result_on_abort= ((flag&CLEAR_RESULT_ON_ABORT)!=0),

‎src/interfaces/odbc/convert.c

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ char *mapFuncs[][2] = {
107107
{"DAYNAME","to_char($1, 'Day')" },
108108
{"DAYOFMONTH","cast(extract(day from $1) as integer)" },
109109
{"DAYOFWEEK","(cast(extract(dow from $1) as integer) + 1)" },
110-
{"DAYOFYEAR","cast(extract(doy from $1) as integer)" },
110+
{"DAYOFYEAR","cast(extract(doy from $1) as integer)" },
111111
{"HOUR","cast(extract(hour from $1) as integer)" },
112112
{"MINUTE","cast(extract(minute from $1) as integer)" },
113113
{"MONTH","cast(extract(month from $1) as integer)" },
@@ -161,7 +161,9 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
161161
*ptr;
162162
intscnt,
163163
i;
164+
#if defined(WIN32)|| defined(HAVE_INT_TIMEZONE)
164165
longtimediff;
166+
#endif
165167
BOOLwithZone=*bZone;
166168

167169
*bZone= FALSE;
@@ -402,7 +404,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
402404
else
403405
{
404406
stmt->errornumber=STMT_RETURN_NULL_WITHOUT_INDICATOR;
405-
stmt->errormsg="StrLen_or_IndPtr was a null pointer and NULL data was retrieved";
407+
stmt->errormsg="StrLen_or_IndPtr was a null pointer and NULL data was retrieved";
406408
SC_log_error(func,"",stmt);
407409
returnSQL_ERROR;
408410
}
@@ -757,7 +759,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
757759
if (cbValueMax<2* (SDWORD)ucount)
758760
result=COPY_RESULT_TRUNCATED;
759761
len=ucount*2;
760-
free(str);
762+
free(str);
761763
}
762764
else
763765
{
@@ -1431,7 +1433,8 @@ copy_statement_with_parameters(StatementClass *stmt)
14311433
*/
14321434
elseif (oldchar=='{')
14331435
{
1434-
char*begin=&old_statement[opos],*end;
1436+
char*begin=&old_statement[opos];
1437+
constchar*end;
14351438

14361439
/* procedure calls */
14371440
if (stmt->statement_type==STMT_TYPE_PROCCALL)
@@ -1463,8 +1466,8 @@ copy_statement_with_parameters(StatementClass *stmt)
14631466
proc_no_param= FALSE;
14641467
continue;
14651468
}
1466-
if (convert_escape(begin,stmt,&npos,&new_stsize,&end
1467-
)!=CONVERT_ESCAPE_OK)
1469+
if (convert_escape(begin,stmt,&npos,&new_stsize,&end)!=
1470+
CONVERT_ESCAPE_OK)
14681471
{
14691472
stmt->errormsg="ODBC escape convert error";
14701473
stmt->errornumber=STMT_EXEC_ERROR;
@@ -1604,7 +1607,7 @@ copy_statement_with_parameters(StatementClass *stmt)
16041607
buffer+= (bind_size*current_row);
16051608
elseif (ctypelen=ctype_length(stmt->parameters[param_number].CType),ctypelen>0)
16061609
buffer+=current_row*ctypelen;
1607-
else
1610+
else
16081611
buffer+=current_row*stmt->parameters[param_number].buflen;
16091612
}
16101613
if (stmt->parameters[param_number].used)
@@ -2080,7 +2083,7 @@ mapFunction(const char *func, int param_count)
20802083
if (mapFuncs[i][0][0]=='%')
20812084
{
20822085
if (mapFuncs[i][0][1]-'0'==param_count&&
2083-
!stricmp(mapFuncs[i][0]+2,func))
2086+
!stricmp(mapFuncs[i][0]+2,func))
20842087
returnmapFuncs[i][1];
20852088
}
20862089
elseif (!stricmp(mapFuncs[i][0],func))
@@ -2098,7 +2101,7 @@ static int processParameters(const ConnectionClass *conn, const char *value, cha
20982101
* inner_convert_escape()
20992102
* work with embedded escapes sequences
21002103
*/
2101-
2104+
21022105
static
21032106
intinner_convert_escape(constConnectionClass*conn,constchar*value,
21042107
char*result,UInt4maxLen,constchar**input_resume,
@@ -2111,7 +2114,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21112114
constchar*valptr;
21122115
UInt4vlen,prtlen,input_consumed,param_consumed,extra_len;
21132116
Int4param_pos[16][2];
2114-
2117+
21152118
valptr=value;
21162119
if (*valptr=='{')/* skip the first { */
21172120
valptr++;
@@ -2123,7 +2126,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21232126
valptr++;
21242127
while ((*valptr!='\0')&&isspace((unsignedchar)*valptr))
21252128
valptr++;
2126-
2129+
21272130
if (end=my_strchr(conn,valptr,'}'),NULL==end)
21282131
{
21292132
mylog("%s couldn't find the ending }\n",func);
@@ -2135,7 +2138,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21352138
valnts[vlen]='\0';
21362139
*input_resume=valptr+vlen;/* resume from the last } */
21372140
mylog("%s: key='%s', val='%s'\n",func,key,valnts);
2138-
2141+
21392142
extra_len=0;
21402143
if (isalnum(result[-1]))/* Avoid the concatenation of the function name with the previous word. Aceto */
21412144
{
@@ -2172,7 +2175,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21722175
{
21732176
/* Literal; return the escape part as-is */
21742177
strncpy(result,valnts,maxLen);
2175-
prtlen=vlen;
2178+
prtlen=vlen;
21762179
}
21772180
elseif (strcmp(key,"fn")==0)
21782181
{
@@ -2183,7 +2186,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21832186
char*funcEnd=valnts;
21842187
charsvchar;
21852188
constchar*mapExpr;
2186-
2189+
21872190
params[sizeof(params)-1]='\0';
21882191

21892192
while ((*funcEnd!='\0')&& (*funcEnd!='(')&&
@@ -2197,7 +2200,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
21972200
funcEnd++;
21982201

21992202
/*
2200-
* We expect left parenthesis here, else return fn body as-is
2203+
* We expect left parenthesis here, else return fn body as-is
22012204
* since it is one of those "function constants".
22022205
*/
22032206
if (*funcEnd!='(')
@@ -2213,7 +2216,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
22132216
*/
22142217

22152218
valptr+= (UInt4)(funcEnd-valnts);
2216-
if (subret=processParameters(conn,valptr,params,sizeof(params)-1,&input_consumed,&param_consumed,param_pos),CONVERT_ESCAPE_OK!=subret)
2219+
if (subret=processParameters(conn,valptr,params,sizeof(params)-1,&input_consumed,&param_consumed,param_pos),CONVERT_ESCAPE_OK!=subret)
22172220
returnCONVERT_ESCAPE_ERROR;
22182221

22192222
for (param_count=0;;param_count++)
@@ -2222,9 +2225,9 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
22222225
break;
22232226
}
22242227
if (param_count==1&&
2225-
param_pos[0][1]<param_pos[0][0])
2228+
param_pos[0][1]<param_pos[0][0])
22262229
param_count=0;
2227-
2230+
22282231
mapExpr=mapFunction(key,param_count);
22292232
if (mapExpr==NULL)
22302233
prtlen=snprintf(result,maxLen,"%s%s",key,params);
@@ -2256,7 +2259,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
22562259
{
22572260
pidx=*mapptr-'0'-1;
22582261
if (pidx<0||
2259-
param_pos[pidx][0]<0)
2262+
param_pos[pidx][0]<0)
22602263
{
22612264
qlog("%s %dth param not found for the expression %s\n",pidx+1,mapExpr);
22622265
returnCONVERT_ESCAPE_ERROR;
@@ -2291,7 +2294,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
22912294
/* Bogus key, leave untranslated */
22922295
returnCONVERT_ESCAPE_ERROR;
22932296
}
2294-
2297+
22952298
if (count)
22962299
*count=prtlen+extra_len;
22972300
if (prtlen<0||prtlen >=maxLen)/* buffer overflow */
@@ -2301,12 +2304,12 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value,
23012304
}
23022305
returnCONVERT_ESCAPE_OK;
23032306
}
2304-
2307+
23052308
/*
23062309
* processParameters()
23072310
* Process function parameters and work with embedded escapes sequences.
23082311
*/
2309-
2312+
23102313
static
23112314
intprocessParameters(constConnectionClass*conn,constchar*value,
23122315
char*result,UInt4maxLen,UInt4*input_consumed,
@@ -2321,7 +2324,7 @@ int processParameters(const ConnectionClass *conn, const char *value,
23212324
#ifdefMULTIBYTE
23222325
encoded_strencstr;
23232326
#endif/* MULTIBYTE */
2324-
2327+
23252328
buf[sizeof(buf)-1]='\0';
23262329
innerParenthesis=0;
23272330
in_quote=in_dquote=in_escape=leadingSpace= FALSE;
@@ -2400,7 +2403,7 @@ int processParameters(const ConnectionClass *conn, const char *value,
24002403
}
24012404
innerParenthesis++;
24022405
break;
2403-
2406+
24042407
case')':
24052408
innerParenthesis--;
24062409
if (0==innerParenthesis)
@@ -2411,18 +2414,18 @@ int processParameters(const ConnectionClass *conn, const char *value,
24112414
param_pos[param_count][1]=-1;
24122415
}
24132416
break;
2414-
2417+
24152418
case'}':
24162419
stop= TRUE;
24172420
break;
2418-
2421+
24192422
case'{':
24202423
if (subret=inner_convert_escape(conn,valptr,buf,sizeof(buf)-1,&valptr,&inner_count),CONVERT_ESCAPE_OK!=subret)
24212424
returnCONVERT_ESCAPE_ERROR;
2422-
2425+
24232426
if (inner_count+count >=maxLen)
24242427
returnCONVERT_ESCAPE_OVERFLOW;
2425-
memcpy(&result[count],buf,inner_count);
2428+
memcpy(&result[count],buf,inner_count);
24262429
count+=inner_count;
24272430
ipos= (UInt4) (valptr-value);
24282431
continue;
@@ -2442,14 +2445,15 @@ int processParameters(const ConnectionClass *conn, const char *value,
24422445
*output_count=count;
24432446
returnCONVERT_ESCAPE_OK;
24442447
}
2445-
2448+
24462449
/*
24472450
* convert_escape()
24482451
* This function returns a pointer to static memory!
24492452
*/
2450-
2453+
24512454
int
2452-
convert_escape(constchar*value,StatementClass*stmt,int*npos,int*stsize,constchar**val_resume)
2455+
convert_escape(constchar*value,StatementClass*stmt,int*npos,int*stsize,
2456+
constchar**val_resume)
24532457
{
24542458
intret,pos=*npos;
24552459
UInt4count;

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len)
641641
flag |=BIT_TRUEISMINUS1;
642642

643643
sprintf(&connect_string[hlen],
644-
";A6=%s;A7=%d;A8=%d;B0=%d;B1=%d;C2=%s;CX=%02x%x",
644+
";A6=%s;A7=%d;A8=%d;B0=%d;B1=%d;C2=%s;CX=%02x%lx",
645645
encoded_conn_settings,
646646
ci->drivers.fetch_max,
647647
ci->drivers.socket_buffersize,
@@ -662,15 +662,15 @@ unfoldCXAttribute(ConnInfo *ci, const char *value)
662662
if (strlen(value)<2)
663663
{
664664
count=3;
665-
sscanf(value,"%x",&flag);
665+
sscanf(value,"%lx",&flag);
666666
}
667667
else
668668
{
669669
charcnt[8];
670670
memcpy(cnt,value,2);
671671
cnt[2]='\0';
672672
sscanf(cnt,"%x",&count);
673-
sscanf(value+2,"%x",&flag);
673+
sscanf(value+2,"%lx",&flag);
674674
}
675675
ci->disallow_premature= (char)((flag&BIT_DISALLOWPREMATURE)!=0);
676676
ci->updatable_cursors= (char)((flag&BIT_UPDATABLECURSORS)!=0);

‎src/interfaces/odbc/environ.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ PGAPI_StmtError(HSTMT hstmt,
9494
StatementClass*stmt= (StatementClass*)hstmt;
9595
char*msg;
9696
intstatus;
97-
BOOLonce_again= FALSE,
98-
partial_ok= (flag&PODBC_ALLOW_PARTIAL_EXTRACT!=0),
99-
clear_str= (flag&PODBC_ERROR_CLEAR!=0);
97+
BOOLpartial_ok= ((flag&PODBC_ALLOW_PARTIAL_EXTRACT)!=0),
98+
clear_str= ((flag&PODBC_ERROR_CLEAR)!=0);
10099
SWORDmsglen,stapos,wrtlen,pcblen;
101100

102101
mylog("**** PGAPI_StmtError: hstmt=%u <%d>\n",hstmt,cbErrorMsgMax);

‎src/interfaces/odbc/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3983,7 +3983,7 @@ PGAPI_TablePrivileges(
39833983
char*grolist,*uid,*delm;
39843984

39853985
snprintf(proc_query,sizeof(proc_query)-1,"select grolist from pg_group where groname = '%s'",user);
3986-
if (gres=CC_send_query(conn,proc_query,NULL,CLEAR_RESULT_ON_ABORT))
3986+
if ((gres=CC_send_query(conn,proc_query,NULL,CLEAR_RESULT_ON_ABORT)))
39873987
{
39883988
grolist=QR_get_value_backend_row(gres,0,0);
39893989
if (grolist&&grolist[0]=='{')

‎src/interfaces/odbc/multibyte.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ pg_CS_stat(int stat,unsigned int character,int characterset_code)
228228
character>0xa0)
229229
stat=3;
230230
elseif (stat==3||
231-
stat<2&&
232-
character>0xa0)
231+
(stat<2&&
232+
character>0xa0))
233233
stat=2;
234234
elseif (stat==2)
235235
stat=1;

‎src/interfaces/odbc/multibyte.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,7 @@ void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str);
8686
#definemake_encoded_str(encstr,conn,str) encoded_str_constr(encstr, conn->ccsc, str)
8787
externintencoded_nextchar(encoded_str*encstr);
8888
externintencoded_byte_check(encoded_str*encstr,intabspos);
89+
90+
/* This doesn't seem to be called by anyone, bjm 2002-03-24 */
91+
externintpg_ismb(intcharacterset_code);
8992
#definecheck_client_encoding(X) pg_CS_name(pg_CS_code(X))

‎src/interfaces/odbc/pgtypes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
234234
{
235235
ConnectionClass*conn=SC_get_conn(stmt);
236236
ConnInfo*ci=&(conn->connInfo);
237+
#if (ODBCVER >=0x0300)
237238
EnvironmentClass*env= (EnvironmentClass*) (conn->henv);
239+
#endif
238240

239241
switch (type)
240242
{
@@ -342,7 +344,9 @@ pgtype_to_ctype(StatementClass *stmt, Int4 type)
342344
{
343345
ConnectionClass*conn=SC_get_conn(stmt);
344346
ConnInfo*ci=&(conn->connInfo);
347+
#if (ODBCVER >=0x0300)
345348
EnvironmentClass*env= (EnvironmentClass*) (conn->henv);
349+
#endif
346350

347351
switch (type)
348352
{

‎src/interfaces/odbc/qresult.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,10 @@ QR_read_tuple(QResultClass *self, char binary)
731731
if (this_keyset)
732732
{
733733
if (this_tuplefield[num_fields-2].value)
734-
sscanf(this_tuplefield[num_fields-2].value,"(%u,%hu)",
734+
sscanf(this_tuplefield[num_fields-2].value,"(%lu,%hu)",
735735
&this_keyset->blocknum,&this_keyset->offset);
736736
if (this_tuplefield[num_fields-1].value)
737-
sscanf(this_tuplefield[num_fields-1].value,"%u",
737+
sscanf(this_tuplefield[num_fields-1].value,"%lu",
738738
&this_keyset->oid);
739739
}
740740
self->currTuple++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp