The QCP file format is used by many cellular telephone manufacturers to provide ring tones and record voice. It is based on RIFF , a generic format for storing chunks of data identified by tags. The QCP format does not specify how voice data in the file is encoded. Rather, it is a container format . QCP files are typically encoded QCELP or EVRC .
22-611: Qualcomm, which originated the format, has removed an internal web page link from the page that formerly discussed QCP. "Out of an abundance of caution, due to the December 31st, 2007 injunction ordered against certain Qualcomm products, Qualcomm has temporarily removed certain web content until it can be reviewed and modified if necessary to ensure compliance with the injunction. It may be several more days or weeks before these pages are accessible again. Thank you for your patience." QCP files have
44-413: A boolean or bool primitive type and so the use of 0 and 1 is ill-advised. This can be more confusing since 0 sometimes means programmatic success (when -1 means failure) and failure in other cases (when 1 means success). In C and C++, 0 represents the null pointer . As with Boolean values, the C standard library includes a macro definition NULL whose use is encouraged. Other languages provide
66-433: A is an array object, the function randomInt(x) chooses a random integer between 1 and x , inclusive, and swapEntries(i, j) swaps the i th and j th entries in the array. In the preceding example, 52 and 53 are magic numbers, also not clearly related to each other. It is considered better programming style to write the following: This is preferable for several reasons: Disadvantages are: In some contexts,
88-506: A magic number is any of the following: The term magic number or magic constant refers to the anti-pattern of using numbers directly in source code. This has been referred to as breaking one of the oldest rules of programming, dating back to the COBOL , FORTRAN and PL/1 manuals of the 1960s. The use of unnamed magic numbers in code obscures the developers' intent in choosing that number, increases opportunities for subtle errors (e.g.
110-462: A named constant would be more flexible and communicative. Thus, declaring const string testUserName = "John" is better than several occurrences of the 'magic value' "John" in a test suite . For example, if it is required to randomly shuffle the values in an array representing a standard pack of playing cards , this pseudocode does the job using the Fisher–Yates shuffle algorithm: where
132-500: A specific null or nil value and when this is the case no alternative should be used. The typed pointer constant nullptr has been introduced with C++11. Format indicators were first used in early Version 7 Unix source code. Unix was ported to one of the first DEC PDP-11 /20s, which did not have memory protection . So early versions of Unix used the relocatable memory reference model. Pre- Sixth Edition Unix versions read an executable file into memory and jumped to
154-568: Is a list of limits of data storage types: It is possible to create or alter globally unique identifiers (GUIDs) so that they are memorable, but this is highly discouraged as it compromises their strength as near-unique identifiers. The specifications for generating GUIDs and UUIDs are quite complex, which is what leads to them being virtually unique, if properly implemented. Microsoft Windows product ID numbers for Microsoft Office products sometimes end with 0000-0000-0000000FF1CE ("OFFICE"), such as { 90160000-008C-0000-0000-0000000FF1CE },
176-410: Is every digit correct in 3.14159265358979323846 and can be rounded to 3.14159? ) and makes it more difficult for the program to be adapted and extended in the future. Replacing all significant magic numbers with named constants (also called explanatory variables) makes programs easier to read, understand and maintain. Names chosen to be meaningful in the context of the program can result in code that
198-421: Is more easily understood by a maintainer who is not the original author (or even by the original author after a period of time). An example of an uninformatively named constant is int SIXTEEN = 16 , while int NUMBER_OF_BITS = 16 is more descriptive. The problems associated with magic 'numbers' described above are not limited to numerical types and the term is also applied to other data types where declaring
220-444: Is usually viewed in hexadecimal, so memorable repeating or hexspeak values are common. Numerically odd values may be preferred so that processors without byte addressing will fault when attempting to use them as pointers (which must fall at even addresses). Values should be chosen that are away from likely addresses (the program code, static data, heap data, or the stack). Similarly, they may be chosen so that they are not valid codes in
242-476: The magic number . Probably because of its uniqueness, the term magic number came to mean executable format type, then expanded to mean file system type, and expanded again to mean any type of file. Magic numbers are common in programs across many operating systems. Magic numbers implement strongly typed data and are a form of in-band signaling to the controlling program that reads the data type(s) at program run-time. Many files have such constants that identify
SECTION 10
#1732858477193264-530: The Unix exec() service over the executable image eight byte header and start the program. Since the Sixth and Seventh Editions of Unix employed paging code, the dual role of the header constant was hidden. That is, the exec() service read the executable file header ( meta ) data into a kernel space buffer, but read the executable image into user space , thereby not using the constant's branching feature. Magic number creation
286-514: The branch offset . In the Sixth Edition source code of the Unix program loader, the exec() function read the executable ( binary ) image from the file system. The first 8 bytes of the file was a header containing the sizes of the program (text) and initialized (global) data areas. Also, the first 16-bit word of the header was compared to two constants to determine if the executable image contained relocatable memory references (normal),
308-571: The contained data. Detecting such constants in files is a simple and effective way of distinguishing between many file formats and can yield further run-time information . The Unix utility program file can read and interpret magic numbers from files, and the file which is used to parse the information is called magic . The Windows utility TrID has a similar purpose. Magic numbers are common in API functions and interfaces across many operating systems , including DOS , Windows and NetWare : This
330-499: The first low memory address of the program, relative address zero. With the development of paged versions of Unix, a header was created to describe the executable image components. Also, a branch instruction was inserted as the first word of the header to skip the header and start the program. In this way a program could be run in the older relocatable memory reference (regular) mode or in paged mode. As more executable formats were developed, new constants were added by incrementing
352-488: The instruction set for the given architecture. Since it is very unlikely, although possible, that a 32-bit integer would take this specific value, the appearance of such a number in a debugger or memory dump most likely indicates an error such as a buffer overflow or an uninitialized variable . Famous and common examples include: Used by VLC player and some IP cameras in RTP / RTCP protocol, VLC player sends four bytes in
374-458: The newly implemented paged read-only executable image, or the separated instruction and data paged image. There was no mention of the dual role of the header constant, but the high order byte of the constant was, in fact, the operation code for the PDP-11 branch instruction ( octal 000407 or hex 0107). Adding seven to the program counter showed that if this constant was executed , it would branch
396-554: The order of the endianness of the system. Some IP cameras expect the player to send this magic number and do not start the stream if it is not received. Most of these are 32 bits long – the word size of most 32-bit architecture computers. The prevalence of these values in Microsoft technology is no coincidence; they are discussed in detail in Steve Maguire 's book Writing Solid Code from Microsoft Press . He gives
418-923: The product ID for the "Office 16 Click-to-Run Extensibility Component". Java uses several GUIDs starting with CAFEEFAC . In the GUID Partition Table of the GPT partitioning scheme, BIOS Boot partitions use the special GUID { 21686148-6449-6E6F-744E-656564454649 } which does not follow the GUID definition; instead, it is formed by using the ASCII codes for the string " Hah!IdontNeedEFI " partially in little endian order. Magic debug values are specific values written to memory during allocation or deallocation, so that it will later be possible to tell whether or not they have become corrupted, and to make it obvious when values taken from uninitialized memory are being used. Memory
440-437: The same signature as RIFF files: A SOF (start of file) header of 52494646 ("RIFF"), and an EOF (end of file) of 0000. Qualcomm previously offered downloads of the software and SDK for its PureVoice voice and audio enhancement products that could play and convert QCP files. This computer science article is a stub . You can help Misplaced Pages by expanding it . Magic number (programming) In computer programming ,
462-470: The use of unnamed numerical constants is generally accepted (and arguably "not magic"). While such acceptance is subjective, and often depends on individual coding habits, the following are common examples: The constants 1 and 0 are sometimes used to represent the Boolean values true and false in programming languages without a Boolean type, such as older versions of C . Most modern programming languages provide
SECTION 20
#1732858477193484-430: Was implemented in the Unix linker and loader and magic number branching was probably still used in the suite of stand-alone diagnostic programs that came with the Sixth and Seventh Editions. Thus, the header constant did provide an illusion and met the criteria for magic . In Version Seven Unix, the header constant was not tested directly, but assigned to a variable labeled ux_mag and subsequently referred to as
#192807