CStringA CHttpUploadFileProc::GetContentHead(LPCSTR lpszFileName) { CStringA straContentHead; CStringA straTemp; straContentHead.Empty(); straTemp.Format("--%s\r\n", GetBoundary()); //First Boundary straContentHead += straTemp; straTemp = ValueStr("Email", CStringA(m_threadParam.szEmail)); //Email straContentHead += straTemp; straTemp = ValueStr("FileName", lpszFileName); //FileName straContentHead += straTemp; straTemp = ValueStr("Description", CStringA(m_threadParam.szDesc)); //FileName straContentHead += straTemp; straTemp.Format("Content-Disposition: form-data; name=\"filedata\"; filename=\"%s\"\r\n" //File "Content-Type: application/octet-stream\r\n" //File Type "\r\n", lpszFileName); straContentHead += straTemp; return straContentHead; }
FSsValue SsValueSeriarizer__MakeValue(const char* v) { FString temp(v); if(temp.IsNumeric()) { return FSsValue((float)atof(v)); } else { FString ValueStr(babel::utf8_to_sjis(v).c_str()); CheckReplaceJapaneseString(v, ValueStr); return FSsValue(ValueStr); } }
extern LargeByteString * ValueToLBS( ValueStruct *val, char *codeset) { byte work[SIZE_NUMBUF+1]; byte work2[SIZE_NUMBUF+2]; byte *p , *q; int i; int size; LargeByteString *ret; ENTER_FUNC; if ( val == NULL ) { ret = NULL; } else { dbgprintf("type = %X\n",(int)ValueType(val)); if ( ValueStr(val) == NULL ) { ValueStr(val) = NewLBS(); } LBS_EmitStart(ValueStr(val)); if ( IS_VALUE_NIL(val) ) { LBS_EmitChar(ValueStr(val),CHAR_NIL); } else switch (ValueType(val)) { case GL_TYPE_CHAR: case GL_TYPE_VARCHAR: case GL_TYPE_TEXT: case GL_TYPE_SYMBOL: case GL_TYPE_DBCODE: if ( ValueString(val) != NULL ) { RewindLBS(ValueStr(val)); if ( IS_VALUE_EXPANDABLE(val) ) { LBS_EmitStringCodeset(ValueStr(val),ValueString(val), ValueStringSize(val), ValueStringLength(val),codeset); if ( ( size = ValueStringLength(val) - ValueSize(val) ) > 0 ) { for ( ; size > 0 ; size -- ) { LBS_EmitChar(ValueStr(val),0); } } } else { LBS_EmitStringCodeset(ValueStr(val),ValueString(val), ValueStringSize(val), 0,codeset); } } break; case GL_TYPE_BYTE: case GL_TYPE_BINARY: #ifdef BINARY_IS_BASE64 size = ( ( ValueByteLength(val) + 2 ) / 3 ) * 4; p = (char *)xmalloc(size); size = EncodeBase64(p,size,ValueByte(val),ValueByteLength(val)); LBS_ReserveSize(ValueStr(val),size+1); strcpy(ValueStrBody(val),p); xfree(p); #else p = ValueByte(val); for ( i = 0 ; i < ValueByteLength(val) ; i ++ , p ++ ) { switch (*p) { case '\\': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'\\'); break; case '"': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'"'); break; case '/': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'/'); break; case '\b': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'b'); break; case '\f': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'f'); break; case '\n': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'n'); break; case '\r': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'r'); break; case '\t': LBS_EmitChar(ValueStr(val),'\\'); LBS_EmitChar(ValueStr(val),'t'); break; default: if ( isprint(*p) ) { LBS_EmitChar(ValueStr(val),*p); } else { sprintf(work,"\\u%02X",(int)*p); LBS_EmitString(ValueStr(val),work); } break; } } if ( ( size = ValueStringLength(val) - ValueSize(val) ) > 0 ) { for ( ; size > 0 ; size -- ) { LBS_EmitByte(ValueStr(val),0); } } #endif break; case GL_TYPE_NUMBER: strcpy(work,ValueFixedBody(val)); p = work; q = work2; if ( *p >= 0x70 ) { *q ++ = '-'; *p ^= 0x40; } strcpy(q,p); if ( ValueFixedSlen(val) > 0 ) { p = work2 + strlen(work2); *(p + 1) = 0; q = p - 1; for ( i = 0 ; i < ValueFixedSlen(val) ; i ++ ) { *p -- = *q --; } *p = '.'; } LBS_EmitString(ValueStr(val),work2); break; case GL_TYPE_INT: sprintf(work,"%d",ValueInteger(val)); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_OBJECT: sprintf(work,"%d",(int)ValueObjectId(val)); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_FLOAT: sprintf(work,"%g",ValueFloat(val)); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_BOOL: sprintf(work,"%s",ValueBool(val) ? "TRUE" : "FALSE"); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_TIMESTAMP: sprintf(work,"%04d%02d%02d%02d%02d%02d", ValueDateTimeYear(val), ValueDateTimeMon(val) + 1, ValueDateTimeMDay(val), ValueDateTimeHour(val), ValueDateTimeMin(val), ValueDateTimeSec(val)); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_DATE: sprintf(work,"%04d%02d%02d", ValueDateTimeYear(val), ValueDateTimeMon(val) + 1, ValueDateTimeMDay(val)); LBS_EmitString(ValueStr(val),work); break; case GL_TYPE_TIME: sprintf(work,"%02d%02d%02d", ValueDateTimeHour(val), ValueDateTimeMin(val), ValueDateTimeSec(val)); LBS_EmitString(ValueStr(val),work); break; default: break; } LBS_EmitEnd(ValueStr(val)); ret = ValueStr(val); } LEAVE_FUNC; return (ret); }
extern byte * ValueToBinary( ValueStruct *val) { byte *ret; ENTER_FUNC; if ( val == NULL ) { ret = NULL; } else { dbgprintf("type = %X\n",(int)ValueType(val)); if ( ValueStr(val) == NULL ) { ValueStr(val) = NewLBS(); } LBS_EmitStart(ValueStr(val)); if ( IS_VALUE_NIL(val) ) { LBS_EmitChar(ValueStr(val),CHAR_NIL); } else { switch (ValueType(val)) { case GL_TYPE_CHAR: case GL_TYPE_VARCHAR: case GL_TYPE_DBCODE: case GL_TYPE_TEXT: case GL_TYPE_SYMBOL: if ( ValueString(val) != NULL ) { LBS_ReserveSize(ValueStr(val),strlen(ValueString(val))+1,FALSE); strcpy(ValueStrBody(val),ValueString(val)); } else { LBS_EmitChar(ValueStr(val),CHAR_NIL); } break; case GL_TYPE_BYTE: case GL_TYPE_BINARY: LBS_ReserveSize(ValueStr(val),ValueByteLength(val),FALSE); memcpy(ValueStrBody(val),ValueByte(val),ValueByteLength(val)); break; case GL_TYPE_NUMBER: LBS_ReserveSize(ValueStr(val),sizeof(Fixed),FALSE); memcpy(ValueStrBody(val),&ValueFixed(val),sizeof(Fixed)); break; case GL_TYPE_INT: LBS_ReserveSize(ValueStr(val),sizeof(int),FALSE); memcpy(ValueStrBody(val),&ValueInteger(val),sizeof(int)); break; case GL_TYPE_OBJECT: LBS_ReserveSize(ValueStr(val),sizeof(MonObjectType),FALSE); memcpy(ValueStrBody(val),&ValueObject(val),sizeof(MonObjectType)); break; case GL_TYPE_FLOAT: LBS_ReserveSize(ValueStr(val),sizeof(double),FALSE); memcpy(ValueStrBody(val),&ValueFloat(val),sizeof(double)); break; case GL_TYPE_BOOL: LBS_ReserveSize(ValueStr(val),sizeof(Bool),FALSE); memcpy(ValueStrBody(val),&ValueBool(val),sizeof(Bool)); break; case GL_TYPE_TIMESTAMP: case GL_TYPE_DATE: case GL_TYPE_TIME: LBS_ReserveSize(ValueStr(val),sizeof(int)*9,FALSE); memcpy(ValueStrBody(val),&ValueDateTime(val),sizeof(int)*9); break; default: break; } } ret = ValueStrBody(val); } LEAVE_FUNC; return (ret); }