//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // PBook::Insert(): Insert a position. Returns OK if a new position // was inserted, or updates the comment and returns ERROR_Exists if // the position was already in the PBook. errorT PBook::Insert (Position * pos, const char * comment) { ASSERT (pos && comment); bookNodeT * node; errorT err; uint material = pos->GetCount(WHITE) + pos->GetCount(BLACK); compactBoardStr cboard; pos->PrintCompactStr (cboard); err = Tree[material]->Insert (cboard, &node); if (err != OK) { // Already exists; we overwrite the old data. delete[] node->data.comment; } else { SetHashFlag (pos); AddNodeToList (node); } node->data.comment = strDuplicate (comment); node->data.enpassant = pos->GetEPTarget(); Altered = true; if (material < LeastMaterial) { LeastMaterial = material; } Stats_Inserts[material]++; Stats_TotalInserts++; return err; }
void PBook::SetFileName (const char * fname) { if (FileName) { delete[] FileName; } if (!fname) { FileName = NULL; return; } // Allocate space for the filename string: FileName = strDuplicate(fname); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Crosstable::AddPlayer() // Adds a player to the crosstable, if that player is not // already listed. errorT Crosstable::AddPlayer (idNumberT id, const char * name, eloT elo) { for (uint i = 0; i < PlayerCount; i++) { if (PlayerData[i]->id == id) { // The player already exists in the crosstable, but // check the elo rating and keep the largest value: if (elo > PlayerData[i]->elo) { PlayerData[i]->elo = elo; } return OK; } } if (PlayerCount == CROSSTABLE_MaxPlayers) { return ERROR_Full; } #ifdef WINCE playerDataT * pdata = (playerDataT *) my_Tcl_Alloc(sizeof( playerDataT)); #else playerDataT * pdata = new playerDataT; #endif PlayerData[PlayerCount] = pdata; pdata->id = id; pdata->name = strDuplicate (name); pdata->elo = elo; pdata->score = 0; pdata->gameCount = 0; pdata->tiebreak = 0; pdata->oppEloCount = 0; pdata->oppEloTotal = 0; pdata->oppEloScore = 0; pdata->title[0] = 0; pdata->country[0] = 0; pdata->birthdate = ZERO_DATE; pdata->ageInYears = 0; for (uint opp = 0; opp < CROSSTABLE_MaxPlayers; opp++) { pdata->firstClash[opp] = pdata->lastClash[opp] = NULL; pdata->clashCount[opp] = 0; } for (uint round = 1; round < CROSSTABLE_MaxRounds; round++) { pdata->roundClash[round] = NULL; } // Find this players title and country if the SpellChecker is defined: // if (SpellCheck != NULL && !strIsSurnameOnly (name)) // makes it need an initial if (SpellCheck != NULL ) { const char * comment = SpellCheck->GetComment (name); // SpellCheck->GetCommentExact // makes it need a full christian name if (comment != NULL) { strCopy (pdata->title, SpellChecker::GetTitle (comment)); strCopy (pdata->country, SpellChecker::GetLastCountry (comment)); pdata->birthdate = SpellChecker::GetBirthdate (comment); if (strEqual (pdata->title, "w")) { strCopy (pdata->title, "w "); } } } PlayerCount++; return OK; }
void GLAssimpMeshBinding::loadMaterials(aiMaterial *material) { aiColor4D aiCol; if (AI_SUCCESS == aiGetMaterialColor(material, AI_MATKEY_COLOR_DIFFUSE, (aiColor4D*)&aiCol)) { matDiffuse.x = aiCol.r; matDiffuse.y = aiCol.g; matDiffuse.z = aiCol.b; matDiffuse.w = aiCol.a; } if (AI_SUCCESS == aiGetMaterialColor(material, AI_MATKEY_COLOR_SPECULAR, (aiColor4D*)&aiCol)) { matSpecular.x = aiCol.r; matSpecular.y = aiCol.g; matSpecular.z = aiCol.b; matSpecular.w = aiCol.a; } if (AI_SUCCESS == aiGetMaterialColor(material, AI_MATKEY_COLOR_AMBIENT, (aiColor4D*)&aiCol)) { matAmbient.x = aiCol.r; matAmbient.y = aiCol.g; matAmbient.z = aiCol.b; matAmbient.w = aiCol.a; } if (AI_SUCCESS == aiGetMaterialColor(material, AI_MATKEY_COLOR_EMISSIVE, (aiColor4D*)&aiCol)) { matEmissive.x = aiCol.r; matEmissive.y = aiCol.g; matEmissive.z = aiCol.b; matEmissive.w = aiCol.a; } if (AI_SUCCESS != aiGetMaterialFloat(material, AI_MATKEY_OPACITY, &matOpacity)) { matOpacity = 1.0f; } if (AI_SUCCESS != aiGetMaterialFloat(material, AI_MATKEY_SHININESS, &matShininess)) { matShininess = 1.0f; } aiString path; F32 blend; aiGetMaterialTexture(material, aiTextureType_DIFFUSE, 0, &path, NULL, NULL, &blend, NULL, NULL, NULL); matDiffuseTexture = strDuplicate(path.data); if (debugAssimp) { char buf[1024]; sprintf(buf, "Diffuse: %f %f %f %f", matDiffuse.x, matDiffuse.y, matDiffuse.z, matDiffuse.w); logmsg(buf); sprintf(buf, "Specular: %f %f %f %f", matSpecular.x, matSpecular.y, matSpecular.z, matSpecular.w); logmsg(buf); sprintf(buf, "Ambient: %f %f %f %f", matAmbient.x, matAmbient.y, matAmbient.z, matAmbient.w); logmsg(buf); sprintf(buf, "Emissive: %f %f %f %f", matEmissive.x, matEmissive.y, matEmissive.z, matEmissive.w); logmsg(buf); sprintf(buf, "Opacity: %f Shininess: %f", matOpacity, matShininess); logmsg(buf); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // PBook::StripOpcode: // Strips the specified opcode from every position in the book. // Only the first occurrence of an opcode is removed for any position, // but opcodes are not supposed to occur more than once anyway. // Returns the number of positions where an opcode was removed. uint PBook::StripOpcode (const char * opcode) { char * searchCode = new char [strLength(opcode) + 2]; strCopy (searchCode, opcode); strAppend (searchCode, " "); DString dstr; uint countFound = 0; for (uint i=0; i < NodeListCount; i++) { bookNodeT * node = NodeList[i]; if (node == NULL) { continue; } const char * s = node->data.comment; int startIndex = -1; int index = 0; // Look for a line with a matching opcode: while (*s != 0) { while (*s == '\n' || *s == ' ') { s++; index++; } if (strIsPrefix (searchCode, s)) { startIndex = index; countFound++; break; } while (*s != 0 && *s != '\n') { s++; index++; } } if (startIndex > -1) { s = node->data.comment; index = 0; // Add all characters before the line to be stripped: dstr.Clear(); while (index < startIndex) { dstr.AddChar (s[index]); index++; } // Now find the end of this line: s = &(s[startIndex + 1]); while (*s != 0 && *s != '\n') { s++; } if (*s == '\n') { s++; } while (*s != 0) { dstr.AddChar (*s); s++; } delete[] node->data.comment; node->data.comment = strDuplicate (dstr.Data()); } } delete[] searchCode; return countFound; }
error_t httpServerUriNotFoundCallback(HttpConnection *connection, const char_t *uri) { error_t error; size_t n; char_t *buffer; //Process data.xml file? if(!strcasecmp(uri, "/data.xml")) { //Point to the scratch buffer buffer = connection->buffer + 384; //Format XML data n = sprintf(buffer, "<data>\r\n"); n += sprintf(buffer + n, " <ax>%d</ax>\r\n", ax); n += sprintf(buffer + n, " <ay>%d</ay>\r\n", ay); n += sprintf(buffer + n, " <az>%d</az>\r\n", az); n += sprintf(buffer + n, " <adc>%u</adc>\r\n", adcValue); n += sprintf(buffer + n, " <joystick>%u</joystick>\r\n", joystickState); //End of XML data n += sprintf(buffer + n, "</data>\r\n"); //Format HTTP response header connection->response.version = connection->request.version; connection->response.statusCode = 200; connection->response.keepAlive = connection->request.keepAlive; connection->response.noCache = TRUE; connection->response.contentType = mimeGetType(".xml"); connection->response.chunkedEncoding = FALSE; connection->response.contentLength = n; //Send the header to the client error = httpWriteHeader(connection); //Any error to report? if(error) return error; //Send response body error = httpWriteStream(connection, buffer, n); //Any error to report? if(error) return error; //Properly close output stream error = httpCloseStream(connection); //Return status code return error; } //Process send_mail.xml file? else if(!strcasecmp(uri, "/send_mail.xml")) { char_t *separator; char_t *property; char_t *value; char_t *p; SmtpAuthInfo authInfo; SmtpMail mail; SmtpMailAddr recipients[4]; //Initialize structures to zero memset(&authInfo, 0, sizeof(authInfo)); memset(&mail, 0, sizeof(mail)); memset(recipients, 0, sizeof(recipients)); //Set the relevant PRNG algorithm to be used authInfo.prngAlgo = YARROW_PRNG_ALGO; authInfo.prngContext = &yarrowContext; //Set email recipients mail.recipients = recipients; //Point to the scratch buffer buffer = connection->buffer; //Start of exception handling block do { //Process HTTP request body while(1) { //Read the HTTP request body until an ampersand is encountered error = httpReadStream(connection, buffer, HTTP_SERVER_BUFFER_SIZE - 1, &n, HTTP_FLAG_BREAK('&')); //End of stream detected? if(error) break; //Properly terminate the string with a NULL character buffer[n] = '\0'; //Remove the trailing ampersand if(n > 0 && buffer[n - 1] == '&') buffer[--n] = '\0'; //Decode the percent-encoded string httpDecodePercentEncodedString(buffer, buffer, HTTP_SERVER_BUFFER_SIZE); //Check whether a separator is present separator = strchr(buffer, '='); //Separator found? if(separator) { //Split the line *separator = '\0'; //Get property name and value property = strTrimWhitespace(buffer); value = strTrimWhitespace(separator + 1); //Check property name if(!strcasecmp(property, "server")) { //Save server name authInfo.serverName = strDuplicate(value); } else if(!strcasecmp(property, "port")) { //Save the server port to be used authInfo.serverPort = atoi(value); } else if(!strcasecmp(property, "userName")) { //Save user name authInfo.userName = strDuplicate(value); } else if(!strcasecmp(property, "password")) { //Save password authInfo.password = strDuplicate(value); } else if(!strcasecmp(property, "useTls")) { //Open a secure SSL/TLS session? authInfo.useTls = TRUE; } else if(!strcasecmp(property, "recipient")) { //Split the recipient address list value = strtok_r(value, ", ", &p); //Loop through the list while(value != NULL) { //Save recipient address recipients[mail.recipientCount].name = NULL; recipients[mail.recipientCount].addr = strDuplicate(value); recipients[mail.recipientCount].type = SMTP_RCPT_TYPE_TO; //Get the next item in the list value = strtok_r(NULL, ", ", &p); //Increment the number of recipients if(++mail.recipientCount >= arraysize(recipients)) break; } } else if(!strcasecmp(property, "from")) { //Save sender address mail.from.name = NULL; mail.from.addr = strDuplicate(value); } else if(!strcasecmp(property, "date")) { //Save current time mail.dateTime = strDuplicate(value); } else if(!strcasecmp(property, "subject")) { //Save mail subject mail.subject = strDuplicate(value); } else if(!strcasecmp(property, "body")) { //Save mail body mail.body = strDuplicate(value); } } } //Propagate exception if necessary if(error != ERROR_END_OF_STREAM) break; //Send mail error = smtpSendMail(&authInfo, &mail); //Point to the scratch buffer buffer = connection->buffer + 384; //Format XML data n = sprintf(buffer, "<data>\r\n <status>"); if(error == NO_ERROR) n += sprintf(buffer + n, "Mail successfully sent!\r\n"); else if(error == ERROR_NAME_RESOLUTION_FAILED) n += sprintf(buffer + n, "Cannot resolve SMTP server name!\r\n"); else if(error == ERROR_AUTHENTICATION_FAILED) n += sprintf(buffer + n, "Authentication failed!\r\n"); else if(error == ERROR_UNEXPECTED_RESPONSE) n += sprintf(buffer + n, "Unexpected response from SMTP server!\r\n"); else n += sprintf(buffer + n, "Failed to send mail (error %d)!\r\n", error); n += sprintf(buffer + n, "</status>\r\n</data>\r\n"); //Format HTTP response header connection->response.version = connection->request.version; connection->response.statusCode = 200; connection->response.keepAlive = connection->request.keepAlive; connection->response.noCache = TRUE; connection->response.contentType = mimeGetType(".xml"); connection->response.chunkedEncoding = FALSE; connection->response.contentLength = n; //Send the header to the client error = httpWriteHeader(connection); //Any error to report? if(error) break; //Send response body error = httpWriteStream(connection, buffer, n); //Any error to report? if(error) break; //Properly close output stream error = httpCloseStream(connection); //Any error to report? if(error) break; //End of exception handling block } while(0); //Free previously allocated memory osFreeMem((void *) authInfo.serverName); osFreeMem((void *) authInfo.userName); osFreeMem((void *) authInfo.password); osFreeMem((void *) recipients[0].addr); osFreeMem((void *) mail.from.addr); osFreeMem((void *) mail.dateTime); osFreeMem((void *) mail.subject); osFreeMem((void *) mail.body); //Return status code return error; } else { return ERROR_NOT_FOUND; } }
void Property::setValue(const char* value) { if (this->value) { delete [] this->value; } this->value = strDuplicate(value); }
void Property::setName(const char* name) { if (this->name) { delete [] this->name; } this->name = strDuplicate(name); }
Property::Property(const char* name, const char* value) { this->name = strDuplicate(name); this->value = strDuplicate(value); }
S32 PCMAudioManager::playStreamingSound(const char *assetName, S16 loops, F32 leftVol, F32 rightVol, F32 rate) { if (leftVol < 0) { leftVol = 0; } else if (leftVol > 1) { leftVol = 1; } if (rightVol < 0) { rightVol = 0; } else if (rightVol > 1) { rightVol = 1; } S32 streamId = -1; //char buf[50]; //sprintf(buf, "Playing sound %i", soundId); //logmsg(buf); // create a stream BOOL32 success = FALSE; for (S32 i = 0; i < streamCount; i++) { PCMStream *stream = &pcmStreams[i]; if (!stream->isPlaying && !stream->audioHandle) { //sprintf(buf, "Using Stream %i", i); //logmsg(buf); // use this stream; stream->isStreaming = TRUE; stream->pcmSound = NULL; stream->loopsRemaining = loops; stream->bufferPosition = 0; stream->overallPosition = 0; streamId = ++lastStreamId; stream->streamId = streamId; stream->volumeLeft = leftVol; stream->volumeRight = rightVol; stream->assetName = strDuplicate(assetName); stream->channels = 0; stream->playbackRate = rate; stream->filePosition = 0; stream->assetLength = _platform_get_asset_length(assetName); if (stream->assetLength > 0) { // get vorbis handle and read info // fill both audio buffers if (!stream->audioBuf) { stream->audioBuf = new S16*[PCM_AUDIO_STREAM_BUFFERS]; for (S32 j = 0; j < PCM_AUDIO_STREAM_BUFFERS; j++) { stream->audioBuf[j] = new S16[PCM_AUDIO_STREAM_BUFFER_SIZE]; } } unsigned char buf[CHUNKED_READ_BUFFER_SIZE]; BOOL32 eof = FALSE; S32 bytesRead = _platform_read_asset_chunk(assetName, 0, buf, CHUNKED_READ_BUFFER_SIZE, &eof); S32 bytesConsumed; S32 error; // start vorbis pushdata stb_vorbis *vorb = stb_vorbis_open_pushdata(buf, bytesRead, &bytesConsumed, &error, NULL); stb_vorbis_info info = stb_vorbis_get_info(vorb); stream->channels = info.channels; stream->sampleRate = info.sample_rate; stream->maxFrameSize = info.max_frame_size; stream->length = 0; // unknown until we hit eof stream->tempLength = 0; stream->filePosition = bytesConsumed; stream->audioHandle = vorb; stream->resampleActiveRate = stream->sampleRate * stream->playbackRate; stream->resampleInt = stream->resampleActiveRate / PCM_AUDIO_PLAYBACK_RATE; stream->resampleFrac = stream->resampleActiveRate % PCM_AUDIO_PLAYBACK_RATE; stream->resampleFracAccumulated = 0; for (S32 j = 0; j < PCM_AUDIO_STREAM_BUFFERS; j++) { fillStreamingBuffer(stream, j); } stream->activeAudioBuf = 0; // set isPlaying to true last stream->isPlaying = TRUE; } success = TRUE; break; } } if (!success) { logmsg("No streams left to play on"); } return streamId; }
BTIOSystem::BTIOSystem(const char *basePath) { this->basePath = strDuplicate(basePath); }
BOOL OnNotify(HWND hDlg, LPNMHDR lpNMHdr) { //DEBUGMESSAGE(("OnNotify")); UINT uiCode = lpNMHdr->code; switch (uiCode) { case PSN_APPLY: { DEBUGMESSAGE(("OnNotify - PSN_APPLY")); DocumentPropDialogData *data = (DocumentPropDialogData *) GetWindowLongPtr(hDlg, DWL_USER); if (data == NULL) { DEBUGMESSAGE(("DocPropDlgProc - invalid internal data pointer")); return FALSE; } // which format combo should we use? LPTSTR format = NULL; if (IsDlgButtonChecked(hDlg, IDC_VECTOR_FORMAT_RADIOBOX) == BST_CHECKED) { INT sel = GetComboCurSel(GetDlgItem(hDlg, IDC_COMBO_VECTOR_FORMAT)); format = strDuplicate(g_vectorFormats[sel].strName); } else if (IsDlgButtonChecked(hDlg, IDC_RASTER_FORMAT_RADIOBOX) == BST_CHECKED) { INT sel = GetComboCurSel(GetDlgItem(hDlg, IDC_COMBO_RASTER_FORMAT)); format = strDuplicate(g_rasterFormats[sel].strName); } else { DEBUGMESSAGE(("DocPropDlgProc - unexpected condition")); return FALSE; } // get the output folder & validate it LPTSTR folder = NULL; if (!GetEditControlText(&folder, GetDlgItem(hDlg, IDC_OUTPUT_FOLDER))) { DEBUGMESSAGE(("DocPropDlgProc - could not get output folder text")); return FALSE; } if (!FolderExists(folder)) { ErrorMessage(hDlg, TEXT("Warning"), TEXT("The given output directory does not exist!")); return FALSE; } // get the output filename & validate it LPTSTR filename = NULL; if (!GetEditControlText(&filename, GetDlgItem(hDlg, IDC_OUTPUT_FILENAME))) { DEBUGMESSAGE(("DocPropDlgProc - could not get output filename text")); return FALSE; } if (!IsValidFilename(filename)) { LPTSTR temp = strCat(TEXT("The given output filename is not valid!\n"), TEXT("It should not contain any of the '"), g_strFileNameForbiddenChars, TEXT("' characters."), NULL); ErrorMessage(hDlg, TEXT("Warning"), temp); strFree(temp); return FALSE; } // get the raster conv options LPTSTR rasteropt = NULL; if (!GetEditControlText(&rasteropt, GetDlgItem(hDlg, IDC_IMAGEMAGICK_OPTIONS))) { DEBUGMESSAGE(("DocPropDlgProc - could not get raster conv opt text")); return FALSE; } // get the postgen cmd LPTSTR postgen = NULL; if (!GetEditControlText(&postgen, GetDlgItem(hDlg, IDC_POSTGEN_CMD))) { DEBUGMESSAGE(("DocPropDlgProc - could not get postgen cmd text")); return FALSE; } // get override checkbox status BOOL override = IsDlgButtonChecked(hDlg, IDC_OVERRIDE_CHECKBOX) == BST_CHECKED; // get crop checkbox BOOL crop = IsDlgButtonChecked(hDlg, IDC_CROP_CHECKBOX) == BST_CHECKED; // get open-output checkbox BOOL openout = IsDlgButtonChecked(hDlg, IDC_OPEN_VIEWER_CHECKBOX) == BST_CHECKED; // save all data in the EXTDEVMODE extdmSetPrivateData(data->m_pExtdmCurrent, format, filename, folder, rasteropt, postgen, override, openout, crop); // cleanup strFree(format); strFree(filename); strFree(folder); strFree(postgen); strFree(rasteropt); // call the _SET_RESULT callback PFNCOMPROPSHEET pfnComPropSheet = data->m_pfnComPropSheet; LONG lTemp = pfnComPropSheet( data->m_hComPropSheet, CPSFUNC_SET_RESULT, (LPARAM) data->m_hPropSheetAdded, CPSUI_OK ); return TRUE; } break; case PSN_RESET: break; case PSN_SETACTIVE: break; default: break; } return FALSE; }
ScreenControlRenderer::ScreenControlRenderer(GameContext *context, const char *fontTag) { this->context = context; this->fontTag = strDuplicate(fontTag); }
error_t ssiProcessIncludeCommand(HttpConnection *connection, const char_t *tag, size_t length, const char_t *uri, uint_t level) { error_t error; char_t *separator; char_t *attribute; char_t *value; char_t *path; char_t *p; //Discard invalid SSI directives if(length < 7 || length >= HTTP_SERVER_BUFFER_SIZE) return ERROR_INVALID_TAG; //Skip the SSI include command (7 bytes) memcpy(connection->buffer, tag + 7, length - 7); //Ensure the resulting string is NULL-terminated connection->buffer[length - 7] = '\0'; //Check whether a separator is present separator = strchr(connection->buffer, '='); //Separator not found? if(!separator) return ERROR_INVALID_TAG; //Split the tag *separator = '\0'; //Get attribute name and value attribute = strTrimWhitespace(connection->buffer); value = strTrimWhitespace(separator + 1); //Remove leading simple or double quote if(value[0] == '\'' || value[0] == '\"') value++; //Get the length of the attribute value length = strlen(value); //Remove trailing simple or double quote if(length > 0) { if(value[length - 1] == '\'' || value[length - 1] == '\"') value[length - 1] = '\0'; } //Check the length of the filename if(strlen(value) > HTTP_SERVER_URI_MAX_LEN) return ERROR_INVALID_TAG; //The file parameter defines the included file as relative to the document path if(!strcasecmp(attribute, "file")) { //Allocate a buffer to hold the path to the file to be included path = osAllocMem(strlen(uri) + strlen(value) + 1); //Failed to allocate memory? if(!path) return ERROR_OUT_OF_MEMORY; //Copy the path identifying the script file being processed strcpy(path, uri); //Search for the last slash character p = strrchr(path, '/'); //Remove the filename from the path if applicable if(p) strcpy(p + 1, value); else strcpy(path, value); } //The virtual parameter defines the included file as relative to the document root else if(!strcasecmp(attribute, "virtual")) { //Copy the absolute path path = strDuplicate(value); //Failed to duplicate the string? if(!path) return ERROR_OUT_OF_MEMORY; } //Unknown parameter... else { //Report an error return ERROR_INVALID_TAG; } //Use server-side scripting to dynamically generate HTML code? if(httpCompExtension(value, ".stm") || httpCompExtension(value, ".shtm") || httpCompExtension(value, ".shtml")) { //SSI processing (Server Side Includes) error = ssiExecuteScript(connection, path, level + 1); } else { #if (HTTP_SERVER_FS_SUPPORT == ENABLED) FsFile *file; //Retrieve the full pathname httpGetAbsolutePath(connection, path, connection->buffer, HTTP_SERVER_BUFFER_SIZE); //Open the file for reading file = fsOpenFile(connection->buffer, FS_FILE_MODE_READ); //Successful operation? if(file) { //Send the contents of the requested file while(1) { //Read data from the specified file error = fsReadFile(file, connection->buffer, HTTP_SERVER_BUFFER_SIZE, &length); //End of input stream? if(error) break; //Send data to the client error = httpWriteStream(connection, connection->buffer, length); //Any error to report? if(error) break; } //Close the file fsCloseFile(file); //Successful file transfer? if(error == ERROR_END_OF_STREAM) error = NO_ERROR; } else { //The specified URI cannot be found error = ERROR_NOT_FOUND; } #else uint8_t *data; //Retrieve the full pathname httpGetAbsolutePath(connection, path, connection->buffer, HTTP_SERVER_BUFFER_SIZE); //Get the resource data associated with the file error = resGetData(connection->buffer, &data, &length); //Send the contents of the requested file if(!error) error = httpWriteStream(connection, data, length); #endif } //Cannot found the specified resource? if(error == ERROR_NOT_FOUND) error = ERROR_INVALID_TAG; //Release previously allocated memory osFreeMem(path); //return status code return error; }
/**/ /* Old unicl's configuation function. */ /**/local void /**/setConfiguration() /**/{ /**/ switch (defaultComp) { /**/ case UNI_COMP_gnu: /**/ switch (defaultOS) { /**/ case UNI_OS_AIXRS: /**/ LINK = "gcc"; /**/ CC = "gcc -Wall -Wno-unused -Wno-uninitialized -Wno-parentheses"; /**/ break; /**/ case UNI_OS_LINUX: /* May want to specialise for a.out */ /**/ LINK = "gcc"; /**/ CC = "gcc"; /**/ break; /**/ default: /**/ LINK = "gcc"; /**/ CC = "gcc"; /**/ break; /**/ } /**/ conf_optimize = "-O3"; /**/ break; /**/ /**/ case UNI_COMP_suncc: /**/ CC = "cc -fsingle"; /**/ LINK = "cc"; /**/ break; /**/ case UNI_COMP_decosf: /**/ CC = "cc -ieee_with_inexact -float -Olimit 1000"; /**/ LINK = "cc"; /**/ break; /**/ /**/ case UNI_COMP_mips: /**/#if HW_MIPS == 1 /**/ CC = "cc -mips1 "; /**/ LINK = "cc -mips1"; /**/#elif HW_MIPS == 2 /**/ CC = "cc -mips2 "; /**/ LINK = "cc -mips2"; /**/#elif HW_MIPS == 3 /**/ CC = "cc -mips3 -n32 -OPT:Olimit=0 -OPT:fold_arith_limit=8000 -woff 1177"; /**/ LINK = "cc -mips3 -n32 \"-Wl,-woff 84\""; /**/#elif HW_MIPS == 4 /**/ CC = "cc -mips4 -n32 -OPT:Olimit=0 -OPT:fold_arith_limit=8000"; /**/ LINK = "cc -mips4 -n32 -woff 84"; /**/#endif /**/ break; /**/ /**/ case UNI_COMP_borland: /**/ CC = "bcc"; /**/ LINK = "bcc"; /**/ break; /**/ /**/ case UNI_COMP_microsoft: /**/ CC = "cl /nologo"; /**/ LINK = "cl /nologo"; /**/ osLibExt = "lib"; /**/ break; /**/ /**/ case UNI_COMP_c370: /**/ CC = "EXEC CC"; /**/ LINK = "EXEC CMOD"; /**/ break; /**/ /**/ case UNI_COMP_ibm: /**/ switch (defaultOS) { /**/ case UNI_OS_AIXRS: /**/#ifdef OS_AIX41_RS /**/ CC = "cc"; /**/ LINK = "cc"; /**/#else /**/ CC = "xlc"; /**/ LINK = "xlc"; /**/#endif /**/ break; /**/ case UNI_OS_AIXRT: /**/ CC = "cc -a -Nn5000 -Nd5000 -Np6000 -Nt5000 -lm"; /**/ LINK = "cc"; /**/ break; /**/ case UNI_OS_OS2: /**/ CC = "icc"; /**/ LINK = "icc"; /**/ break; /**/ default: /**/ CC = "cc"; /**/ LINK = "cc"; /**/ }; /**/ break; /**/ /**/ default: /**/ CC = "cc"; /**/ LINK = "cc"; /**/ }; /**/ /**/ switch (defaultOS) { /**/ case UNI_OS_DOS: /**/ osDirSep = '\\'; /**/ osSwitchChar = '/'; /**/ osPathSep = ';'; /**/ osOptSep = ""; /**/ /**/ if (defaultComp == UNI_COMP_gnu) { /**/ osDefaultLibraryPath = "C:\\DJGPP\\LIB"; /**/ osDefaultIncludePath = "C:\\DJGPP\\INCLUDE"; /**/ } /**/ else { /**/ osDefaultLibraryPath = ""; /**/ osDefaultIncludePath = ""; /**/ } /**/ /**/ break; /**/ /**/ case UNI_OS_WIN32: /**/ osDirSep = '\\'; /**/ osSwitchChar = '/'; /**/ osPathSep = ';'; /**/ osOptSep = ""; /**/ /**/ if (defaultComp == UNI_COMP_microsoft) { /**/ osDefaultLibraryPath = "C:\\MSDEV\\LIB"; /**/ osDefaultIncludePath = "C:\\MSDEV\\INCLUDE"; /**/ } /**/ else { /**/ osDefaultLibraryPath = ""; /**/ osDefaultIncludePath = ""; /**/ } /**/ /**/ break; /**/ /**/ case UNI_OS_OS2: /**/ osDirSep = '\\'; /**/ osSwitchChar = '/'; /**/ osPathSep = ';'; /**/ osOptSep = ""; /**/ /**/ if (defaultComp == UNI_COMP_ibm) { /**/ osDefaultLibraryPath = "C:\\AXIOMXL\\BASE\\OS2_ICC\\LIB"; /**/ osDefaultIncludePath = "C:\\AXIOMXL\\BASE\\OS2_ICC\\INCLUDE"; /**/ } /**/ else if (defaultComp == UNI_COMP_borland) { /**/ osDefaultLibraryPath = "C:\\AXIOMXL\\BASE\\OS2_BCC\\LIB;C:\\BCOS2\\LIB"; /**/ osDefaultIncludePath = "C:\\AXIOMXL\\BASE\\OS2_BCC\\INCLUDE;C:\\BCOS2\\INCLUDE"; /**/ } /**/ else { /**/ osDefaultLibraryPath = ""; /**/ osDefaultIncludePath = ""; /**/ } /**/ /**/ break; /**/ /**/ case UNI_OS_CMS: /**/ osDirSep = ' '; /**/ osSwitchChar = ' '; /**/ osPathSep = ' '; /**/ osOptSep = " "; /**/ /**/ osDefaultLibraryPath = ALL_DISK_LETTERS; /**/ osDefaultIncludePath = ALL_DISK_LETTERS; /**/ break; /**/ /**/ case UNI_OS_IRIX: /**/ /**/ /* because on IRIX libraries are in /usr/lib /usr/lib32 /usr/lib64 */ /**/ osDirSep = '/'; /**/ osSwitchChar = '-'; /**/ osPathSep = ':'; /**/ osOptSep = ""; /**/ /**/ osDefaultLibraryPath = ""; /**/ osDefaultIncludePath = ""; /**/ break; /**/ /**/ default: /**/ /* default is to treat like Unix* */ /**/ /**/ osDirSep = '/'; /**/ osSwitchChar = '-'; /**/ osPathSep = ':'; /**/ osOptSep = ""; /**/ /**/ osDefaultLibraryPath = "/lib:/usr/lib:/usr/local/lib"; /**/ osDefaultIncludePath = ""; /**/ }; /**/ /**/ /* make sure following are not in read-only storage */ /**/ /**/ osOptSep = strDuplicate(osOptSep); /**/ osLibExt = strDuplicate(osLibExt); /**/ osDefaultLibraryPath = strDuplicate(osDefaultLibraryPath); /**/ osDefaultIncludePath = strDuplicate(osDefaultIncludePath); /**/}