nsresult nsMsgHdr::GetRawFlags(uint32_t *result) { if (!(m_initedValues & FLAGS_INITED)) InitFlags(); *result = m_flags; return NS_OK; }
/* Init most of all firms of client */ void InitUser (struct client * user, struct clientlist *clList, int fd) { //user->number = clList->cnt; It's not need.fn better GetUserId() user->next = NULL; user->contact = (struct settings*)malloc(sizeof(struct settings)); InitSettings (user->contact, fd, clList->cnt); user->f = (struct userFlags *) malloc (sizeof(struct userFlags)); InitFlags (user->f); user->sell = (struct auction *) malloc (sizeof(struct auction)); InitBuyOrSell (user->sell); user->buy = (struct auction *) malloc (sizeof(struct auction)); InitBuyOrSell (user->buy); user->data = (struct stuff *) malloc (sizeof(struct stuff)); InitStuff (user->data); user->buf = (struct buffer * ) malloc (sizeof(struct buffer)); InitBuffer (user->buf); user->cmd = (struct command * ) malloc (sizeof(struct command)); InitCommand (user->cmd); }
NS_IMETHODIMP nsMsgHdr::GetIsFlagged(bool *isFlagged) { NS_ENSURE_ARG_POINTER(isFlagged); if (!(m_initedValues & FLAGS_INITED)) InitFlags(); *isFlagged = !!(m_flags & nsMsgMessageFlags::Marked); return NS_OK; }
NS_IMETHODIMP nsMsgHdr::AndFlags(uint32_t flags, uint32_t *result) { if (!(m_initedValues & FLAGS_INITED)) InitFlags(); if ((m_flags & flags) != m_flags) SetFlags (m_flags & flags); *result = m_flags; return NS_OK; }
void XDLink::StopDebugger() { Send("detach"); DeleteLink(); CancelAllCommands(); InitFlags(); }
P4ClientAPI::P4ClientAPI( lua_State *L ) : L( L ) , specMgr( L ) , ui( L, &specMgr ) { debug = 0; server2 = 0; depth = 0; exceptionLevel = 2; maxResults = 0; maxScanRows = 0; maxLockTime = 0; prog = "unnamed p4lua script"; apiLevel = atoi( P4Tag::l_client ); enviro = new Enviro; // cb.client = this; InitFlags(); // Enable form parsing client.SetProtocol( "specstring", "" ); // // Load the current working directory, and any P4CONFIG file in place // HostEnv henv; StrBuf cwd; henv.GetCwd( cwd, enviro ); if( cwd.Length() ) enviro->Config( cwd ); // // Load the current ticket file. Start with the default, and then // override it if P4TICKETS is set. // const char *t; henv.GetTicketFile( ticketFile ); if( t = enviro->Get( "P4TICKETS" ) ) { ticketFile = t; } // // Do the same for P4CHARSET // const char *lc; if( ( lc = enviro->Get( "P4CHARSET" )) ) { SetCharset(lc); } }
NS_IMETHODIMP nsMsgHdr::GetFlags(uint32_t *result) { if (!(m_initedValues & FLAGS_INITED)) InitFlags(); if (m_mdb) *result = m_mdb->GetStatusFlags(this, m_flags); else *result = m_flags; #ifdef DEBUG_bienvenu NS_ASSERTION(! (*result & (nsMsgMessageFlags::Elided)), "shouldn't be set in db"); #endif return NS_OK; }
XDLink::XDLink() : CMLink(kFeatures), itsAcceptor(NULL), itsLink(NULL), itsParsedDataRoot(NULL) { InitFlags(); itsBPMgr = new XDBreakpointManager(this); assert( itsBPMgr != NULL ); itsSourcePathList = new JPtrArray<JString>(JPtrArrayT::kDeleteAll); assert( itsSourcePathList != NULL ); StartDebugger(); }
void XDLink::ConnectionEstablished ( XDSocket* socket ) { InitFlags(); itsLink = socket; ListenTo(itsLink); itsIDEKey.Clear(); itsAcceptor->close(); Broadcast(DebuggerStarted()); Broadcast(UserOutput(JGetString("Connected::XDLink"), kJFalse)); }
int main(int argc, char **argv) { InitFlags(); // Populate the tests vector. for (auto i = 0U; ; ++i) { const auto &test = test::__x86_test_table_begin[i]; if (&test >= &(test::__x86_test_table_end[0])) break; gTests.push_back(&test); } // Populate the random stack. memset(&gRandomStack, 0, sizeof(gRandomStack)); for (auto &b : gRandomStack.bytes) { b = static_cast<uint8_t>(random()); } testing::InitGoogleTest(&argc, argv); SetupSignals(); return RUN_ALL_TESTS(); }
__cdecl main(int argc, char **argp) { COUNTER index; COUNTER numFlags; COUNTER choseNum = 0; signed int paletteIndex = -1; char *cmdline = new char[10000]; pca_parse *Testparse; FLAG doneSH = False; if(argc == 1) { printf("PICA Version 4.1\nUsage is: pica @<filename> \nSee pica.html, or pica.ps for details\n"); exit(0); } // The working palette - the one that is passed to the renderer // This is either filled via quantization, or with a palette from // a file. It's zeroed to start. PALETTEENTRY Palette[256]; for(index = 0;index < 256;index++) { Palette[index].peRed = 0; Palette[index].peGreen = 0; Palette[index].peBlue = 0; Palette[index].peFlags = 0; } // If we're dealing with an input file, we need to construct the // parser differently. if(strstr(argp[1], "@") == NULL) { strcpy(cmdline, argp[1]); strcat(cmdline, " "); for(index = 2; index < (COUNTER) argc;index++) { strcat(cmdline, argp[index]); strcat(cmdline, " "); } Testparse = new pca_parse(cmdline); } else { Testparse = new pca_parse(argp[1]); } pca_parse &testparse = *Testparse; // numFlags is the number of filenames, including palette, // passed in. If you give 8 bitmaps to scan and remap, and a // palette that is being incrementally built, numFlags will // be 9. numFlags = testparse.GetFlagNumber(); // allFlags contains all flag information, it is filled by // the parser, and then broken down into the class-specific // flag structures - renderFlags, quantizeFlags, fileFlags. allFlags *inFlags = new allFlags[numFlags]; renderFlags *renderInfo = new renderFlags[numFlags]; quantizeFlags *quantizeInfo = new quantizeFlags[numFlags]; fileFlags *fileInfo = new fileFlags[numFlags]; // Set flags to their initial values. InitFlags(inFlags, renderInfo, quantizeInfo, fileInfo, numFlags); // The parser fills the inFlags with information, we will need to break // this up into the various class structures. testparse.MakeImageFlags(inFlags); // Get the shade/haze filenames up to the top, we'll scan them first. qsort(inFlags, numFlags, sizeof(allFlags),SHImageCompare); CopyAuxFlags(inFlags, renderInfo, quantizeInfo, fileInfo, numFlags); // Make the imageFile array, each file in the parse list // gets its own class. Whip through the array setting the flags // to their "index"ed value. All indices refer to the same thing, // i.e. the 5th entry in the renderFlags goes with the 5th entry of // the fileFlags, goes with the 5th entry of the quantizeFlags. imageFile *imageArray = new imageFile[numFlags]; for(index = 0;index < numFlags;index++) { imageArray[index].SetFlags(&fileInfo[index]); } // There are two special cases that I want to check for first. Sometimes there // is no list of bitmaps, as in the case of a makefile with art that has a variable // name but no entries, just a stub for later. In that case, we want to simply save // off the input palette and exit. The only flag will be for the PALNAME palette. if(numFlags == 1) { char *test = new char[256]; imageArray[0].Load(); if(imageArray[0].ReturnType() == PAL) { PALETTEENTRY *tempPal; tempPal = imageArray[0].GetPalette(); for(index = 0;index < 256;index++) { Palette[index].peRed = tempPal[index].peRed; Palette[index].peGreen = tempPal[index].peGreen; Palette[index].peBlue = tempPal[index].peBlue; Palette[index].peFlags = tempPal[index].peFlags; } imageArray[0].ReleaseData(); strcpy(test,inFlags[0].inPalOutput); // Prepends the path held in the imageArray's output path buffer. imageArray[0].MakeSaveName(test); imageFile PalSave; PalSave.SetType(PAL); PalSave.SetFilename(test); printf("Saving Palette to : %s\n",test); PalSave.SetPalette(Palette); PalSave.Save(); return 0; } imageArray[0].ReleaseData(); } // It's also possible that we have a MERGEPAL setup, where we want to read in a // transluscent palette and pick blended colors. What we want to do is "create" // a sort of bitmap with the blended colors in it. The syntax for this in the parse // file is to give, as the "bitmap list" a transluscency palette previously created. // Putting it in the bitmap list area makes sense (I hope) because we are making a faux // image out of it and scanning in colors. if(numFlags == 2) { imageArray[1].Load(); // If the only file in the "bitmap list" is a palette, we know what to do. Otherwise, // we are legitimately quantizing or rendering just one 24-bit bitmap. if(imageArray[1].ReturnType() == PAL) { BlendPalettes(inFlags, quantizeInfo, imageArray); return 0; } } // Throughout, I use the 0th flag for information // that must be the same for all files, forex. you cannot // quantize some of the files with ALPHA and some with RGB, // this requires two seperate calls. pca_quantize testquant(inFlags[0].inQuantizeFlag); // Moving on to the non-special case, this is the main loop for quantization, // it scans through the bitmaps, if it finds a palette, it loads it in as a fixed // palette. By the end of this "for" loop, we have scanned in all the bitmaps, and // are ready to call the quantization function. printf("Scanning : "); for(index = 0;index < numFlags;index++) { // Load the image data. imageArray[index].Load(); // If it is not a palette, it is something we are // interested in for its zero color. if(imageArray[index].ReturnType() != PAL) { // If no zero color was specified in the parse file, // set it to the upper left pixel value. if((inFlags[index].inZeroColor == NULL) && (inFlags[index].inZeroFlag == True)) { quantizeInfo[index].inZeroColor = new PALETTEENTRY; if(imageArray[index].GetZeroColor(quantizeInfo[index].inZeroColor) == False) { printf("Bitmap file %s is not loaded\n", inFlags[index].inFilename); exit(0); } renderInfo[index].inZeroColor = new PALETTEENTRY; renderInfo[index].inZeroColor->peRed = quantizeInfo[index].inZeroColor->peRed; renderInfo[index].inZeroColor->peGreen = quantizeInfo[index].inZeroColor->peGreen; renderInfo[index].inZeroColor->peBlue = quantizeInfo[index].inZeroColor->peBlue; renderInfo[index].inZeroColor->peFlags = quantizeInfo[index].inZeroColor->peFlags; } // if the zero color was specified in the parse file, // then we're fine, it's already been set in the quantize // and render info flags. Continue. } // If it's a palette file, we pull in the palette and add // the colors to the quantizer's fixed list. if(imageArray[index].ReturnType() == PAL) { // To refer to the palette file in the future, use the paletteIndex. paletteIndex = index; // We don't want to render the palette file. inFlags[paletteIndex].inRenderFlag = False; testquant.SetFlags(&quantizeInfo[index]); testquant.AddPaletteColors(imageArray[index].ReturnPal(), inFlags[index].inPaletteRangeFirst, inFlags[index].inPaletteRangeLast, inFlags[index].inRenderRangeFirst, inFlags[index].inRenderRangeLast); printf("\nFixed Palette : %s\n", inFlags[index].inFilename); } else // Otherwise it must be an image file (bmp/tga) and we can // try to find the zero color and scan it into the quantizer's // ColorData buffer. If we are supposed to be choosing colors, // the inChooseFlag will be true. We need the number "index" for // flag information, remember that inFlags[index], renderInfo[index], // etc. all refer to the same image file, they all contain attributes // needed by some function. if(inFlags[index].inChooseFlag == True) { if(imageArray[index].ReturnType() == BMP8) { AssertFatal(0, avar("ERROR - bitmap %s is not 24-bit \n", inFlags[index].inFilename)); } testquant.SetFlags(&quantizeInfo[index]); testquant.ScanImage(imageArray[index].GetData24(), imageArray[index].GetSize(), inFlags[index].inWeight); // // printf("Scanning : %s\n",inFlags[index].inFilename); printf("."); // We want to do this once and only once, when the first non-shaded/hazed // bitmap comes up. The "doneSH" flag is False until this loop, after which // it is true. Because of the sort, we are assured that the first bitmap we // hit with neither shade nor haze set will be the beginning of the last of // them! If the shade and haze colors are NULL, the HazeShadeScan will // return without doing anything. if((!inFlags[index].inShadeTowards) && (!inFlags[index].inHazeTowards) && (!doneSH) && (index > 0)) { doneSH = True; testquant.HazeShadeScan(inFlags[index-1].inShadeTowards, inFlags[index-1].inShadeIntensity, inFlags[index-1].inHazeTowards, inFlags[index-1].inHazeIntensity, inFlags[index-1].inShadeLevels, inFlags[index-1].inHazeLevels); } choseNum++; } imageArray[index].ReleaseData(); } printf("\n"); // Little overkill here, but the point is, if everything was shaded or hazed, we never hit the // if in the above, so do it now! if((choseNum != 0) && (inFlags[index].inShadeTowards) || (inFlags[index].inHazeTowards) && (!doneSH)) { testquant.HazeShadeScan(inFlags[index-1].inShadeTowards, inFlags[index-1].inShadeIntensity, inFlags[index-1].inHazeTowards, inFlags[index-1].inHazeIntensity, inFlags[index-1].inShadeLevels, inFlags[index-1].inHazeLevels); } // If we got colors from any bitmap and quantized them, save // the palette off and continue. if(choseNum != 0) { PALETTEENTRY *fixedPalette = NULL; COUNTER first = inFlags[0].inPaletteRangeFirst; COUNTER last = inFlags[0].inPaletteRangeLast; COUNTER renderFirst = inFlags[0].inRenderRangeFirst; COUNTER renderLast = inFlags[0].inRenderRangeLast; // If we got a palette, paletteIndex, if it exists // (i.e. != -1) is the index of the palette file in the flag structures. // We've registered the fixed palette with the quantizer, but we also need // it for the "RemakeFixedColors" function (from makepal.cpp), which restores // the order of the fixed palette. if(paletteIndex != -1) fixedPalette = imageArray[paletteIndex].GetPalette(); // Get the palette from the quantizer, and restore it to its original state // with the fixed palette. testquant.GetPalette(Palette, first, last); RemakeFixedColors(Palette, fixedPalette,first, last, renderFirst, renderLast); char *test = new char[256]; // Save it off. If we're choosing, then it's got a name : inPalOutput. strcpy(test,inFlags[0].inPalOutput); // Prepends the path held in the imageArray's output path buffer, this will be the // same for all bitmaps - so I can use "0". imageArray[0].MakeSaveName(test); imageFile PalSave; PalSave.SetType(PAL); PalSave.SetFilename(test); printf("Saving Palette to : %s\n",test); PalSave.SetPalette(Palette); PalSave.Save(); } else // If we didn't choose any colors from bitmaps, then we are // obviously just rendering, and for that we need a prefabbed // palette, find it in the imageFile list and load the palette. { for(index = 0;index < numFlags;index++) { imageArray[index].Load(); if(imageArray[index].ReturnType() == PAL) { paletteIndex = index; inFlags[paletteIndex].inRenderFlag = False; } imageArray[index].ReleaseData(); } PALETTEENTRY *tempPal; tempPal = imageArray[paletteIndex].GetPalette(); for(index = 0;index < 256;index++) { Palette[index].peRed = tempPal[index].peRed; Palette[index].peGreen = tempPal[index].peGreen; Palette[index].peBlue = tempPal[index].peBlue; Palette[index].peFlags = tempPal[index].peFlags; } } // Get our render object ready. Tell the render object what distance // calculation to do : RGB/LUV/ALPHA - this is a little hackey, // if the quantizer is doing alpha quantization, then the distancetype // must be ALPHA, so just set it. if(inFlags[0].inQuantizeFlag == ALPHA) inFlags[0].inDistanceType = ALPHA; render testRender(Palette, inFlags[0].inDistanceType); printf("Remapping : "); // Scan through the file list, and render those that need it. for(index = 0;index < numFlags;index++) { if(inFlags[index].inRenderFlag == True) { // If we'ere going to remap it, load it. imageArray[index].Load(); // the imageArray has found the height and width of each image, // the render class needs this information, so set the renderFlags // appropriately now. renderInfo[index].inWidth = imageArray[index].GetWidth(); renderInfo[index].inHeight = imageArray[index].GetHeight(); // Set the palette to remap to. imageArray[index].SetPalette(Palette); // printf("Remapping : %s\n",inFlags[index].inFilename); printf("."); // Set the relevant render data. testRender.SetData(imageArray[index].GetData8(), imageArray[index].GetData24(), &renderInfo[index]); // do it. testRender.RenderImage(); // save it as an 8-bit bitmap with the name given in fileFlags. imageArray[index].MakeSaveName(inFlags[index].inFilename); imageArray[index].SetFilename(inFlags[index].inFilename); imageArray[index].SetType(BMP8); imageArray[index].Save(); imageArray[index].ReleaseData(); } } printf("\nDone\n"); return 0; }
bool nsMsgHdr::IsAncestorKilled(uint32_t ancestorsToCheck) { if (!(m_initedValues & FLAGS_INITED)) InitFlags(); bool isKilled = m_flags & nsMsgMessageFlags::Ignored; if (!isKilled) { nsMsgKey threadParent; GetThreadParent(&threadParent); if (threadParent == m_messageKey) { // isKilled is false by virtue of the enclosing if statement NS_ERROR("Thread is parent of itself, please fix!"); nsCOMPtr<nsIMsgThread> thread; (void) m_mdb->GetThreadContainingMsgHdr(this, getter_AddRefs(thread)); if (!thread) return false; ReparentInThread(thread); // Something's wrong, but the problem happened some time ago, so erroring // out now is probably not a good idea. Ergo, we'll pretend to be OK, show // the user the thread (err on the side of caution), and let the assertion // alert debuggers to a problem. return false; } if (threadParent != nsMsgKey_None) { nsCOMPtr<nsIMsgDBHdr> parentHdr; (void) m_mdb->GetMsgHdrForKey(threadParent, getter_AddRefs(parentHdr)); if (parentHdr) { // More proofing against crashers. This crasher was derived from the // fact that something got borked, leaving is in hand with a circular // reference to borked headers inducing these loops. The defining // characteristic of these headers is that they don't actually seat // themselves in the thread properly. nsCOMPtr<nsIMsgThread> thread; (void) m_mdb->GetThreadContainingMsgHdr(this, getter_AddRefs(thread)); if (thread) { nsCOMPtr<nsIMsgDBHdr> claimant; (void) thread->GetChild(threadParent, getter_AddRefs(claimant)); if (!claimant) { // attempt to reparent, and say the thread isn't killed, // erring on the side of safety. ReparentInThread(thread); return false; } } if (!ancestorsToCheck) { // We think we have a parent, but we have no more ancestors to check NS_ASSERTION(false, "cycle in parent relationship, please fix!"); return false; } // closed system, cast ok nsMsgHdr* parent = static_cast<nsMsgHdr*>(parentHdr.get()); return parent->IsAncestorKilled(ancestorsToCheck - 1); } } } return isKilled; }